From 8dc429069544f8449dd4fca4aa7226b1f2e7bcb2 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Mon, 25 Nov 2024 07:58:17 +0800 Subject: [PATCH] fix scrape bug --- app/chain/media.py | 8 +------- app/helper/torrent.py | 2 +- app/modules/themoviedb/scraper.py | 1 + 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/chain/media.py b/app/chain/media.py index f800f2a4..53a19e92 100644 --- a/app/chain/media.py +++ b/app/chain/media.py @@ -370,11 +370,7 @@ class MediaChain(ChainBase, metaclass=Singleton): tmp_file.write_bytes(_content) # 获取文件的父目录 try: - parent_item = self.storagechain.get_parent_item(_fileitem) - if not parent_item: - logger.warn(f"无法获取 {_fileitem.path} 的上级目录!") - return - item = self.storagechain.upload_file(fileitem=parent_item, path=tmp_file, new_name=_path.name) + item = self.storagechain.upload_file(fileitem=_fileitem, path=tmp_file, new_name=_path.name) if item: logger.info(f"已保存文件:{item.path}") else: @@ -425,8 +421,6 @@ class MediaChain(ChainBase, metaclass=Singleton): logger.warn(f"{filepath.name} nfo文件生成失败!") return # 保存或上传nfo文件到上级目录 - if not parent: - parent = self.storagechain.get_parent_item(fileitem) __save_file(_fileitem=parent, _path=nfo_path, _content=movie_nfo) else: # 电影目录 diff --git a/app/helper/torrent.py b/app/helper/torrent.py index 313471d7..03800430 100644 --- a/app/helper/torrent.py +++ b/app/helper/torrent.py @@ -290,7 +290,7 @@ class TorrentHelper(metaclass=Singleton): if not file_path.suffix or file_path.suffix.lower() not in settings.RMT_MEDIAEXT: continue # 只使用文件名识别 - meta = MetaInfo(file_path.stem) + meta = MetaInfo(file_path.name) if not meta.begin_episode: continue episodes = list(set(episodes).union(set(meta.episode_list))) diff --git a/app/modules/themoviedb/scraper.py b/app/modules/themoviedb/scraper.py index 46733a81..4c07b1a0 100644 --- a/app/modules/themoviedb/scraper.py +++ b/app/modules/themoviedb/scraper.py @@ -104,6 +104,7 @@ class TmdbScraper: url = f"https://{settings.TMDB_IMAGE_DOMAIN}/t/p/original{seasoninfo.get('poster_path')}" image_name = f"season{sea_seq}-poster{ext}" return image_name, url + return "", "" @staticmethod def __get_episode_detail(seasoninfo: dict, episode: int) -> dict: