Skip to content

Commit

Permalink
Add zeros at filename for better sorting #33
Browse files Browse the repository at this point in the history
  • Loading branch information
Tmaster055 committed Jan 6, 2025
1 parent 3c6d41c commit 54111d0
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/aniworld/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,22 @@ def get_language_from_key(key: int) -> str:
return language

output_directory = os.getenv("OUTPUT_DIRECTORY") or params['output_directory']
seasons = params['season_number']
episodes = params['episode_number']
if seasons:
if seasons < 10:
seasons = "00" + str(seasons)
elif 10 <= seasons < 100:
seasons = "0" + str(seasons)
if episodes < 10:
episodes = "00" + str(episodes)
elif 10 <= episodes < 100:
episodes = "0" + str(episodes)

file_name = (
f"{sanitize_anime_title} - S{params['season_number']}E{params['episode_number']}"
f"{sanitize_anime_title} - S{seasons}E{episodes}"
if params['season_number']
else f"{sanitize_anime_title} - Movie {params['episode_number']}"
else f"{sanitize_anime_title} - Movie {episodes}"
)

file_path = os.path.join(
Expand Down

0 comments on commit 54111d0

Please sign in to comment.