Skip to content

Commit

Permalink
Merge branch 'pr/166' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
Audionut committed Dec 6, 2024
2 parents 02ef905 + 0eeb38b commit ef2ca61
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions src/trackers/LT.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,30 @@ async def get_res_id(self, resolution):
return resolution_id

async def edit_name(self, meta):
lt_name = meta['name'].replace('Dubbed', '').replace('Dual-Audio', '').replace(' ', ' ').strip()
# Check if audio Spanish exists, if not append [SUBS] at the end
lt_name = meta['name'].replace('Dual-Audio', '').replace('Dubbed', '').replace(' ', ' ').strip()
if meta['type'] != 'DISC': # DISC don't have mediainfo
audio_language_list = meta['mediainfo']['media']['track'][0].get('Audio_Language_List', '')
if 'Spanish' not in audio_language_list and '[SUBS]' not in lt_name:
if not meta['tag']:
lt_name += " [SUBS]"
# Check if is HYBRID (Copied from BLU.py)
if 'hybrid' in meta.get('uuid').lower():
if "repack" in meta.get('uuid').lower():
lt_name = lt_name.replace('REPACK', 'Hybrid REPACK')
else:
lt_name = lt_name.replace(meta['tag'], f" [SUBS]{meta['tag']}")
lt_name = lt_name.replace(meta['resolution'], f"Hybrid {meta['resolution']}")
# Check if audio Spanish exists
# Get all the audios 'es-419' or 'es'
audios = [
audio for audio in meta['mediainfo']['media']['track'][2:]
if audio.get('@type') == 'Audio'
and audio.get('Language') in {'es-419', 'es'}
and "commentary" not in audio.get('Title').lower()
]
if len(audios) > 0: # If there is at least 1 audio spanish
lt_name = lt_name
# if not audio Spanish exists, add "[SUBS]"
elif not meta.get('tag'):
lt_name = lt_name + " [SUBS]"
else:
lt_name = lt_name.replace(meta['tag'], f" [SUBS]{meta['tag']}")

return lt_name

async def upload(self, meta, disctype):
Expand All @@ -103,7 +118,6 @@ async def upload(self, meta, disctype):
anon = 0
else:
anon = 1

if meta['bdinfo'] is not None:
mi_dump = None
bd_dump = open(f"{meta['base_dir']}/tmp/{meta['uuid']}/BD_SUMMARY_00.txt", 'r', encoding='utf-8').read()
Expand Down

0 comments on commit ef2ca61

Please sign in to comment.