diff --git a/info.yaml b/info.yaml index 76e2847..8d6c3b9 100644 --- a/info.yaml +++ b/info.yaml @@ -1,5 +1,5 @@ title: "애니 다운로더" -version: "0.4.9" +version: "0.4.10" package_name: "anime_downloader" developer: "projectdx" description: "anime downloader" diff --git a/mod_anilife.py b/mod_anilife.py index 2f8378a..b16045e 100644 --- a/mod_anilife.py +++ b/mod_anilife.py @@ -1285,6 +1285,8 @@ class LogicAniLife(AnimeModuleBase): if not title: return None + logger.debug(f"[EarlyCheck] Input title: {title}") + # Parse title pattern: "제목 N기 M화" or "제목 M화" match = re.compile( r"(?P.*?)\s*((?P<season>\d+)기)?\s*((?P<epi_no>\d+)화)" @@ -1295,49 +1297,60 @@ class LogicAniLife(AnimeModuleBase): season = int(match.group("season")) if match.group("season") else 1 epi_no = int(match.group("epi_no")) + # Sanitize title part only (not the glob pattern) + content_title_clean = AniUtil.change_text_for_use_filename(content_title) + # Use glob pattern for quality: *-AL.mp4 matches any quality filename_pattern = "%s.S%sE%s.*-AL.mp4" % ( - content_title, + content_title_clean, "0%s" % season if season < 10 else season, "0%s" % epi_no if epi_no < 10 else epi_no, ) + logger.debug(f"[EarlyCheck] Parsed: title='{content_title_clean}', S{season}E{epi_no}") else: # Fallback pattern for non-standard titles - filename_pattern = "%s.*-AL.mp4" % title - - # Sanitize pattern (but keep glob wildcards) - filename_pattern = AniUtil.change_text_for_use_filename(filename_pattern) + title_clean = AniUtil.change_text_for_use_filename(title) + filename_pattern = "%s.*-AL.mp4" % title_clean + logger.debug(f"[EarlyCheck] No match, fallback pattern") # Get save path savepath = P.ModelSetting.get("anilife_download_path") if not savepath: + logger.debug(f"[EarlyCheck] No savepath configured") return None # Check auto folder option if P.ModelSetting.get_bool("anilife_auto_make_folder"): day = episode_info.get("day", "") if "완결" in day: - folder_name = "%s %s" % (content_title if match else title, "완결") + folder_name = "%s %s" % (content_title_clean if match else AniUtil.change_text_for_use_filename(title), "완결") else: - folder_name = content_title if match else title - folder_name = AniUtil.change_text_for_use_filename(folder_name) + folder_name = content_title_clean if match else AniUtil.change_text_for_use_filename(title) savepath = os.path.join(savepath, folder_name) # Use glob to find any matching file full_pattern = os.path.join(savepath, filename_pattern) + logger.info(f"[EarlyCheck] Glob pattern: {full_pattern}") + matching_files = glob.glob(full_pattern) + logger.info(f"[EarlyCheck] Matching files: {matching_files}") if matching_files: # Return first matching file - logger.debug(f"Found existing file: {matching_files[0]}") + logger.info(f"[EarlyCheck] Found existing file: {matching_files[0]}") return matching_files[0] + + logger.debug(f"[EarlyCheck] No matching file found") return None except Exception as e: - logger.debug(f"_predict_filepath error: {e}") + logger.error(f"[EarlyCheck] _predict_filepath error: {e}") + import traceback + logger.error(traceback.format_exc()) return None + def is_exist(self, info): for e in self.queue.entity_list: if e.info["_id"] == info["_id"]: