From 6425dbb6fb7beae5fa6c4e1ab5adb93f79786103 Mon Sep 17 00:00:00 2001 From: thsrite Date: Thu, 3 Aug 2023 15:56:27 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix=20jellyfin=E6=97=A5=E5=BF=97url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/plugins/mediasyncdel/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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: From 4a20c56bea7a665fc2a2e800cd41743952ca4dcf Mon Sep 17 00:00:00 2001 From: thsrite Date: Thu, 3 Aug 2023 16:30:31 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat=20=E8=87=AA=E5=AE=9A=E4=B9=89=E7=94=B5?= =?UTF-8?q?=E5=BD=B1=E7=94=B5=E8=A7=86=E5=89=A7=E5=AA=92=E4=BD=93=E5=BA=93?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=90=8D=EF=BC=8C=E4=B8=8D=E5=A1=AB=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E7=94=B5=E5=BD=B1|=E7=94=B5=E8=A7=86=E5=89=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ app/core/config.py | 4 ++++ app/modules/filetransfer/__init__.py | 15 +++++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) 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 8443c395..f7895b56 100644 --- a/app/modules/filetransfer/__init__.py +++ b/app/modules/filetransfer/__init__.py @@ -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 \ From 57f29c43b06ae4e6acb199780cb3f5ec617e05b3 Mon Sep 17 00:00:00 2001 From: thsrite Date: Thu, 3 Aug 2023 16:52:21 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat=20=E8=87=AA=E5=AE=9A=E4=B9=89hosts?= =?UTF-8?q?=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/plugins/customhosts/__init__.py | 87 ++++++++++++++++++++++++++--- 1 file changed, 79 insertions(+), 8 deletions(-) diff --git a/app/plugins/customhosts/__init__.py b/app/plugins/customhosts/__init__.py index f6a351f4..1908bcc2 100644 --- a/app/plugins/customhosts/__init__.py +++ b/app/plugins/customhosts/__init__.py @@ -1,9 +1,7 @@ from typing import List, Tuple, Dict, Any -from app.core.event import eventmanager from app.log import logger from app.plugins import _PluginBase -from app.schemas.types import EventType from app.utils.ip import IpUtils from app.utils.system import SystemUtils @@ -34,16 +32,16 @@ class CustomHosts(_PluginBase): # 私有属性 _hosts = [] - _enable = False + _enabled = False def init_plugin(self, config: dict = None): # 读取配置 if config: - self._enable = config.get("enable") + self._enabled = config.get("enabled") self._hosts = config.get("hosts") if isinstance(self._hosts, str): self._hosts = str(self._hosts).split('\n') - if self._enable and self._hosts: + if self._enabled and self._hosts: # 排除空的host new_hosts = [] for host in self._hosts: @@ -53,13 +51,13 @@ class CustomHosts(_PluginBase): # 添加到系统 error_flag, error_hosts = self.__add_hosts_to_system(self._hosts) - self._enable = self._enable and not error_flag + self._enabled = self._enabled and not error_flag # 更新错误Hosts self.update_config({ "hosts": self._hosts, "err_hosts": error_hosts, - "enable": self._enable + "enabled": self._enabled }) @staticmethod @@ -70,7 +68,80 @@ class CustomHosts(_PluginBase): pass def get_form(self) -> Tuple[List[dict], Dict[str, Any]]: - pass + """ + 拼装插件配置页面,需要返回两块数据:1、页面配置;2、数据结构 + """ + return [ + { + 'component': 'VForm', + 'content': [ + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 6 + }, + 'content': [ + { + 'component': 'VSwitch', + 'props': { + 'model': 'enabled', + 'label': '启用插件', + } + } + ] + } + ] + }, + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'content': [ + { + 'component': 'VTextarea', + 'props': { + 'model': 'hosts', + 'label': '自定义hosts', + 'rows': 10, + 'placeholder': '每行一个配置,格式为:ip host1 host2 ...' + } + } + ] + } + ] + }, + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'content': [ + { + 'component': 'VTextarea', + 'props': { + 'model': 'err_hosts', + 'readonly': True, + 'label': '错误hosts', + 'rows': 2, + 'placeholder': '错误的hosts配置会展示在此处,请修改上方hosts重新提交(错误的hosts不会写入系统hosts文件)' + } + } + ] + } + ] + } + ] + } + ], { + "enabled": False, + "hosts": "", + "err_hosts": "", + } def get_page(self) -> List[dict]: pass