diff --git a/app/chain/transfer.py b/app/chain/transfer.py index c26f90c6..846e13ec 100644 --- a/app/chain/transfer.py +++ b/app/chain/transfer.py @@ -389,14 +389,13 @@ class TransferChain(ChainBase): download_hash = download_file.download_hash # 查询整理目标目录 - if not target_directory: - if target_path: - target_directory = self.directoryhelper.get_dir(file_mediainfo, - storage=target_storage, dest_path=target_path) - elif src_match: + if not target_directory and not target_path: + if src_match: + # 按源目录匹配,以便找到更合适的目录配置 target_directory = self.directoryhelper.get_dir(file_mediainfo, storage=file_item.storage, src_path=file_path) else: + # 未指定目标路径,根据媒体信息获取目标目录 target_directory = self.directoryhelper.get_dir(file_mediainfo) # 执行整理 diff --git a/app/core/meta/metavideo.py b/app/core/meta/metavideo.py index bd992c79..090a99a4 100644 --- a/app/core/meta/metavideo.py +++ b/app/core/meta/metavideo.py @@ -524,16 +524,7 @@ class MetaVideo(MetaBase): """ if not self.name: return - source_res = re.search(r"(%s)" % self._source_re, token, re.IGNORECASE) - if source_res: - self._last_token_type = "source" - self._continue_flag = False - self._stop_name_flag = True - if not self._source: - self._source = source_res.group(1) - self._last_token = self._source.upper() - return - elif token.upper() == "DL" \ + if token.upper() == "DL" \ and self._last_token_type == "source" \ and self._last_token == "WEB": self._source = "WEB-DL" @@ -553,7 +544,7 @@ class MetaVideo(MetaBase): self._source = "WEB-DL" self._continue_flag = False return - # UHD REMUX组合 + # UHD REMUX组合 if token.upper() == "REMUX" \ and self._source == "BluRay": self._source = "BluRay REMUX" @@ -562,7 +553,17 @@ class MetaVideo(MetaBase): elif token.upper() == "BLURAY" \ and self._source == "UHD": self._source = "UHD BluRay" - + self._continue_flag = False + return + source_res = re.search(r"(%s)" % self._source_re, token, re.IGNORECASE) + if source_res: + self._last_token_type = "source" + self._continue_flag = False + self._stop_name_flag = True + if not self._source: + self._source = source_res.group(1) + self._last_token = self._source.upper() + return effect_res = re.search(r"(%s)" % self._effect_re, token, re.IGNORECASE) if effect_res: self._last_token_type = "effect" diff --git a/app/modules/filemanager/storages/alist.py b/app/modules/filemanager/storages/alist.py index 5d937e9f..12563a73 100644 --- a/app/modules/filemanager/storages/alist.py +++ b/app/modules/filemanager/storages/alist.py @@ -213,7 +213,7 @@ class Alist(StorageBase): path=(Path(fileitem.path) / item["name"]).as_posix() + ("/" if item["is_dir"] else ""), name=item["name"], basename=Path(item["name"]).stem, - extension=Path(item["name"]).suffix if not item["is_dir"] else None, + extension=Path(item["name"]).suffix[1:] if not item["is_dir"] else None, size=item["size"] if not item["is_dir"] else None, modify_time=self.__parse_timestamp(item["modified"]), thumbnail=item["thumb"], @@ -351,7 +351,7 @@ class Alist(StorageBase): path=path.as_posix() + ("/" if result["data"]["is_dir"] else ""), name=result["data"]["name"], basename=Path(result["data"]["name"]).stem, - extension=Path(result["data"]["name"]).suffix, + extension=Path(result["data"]["name"]).suffix[1:], size=result["data"]["size"], modify_time=self.__parse_timestamp(result["data"]["modified"]), thumbnail=result["data"]["thumb"], @@ -521,13 +521,15 @@ class Alist(StorageBase): ).get_res(download_url) if not path: - path = settings.TEMP_PATH / fileitem.name + new_path = settings.TEMP_PATH / fileitem.name + else: + new_path = path / fileitem.name - with open(path, "wb") as f: + with open(new_path, "wb") as f: f.write(resp.content) - if path.exists(): - return path + if new_path.exists(): + return new_path return None def upload( diff --git a/app/modules/filemanager/storages/u115.py b/app/modules/filemanager/storages/u115.py index f86eb516..0b87008f 100644 --- a/app/modules/filemanager/storages/u115.py +++ b/app/modules/filemanager/storages/u115.py @@ -21,7 +21,8 @@ class U115Pan(StorageBase, metaclass=Singleton): # 支持的整理方式 transtype = { - "move": "移动" + "move": "移动", + "copy": "复制" } client: P115Client = None @@ -34,7 +35,8 @@ class U115Pan(StorageBase, metaclass=Singleton): """ try: if not self.client or not self.client.cookies or force: - self.client = P115Client(self.__credential) + self.client = P115Client(self.__credential, + check_for_relogin=True, app="alipaymini", console_qrcode=False) self.fs = P115FileSystem(self.client) except Exception as err: logger.error(f"115连接失败,请重新扫码登录:{str(err)}") diff --git a/tests/cases/meta.py b/tests/cases/meta.py index fbfb1cf1..be51a4ce 100644 --- a/tests/cases/meta.py +++ b/tests/cases/meta.py @@ -345,13 +345,13 @@ meta_cases = [{ "part": "", "season": "", "episode": "", - "restype": "BluRay Remux", + "restype": "BluRay REMUX", "pix": "1080p", "video_codec": "AVC", "audio_codec": "LPCM 7³" } }, { - "title": "30.Rock.S02E01.1080p.BluRay.X264-BORDURE.mkv", + "title": "30.Rock.S02E01.1080p.UHD.BluRay.X264-BORDURE.mkv", "subtitle": "", "target": { "type": "电视剧", @@ -361,7 +361,7 @@ meta_cases = [{ "part": "", "season": "S02", "episode": "E01", - "restype": "BluRay", + "restype": "UHD BluRay", "pix": "1080p", "video_codec": "X264", "audio_codec": "" @@ -611,7 +611,7 @@ meta_cases = [{ "subtitle": "", "target": { "type": "电视剧", - "cn_name": "处刑少女的生存之道", + "cn_name": "處刑少女的生存之道", "en_name": "", "year": "", "part": "", @@ -665,7 +665,7 @@ meta_cases = [{ "part": "", "season": "", "episode": "", - "restype": "BluRay DoVi UHD", + "restype": "UHD BluRay DoVi", "pix": "1080p", "video_codec": "X265", "audio_codec": "DD 7.1" diff --git a/version.py b/version.py index b337ead1..9915ef69 100644 --- a/version.py +++ b/version.py @@ -1,2 +1,2 @@ -APP_VERSION = 'v2.0.6' -FRONTEND_VERSION = 'v2.0.6' +APP_VERSION = 'v2.0.7' +FRONTEND_VERSION = 'v2.0.7'