diff --git a/src/trackers/LT.py b/src/trackers/LT.py index 4cd5e7c94..0f1cae61c 100644 --- a/src/trackers/LT.py +++ b/src/trackers/LT.py @@ -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): @@ -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()