diff --git a/README.md b/README.md index 183068f2..0a0d750a 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ docker pull jxxghp/moviepilot:latest - **DOWNLOAD_PATH:** 下载保存目录,**注意:需要将`moviepilot`及`下载器`的映射路径保持一致**,否则会导致下载文件无法转移 - **DOWNLOAD_MOVIE_PATH:** 电影下载保存目录,**必须是`DOWNLOAD_PATH`的下级路径**,不设置则下载到`DOWNLOAD_PATH` - **DOWNLOAD_TV_PATH:** 电视剧下载保存目录,**必须是`DOWNLOAD_PATH`的下级路径**,不设置则下载到`DOWNLOAD_PATH` +- **DOWNLOAD_ANIME_PATH:** 动漫下载保存目录,**必须是`DOWNLOAD_PATH`的下级路径**,不设置则下载到`DOWNLOAD_PATH` - **DOWNLOAD_CATEGORY:** 下载二级分类开关,`true`/`false`,默认`false`,开启后会根据配置`category.yaml`自动在下载目录下建立二级目录分类 - **DOWNLOAD_SUBTITLE:** 下载站点字幕,`true`/`false`,默认`true` - **REFRESH_MEDIASERVER:** 入库刷新媒体库,`true`/`false`,默认`true` @@ -71,6 +72,7 @@ docker pull jxxghp/moviepilot:latest - **LIBRARY_PATH:** 媒体库目录,多个目录使用`,`分隔 - **LIBRARY_MOVIE_NAME:** 电影媒体库目录名,默认`电影` - **LIBRARY_TV_NAME:** 电视剧媒体库目录名,默认`电视剧` +- **LIBRARY_ANIME_NAME:** 动漫媒体库目录名,默认`电视剧/动漫` - **LIBRARY_CATEGORY:** 媒体库二级分类开关,`true`/`false`,默认`false`,开启后会根据配置`category.yaml`自动在媒体库目录下建立二级目录分类 - **TRANSFER_TYPE:** 转移方式,支持`link`/`copy`/`move`/`softlink` **注意:在`link`和`softlink`转移方式下,转移后的文件会继承源文件的权限掩码,不受`UMASK`影响** - **COOKIECLOUD_HOST:** CookieCloud服务器地址,格式:`http://ip:port`,必须配置,否则无法添加站点 diff --git a/app/chain/download.py b/app/chain/download.py index 63bca8bd..feb2a964 100644 --- a/app/chain/download.py +++ b/app/chain/download.py @@ -113,12 +113,22 @@ class DownloadChain(ChainBase): if _media.type == MediaType.MOVIE: download_dir = Path(settings.DOWNLOAD_MOVIE_PATH or settings.DOWNLOAD_PATH) / _media.category else: - download_dir = Path(settings.DOWNLOAD_TV_PATH or settings.DOWNLOAD_PATH) / _media.category + media_genrs_ids = _media.tmdb_info.get("genre_ids") + if settings.DOWNLOAD_ANIME_PATH and media_genrs_ids and set(media_genrs_ids).intersection( + set(settings.ANIME_GENREIDS)): + download_dir = Path(settings.DOWNLOAD_ANIME_PATH) + else: + download_dir = Path(settings.DOWNLOAD_TV_PATH or settings.DOWNLOAD_PATH) / _media.category elif _media: if _media.type == MediaType.MOVIE: download_dir = Path(settings.DOWNLOAD_MOVIE_PATH or settings.DOWNLOAD_PATH) else: - download_dir = Path(settings.DOWNLOAD_TV_PATH or settings.DOWNLOAD_PATH) + media_genrs_ids = _media.tmdb_info.get("genre_ids") + if settings.DOWNLOAD_ANIME_PATH and media_genrs_ids and set(media_genrs_ids).intersection( + set(settings.ANIME_GENREIDS)): + download_dir = Path(settings.DOWNLOAD_ANIME_PATH) + else: + download_dir = Path(settings.DOWNLOAD_TV_PATH or settings.DOWNLOAD_PATH) else: download_dir = Path(settings.DOWNLOAD_PATH) else: diff --git a/app/core/config.py b/app/core/config.py index ebc01df3..9266a99f 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -123,6 +123,8 @@ class Settings(BaseSettings): DOWNLOAD_MOVIE_PATH: str = None # 电视剧下载保存目录,容器内映射路径需要一致 DOWNLOAD_TV_PATH: str = None + # 动漫下载保存目录,容器内映射路径需要一致 + DOWNLOAD_ANIME_PATH: str = None # 下载目录二级分类 DOWNLOAD_CATEGORY: bool = False # 下载站点字幕 @@ -163,8 +165,12 @@ class Settings(BaseSettings): LIBRARY_MOVIE_NAME: str = None # 电视剧媒体库目录名,默认"电视剧" LIBRARY_TV_NAME: str = None + # 动漫媒体库目录名,默认"电视剧/动漫" + LIBRARY_ANIME_NAME: str = None # 二级分类 LIBRARY_CATEGORY: bool = True + # 电视剧动漫的分类genre_ids + ANIME_GENREIDS = [16] # 电影重命名格式 MOVIE_RENAME_FORMAT: str = "{{title}}{% if year %} ({{year}}){% endif %}" \ "/{{title}}{% if year %} ({{year}}){% endif %}{% if part %}-{{part}}{% endif %}{% if videoFormat %} - {{videoFormat}}{% endif %}" \ diff --git a/app/core/context.py b/app/core/context.py index 758f3684..c5043514 100644 --- a/app/core/context.py +++ b/app/core/context.py @@ -549,14 +549,13 @@ class MediaInfo: dicts["type"] = self.type.value if self.type else None dicts["detail_link"] = self.detail_link dicts["title_year"] = self.title_year - dicts["tmdb_info"]["media_type"] = self.type.value if self.type else None + dicts["tmdb_info"] = self.tmdb_info if self.tmdb_info else None return dicts def clear(self): """ 去除多余数据,减小体积 """ - self.tmdb_info = {} self.douban_info = {} self.seasons = {} self.genres = [] diff --git a/app/core/meta/metavideo.py b/app/core/meta/metavideo.py index 0c20ebc9..3c01ea84 100644 --- a/app/core/meta/metavideo.py +++ b/app/core/meta/metavideo.py @@ -371,6 +371,8 @@ class MetaVideo(MetaBase): self.type = MediaType.TV elif token.upper() == "SEASON" and self.begin_season is None: self._last_token_type = "SEASON" + elif self.type == MediaType.TV and self.begin_season is None: + self.begin_season = 1 def __init_episode(self, token: str): re_res = re.findall(r"%s" % self._episode_re, token, re.IGNORECASE) diff --git a/app/modules/filetransfer/__init__.py b/app/modules/filetransfer/__init__.py index ab22864a..728d04d7 100644 --- a/app/modules/filetransfer/__init__.py +++ b/app/modules/filetransfer/__init__.py @@ -354,7 +354,11 @@ class FileTransferModule(_ModuleBase): target_dir = target_dir / mediainfo.type.value / mediainfo.category if mediainfo.type == MediaType.TV: - if settings.LIBRARY_TV_NAME: + media_genrs_ids = mediainfo.tmdb_info.get("genre_ids") + if settings.LIBRARY_ANIME_NAME and media_genrs_ids and set(media_genrs_ids).intersection( + set(settings.ANIME_GENREIDS)): + target_dir = target_dir / settings.LIBRARY_ANIME_NAME / mediainfo.category + elif settings.LIBRARY_TV_NAME: target_dir = target_dir / settings.LIBRARY_TV_NAME / mediainfo.category else: # 目的目录加上类型和二级分类 diff --git a/app/modules/qbittorrent/qbittorrent.py b/app/modules/qbittorrent/qbittorrent.py index 55a845c6..8f512037 100644 --- a/app/modules/qbittorrent/qbittorrent.py +++ b/app/modules/qbittorrent/qbittorrent.py @@ -219,6 +219,7 @@ class Qbittorrent(metaclass=Singleton): is_paused=is_paused, tags=tags, use_auto_torrent_management=is_auto, + is_sequential_download=True, cookie=cookie) return True if qbc_ret and str(qbc_ret).find("Ok") != -1 else False except Exception as err: diff --git a/app/schemas/context.py b/app/schemas/context.py index 7af01b17..75c5a8c1 100644 --- a/app/schemas/context.py +++ b/app/schemas/context.py @@ -146,6 +146,8 @@ class MediaInfo(BaseModel): status: Optional[str] = None # 标签 tagline: Optional[str] = None + # TMDB INFO + tmdb_info: Optional[dict] = {} # 评价数量 vote_count: Optional[int] = 0 # 流行度