Skip to content

Commit

Permalink
Check if title string is present before applying lower
Browse files Browse the repository at this point in the history
  • Loading branch information
Audionut committed Oct 12, 2024
1 parent 6801e2a commit 4da0184
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -1910,7 +1910,7 @@ def get_audio_v2(self, mi, meta, bdinfo):
for i, t in enumerate(tracks):
if t.get('@type') != "Audio":
continue
if t.get('Language', '') == meta.get('original_language', '') and "commentary" not in t.get('Title', '').lower():
if t.get('Language', '') == meta.get('original_language', '') and "commentary" not in (t.get('Title') or '').lower():
track_num = i
break

Expand Down Expand Up @@ -1962,11 +1962,11 @@ def get_audio_v2(self, mi, meta, bdinfo):
audio_language = t.get('Language', '')

# Check for English Language Track
if audio_language.startswith("en") and "commentary" not in t.get('Title', '').lower():
if audio_language.startswith("en") and "commentary" not in (t.get('Title') or '').lower():
eng = True

# Check for original Language Track
if not audio_language.startswith("en") and audio_language.startswith(meta['original_language']) and "commentary" not in t.get('Title', '').lower():
if not audio_language.startswith("en") and audio_language.startswith(meta['original_language']) and "commentary" not in (t.get('Title') or '').lower():
orig = True

# Catch Chinese / Norwegian Variants
Expand All @@ -1993,7 +1993,7 @@ def get_audio_v2(self, mi, meta, bdinfo):
if t.get('@type') != "Audio":
continue

if "commentary" in t.get('Title', '').lower():
if "commentary" in (t.get('Title') or '').lower():
has_commentary = True

# Convert commercial name to naming conventions
Expand Down

0 comments on commit 4da0184

Please sign in to comment.