Skip to content

Commit

Permalink
Merge pull request #144 from Drazzilb08/poster_renamer-bug-fix
Browse files Browse the repository at this point in the history
[Bug] Error handling
  • Loading branch information
Drazzilb08 authored Mar 29, 2024
2 parents 9b95cf2 + 80268e5 commit 37ad717
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/poster_renamerr.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ def rename_files(matched_assets, script_config, logger):

# Check for season-related file naming
if re.search(r' - Season| - Specials', file_name):
season_number = (re.search(r"Season (\d+)", file_name).group(1) if "Season" in file_name else "00").zfill(2)
try:
season_number = (re.search(r"Season (\d+)", file_name).group(1) if "Season" in file_name else "00").zfill(2)
except AttributeError:
logger.debug(f"Error extracting season number from {file_name}")
continue
if asset_folders:
new_file_name = f"Season{season_number}{file_extension}"
else:
Expand Down

0 comments on commit 37ad717

Please sign in to comment.