Allow season zero for auto-downloads
This commit is contained in:
+8
-5
@@ -961,12 +961,14 @@ def sanitize_path_component(value, fallback="Anime"):
|
||||
|
||||
|
||||
def normalize_season(value):
|
||||
text = str(value or "1").strip()
|
||||
text = "1" if value is None else str(value).strip()
|
||||
if not text:
|
||||
text = "1"
|
||||
if not re.match(r"^[0-9]+$", text):
|
||||
raise ValueError("Season must be a positive number")
|
||||
raise ValueError("Season must be a non-negative number")
|
||||
number = int(text, 10)
|
||||
if number < 1:
|
||||
raise ValueError("Season must be a positive number")
|
||||
if number < 0:
|
||||
raise ValueError("Season must be a non-negative number")
|
||||
return str(number)
|
||||
|
||||
|
||||
@@ -1001,7 +1003,8 @@ def job_staging_dir(job):
|
||||
|
||||
|
||||
def season_label(job):
|
||||
return f"{int(job.get('season') or 1):02d}"
|
||||
season = normalize_season(job.get("season"))
|
||||
return f"{int(season):02d}"
|
||||
|
||||
|
||||
def episode_label(value):
|
||||
|
||||
Reference in New Issue
Block a user