diff --git a/README.md b/README.md index d598b0b8..8665d47a 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,8 @@ docker pull jxxghp/moviepilot:latest - **DOWNLOAD_CATEGORY:** 下载二级分类开关,`true`/`false`,默认`false`,开启后会根据配置`category.yaml`自动在下载目录下建立二级目录分类 - **TORRENT_TAG:** 种子标签,默认为`MOVIEPILOT`,设置后只有MoviePilot添加的下载才会处理,留空所有下载器中的任务均会处理 - **LIBRARY_PATH:** 媒体库目录,多个目录使用`,`分隔 +- **LIBRARY_MOVIE_NAME:** 电影媒体库目录名,默认`电影` +- **LIBRARY_TV_NAME:** 电视剧媒体库目录名,默认`电影剧` - **LIBRARY_CATEGORY:** 媒体库二级分类开关,`true`/`false`,默认`false`,开启后会根据配置`category.yaml`自动在媒体库目录下建立二级目录分类 - **TRANSFER_TYPE:** 转移方式,支持`link`/`copy`/`move`/`softlink` - **COOKIECLOUD_HOST:** CookieCloud服务器地址,格式:`http://ip:port`,必须配置,否则无法添加站点 diff --git a/app/core/config.py b/app/core/config.py index d53f0f0a..716523b2 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -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 # 电影重命名格式 diff --git a/app/modules/filetransfer/__init__.py b/app/modules/filetransfer/__init__.py index 1be36df1..276a988c 100644 --- a/app/modules/filetransfer/__init__.py +++ b/app/modules/filetransfer/__init__.py @@ -351,8 +351,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 \ diff --git a/app/plugins/customhosts/__init__.py b/app/plugins/customhosts/__init__.py index 807c3eb4..cc314945 100644 --- a/app/plugins/customhosts/__init__.py +++ b/app/plugins/customhosts/__init__.py @@ -1,7 +1,6 @@ from typing import List, Tuple, Dict, Any from python_hosts import Hosts, HostsEntry - from app.log import logger from app.plugins import _PluginBase from app.utils.ip import IpUtils @@ -57,7 +56,7 @@ class CustomHosts(_PluginBase): self.update_config({ "hosts": self._hosts, "err_hosts": error_hosts, - "enable": self._enabled + "enabled": self._enabled }) def get_state(self) -> bool: @@ -71,6 +70,9 @@ class CustomHosts(_PluginBase): pass def get_form(self) -> Tuple[List[dict], Dict[str, Any]]: + """ + 拼装插件配置页面,需要返回两块数据:1、页面配置;2、数据结构 + """ return [ { 'component': 'VForm', @@ -109,7 +111,9 @@ class CustomHosts(_PluginBase): 'component': 'VTextarea', 'props': { 'model': 'hosts', - 'label': '系统hosts' + 'label': '自定义hosts', + 'rows': 10, + 'placeholder': '每行一个配置,格式为:ip host1 host2 ...' } } ] @@ -130,7 +134,9 @@ class CustomHosts(_PluginBase): 'props': { 'model': 'err_hosts', 'readonly': True, - 'label': '错误记录' + 'label': '错误hosts', + 'rows': 2, + 'placeholder': '错误的hosts配置会展示在此处,请修改上方hosts重新提交(错误的hosts不会写入系统hosts文件)' } } ] diff --git a/app/plugins/mediasyncdel/__init__.py b/app/plugins/mediasyncdel/__init__.py index 1a0195c3..60f1625d 100644 --- a/app/plugins/mediasyncdel/__init__.py +++ b/app/plugins/mediasyncdel/__init__.py @@ -562,7 +562,8 @@ class MediaSyncDel(_PluginBase): jellyfin_host = "http://" + jellyfin_host # jellyfin 日志url - log_url = "%sSystem/Logs/jellyfinserver.txt?api_key=%s" % (jellyfin_host, settings.JELLYFIN_API_KEY) + log_url = "%sSystem/Logs/Log?name=log_%s.log&api_key=%s" % ( + jellyfin_host, datetime.date.today().strftime("%Y%m%d"), settings.JELLYFIN_API_KEY) log_res = RequestUtils().get_res(url=log_url) if not log_res or log_res.status_code != 200: