feat 自定义电影电视剧媒体库目录名,不填默认电影|电视剧

This commit is contained in:
thsrite
2023-08-03 16:30:31 +08:00
parent 6425dbb6fb
commit 4a20c56bea
3 changed files with 19 additions and 2 deletions

View File

@ -145,6 +145,10 @@ class Settings(BaseSettings):
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.57"
# 媒体库目录
LIBRARY_PATH: str = None
# 电影媒体库目录名,默认"电影"
LIBRARY_MOVIE_NAME: str = None
# 电视剧媒体库目录名,默认"电视剧"
LIBRARY_TV_NAME: str = None
# 二级分类
LIBRARY_CATEGORY: bool = True
# 电影重命名格式

View File

@ -349,8 +349,19 @@ class FileTransferModule(_ModuleBase):
if not target_dir.exists():
return f"{target_dir} 目标路径不存在"
# 目的目录加上类型和二级分类
target_dir = target_dir / mediainfo.type.value / mediainfo.category
if mediainfo.type == MediaType.MOVIE:
if settings.LIBRARY_MOVIE_NAME:
target_dir = target_dir / settings.LIBRARY_MOVIE_NAME / mediainfo.category
else:
# 目的目录加上类型和二级分类
target_dir = target_dir / mediainfo.type.value / mediainfo.category
if mediainfo.type == MediaType.TV:
if settings.LIBRARY_TV_NAME:
target_dir = target_dir / settings.LIBRARY_TV_NAME / mediainfo.category
else:
# 目的目录加上类型和二级分类
target_dir = target_dir / mediainfo.type.value / mediainfo.category
# 重命名格式
rename_format = settings.TV_RENAME_FORMAT \