Recognize Specials folder as season 0 during rename
This commit is contained in:
@@ -30,6 +30,7 @@ folders:
|
|||||||
- Extras
|
- Extras
|
||||||
- Sample
|
- Sample
|
||||||
- Samples
|
- Samples
|
||||||
|
- Specials
|
||||||
- Soundtrack
|
- Soundtrack
|
||||||
- Behind the Scenes
|
- Behind the Scenes
|
||||||
- Deleted Scenes
|
- Deleted Scenes
|
||||||
@@ -79,6 +80,7 @@ files:
|
|||||||
- "*.sfv"
|
- "*.sfv"
|
||||||
- "*.part"
|
- "*.part"
|
||||||
- "*.par2"
|
- "*.par2"
|
||||||
|
- "*.website"
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# sample_videos
|
# sample_videos
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ SEASON_ONLY_PATTERN = re.compile(r'(?<![A-Za-z0-9])[Ss](\d{1,2})')
|
|||||||
|
|
||||||
SEASON_FOLDER_PATTERN = re.compile(r'season\s*0*(\d{1,3})\b', re.IGNORECASE)
|
SEASON_FOLDER_PATTERN = re.compile(r'season\s*0*(\d{1,3})\b', re.IGNORECASE)
|
||||||
SEASON_FOLDER_CANONICAL_PATTERN = re.compile(r'^[Ss](\d{1,3})$')
|
SEASON_FOLDER_CANONICAL_PATTERN = re.compile(r'^[Ss](\d{1,3})$')
|
||||||
|
SPECIALS_FOLDER_PATTERN = re.compile(r'^specials?$', re.IGNORECASE)
|
||||||
|
|
||||||
EPISODE_ONLY_PATTERN = re.compile(r'\b[Ee](?:p(?:isode)?)?\.?\s*0*(\d{1,3})\b')
|
EPISODE_ONLY_PATTERN = re.compile(r'\b[Ee](?:p(?:isode)?)?\.?\s*0*(\d{1,3})\b')
|
||||||
LEADING_NUMBER_PATTERN = re.compile(r'^0*(\d{1,3})[\s._-]')
|
LEADING_NUMBER_PATTERN = re.compile(r'^0*(\d{1,3})[\s._-]')
|
||||||
@@ -294,6 +295,8 @@ def parse_trailing_episode_number(filename):
|
|||||||
|
|
||||||
def parse_season_folder_name(name):
|
def parse_season_folder_name(name):
|
||||||
stripped = name.strip()
|
stripped = name.strip()
|
||||||
|
if SPECIALS_FOLDER_PATTERN.match(stripped):
|
||||||
|
return 0
|
||||||
m = SEASON_FOLDER_CANONICAL_PATTERN.match(stripped)
|
m = SEASON_FOLDER_CANONICAL_PATTERN.match(stripped)
|
||||||
if m:
|
if m:
|
||||||
return int(m.group(1))
|
return int(m.group(1))
|
||||||
@@ -3720,7 +3723,7 @@ def prefetch_lookups(api_key, media_type, folders):
|
|||||||
for folder in folders:
|
for folder in folders:
|
||||||
raw_name = folder.name
|
raw_name = folder.name
|
||||||
hint_year = None
|
hint_year = None
|
||||||
if extract_year(raw_name) is None:
|
if extract_year(raw_name) is None and media_type == "movie":
|
||||||
hint_year = infer_year_from_files(folder)
|
hint_year = infer_year_from_files(folder)
|
||||||
futures[executor.submit(_buffered_lookup, api_key, media_type, raw_name, hint_year)] = (folder, hint_year)
|
futures[executor.submit(_buffered_lookup, api_key, media_type, raw_name, hint_year)] = (folder, hint_year)
|
||||||
|
|
||||||
@@ -3844,7 +3847,7 @@ def run_scan(args, log):
|
|||||||
vprint(f" No year in folder name, inferred from files: {hint_year}")
|
vprint(f" No year in folder name, inferred from files: {hint_year}")
|
||||||
else:
|
else:
|
||||||
hint_year = None
|
hint_year = None
|
||||||
if extract_year(raw_name) is None:
|
if extract_year(raw_name) is None and media_type == "movie":
|
||||||
hint_year = infer_year_from_files(folder)
|
hint_year = infer_year_from_files(folder)
|
||||||
vprint(f" No year in folder name, inferred from files: {hint_year}")
|
vprint(f" No year in folder name, inferred from files: {hint_year}")
|
||||||
final_name, match_year, match_id, error = lookup_folder(api_key, media_type, raw_name, hint_year)
|
final_name, match_year, match_id, error = lookup_folder(api_key, media_type, raw_name, hint_year)
|
||||||
@@ -4067,9 +4070,6 @@ def check_show_episodes(api_key, show_folder):
|
|||||||
return missing, None
|
return missing, None
|
||||||
|
|
||||||
|
|
||||||
SPECIALS_FOLDER_PATTERN = re.compile(r'^specials?$', re.IGNORECASE)
|
|
||||||
|
|
||||||
|
|
||||||
def flatten_self_nested_folder(folder, log):
|
def flatten_self_nested_folder(folder, log):
|
||||||
try:
|
try:
|
||||||
children = [c for c in folder.iterdir() if not c.name.startswith(".")]
|
children = [c for c in folder.iterdir() if not c.name.startswith(".")]
|
||||||
|
|||||||
Reference in New Issue
Block a user