From 3fe4b9a31e6202b5e83890e5ea14aa119d0ea26a Mon Sep 17 00:00:00 2001 From: Audionut Date: Sat, 12 Oct 2024 17:33:17 +1000 Subject: [PATCH] Revert "ANT - prettier blu-ray details" This reverts commit 83ff01c2b915fbc00c86a9caf5c18e3647faf3e1. --- src/trackers/ANT.py | 39 ++------------------------------------- src/trackers/OE.py | 4 ++-- 2 files changed, 4 insertions(+), 39 deletions(-) diff --git a/src/trackers/ANT.py b/src/trackers/ANT.py index 71078ecb..9e06f931 100644 --- a/src/trackers/ANT.py +++ b/src/trackers/ANT.py @@ -12,7 +12,6 @@ from pathlib import Path from src.trackers.COMMON import COMMON from src.console import console -import re class ANT(): @@ -120,48 +119,14 @@ def calculate_pieces_and_file_size(total_size, pathname_bytes, piece_size): else: anon = 1 - def extract_audio_languages(bd_summary): - audio_pattern = re.compile(r'Audio: ([\w\s]+) /') - audio_languages = audio_pattern.findall(bd_summary) - return audio_languages - - def extract_subtitle_languages(bd_summary): - subtitle_pattern = re.compile(r'Subtitle: ([\w\s]+) /') - subtitle_languages = subtitle_pattern.findall(bd_summary) - return subtitle_languages - - def insert_languages_into_mediainfo(mi_dump, audio_languages, subtitle_languages): - mi_lines = mi_dump.splitlines() - - audio_index = 0 - subtitle_index = 0 - - for i, line in enumerate(mi_lines): - if "Audio" in line: - if audio_index < len(audio_languages): - mi_lines.insert(i + 1, f"Language : {audio_languages[audio_index]}") - audio_index += 1 - - elif "Text" in line: - if subtitle_index < len(subtitle_languages): - mi_lines.insert(i + 1, f"Language : {subtitle_languages[subtitle_index]}") - subtitle_index += 1 - - return "\n".join(mi_lines) - if meta['bdinfo'] is not None: - bd_summary_file = f"{meta['base_dir']}/tmp/{meta['uuid']}/BD_SUMMARY_00.txt" - bd_dump = open(bd_summary_file, 'r', encoding='utf-8').read() - audio_languages = extract_audio_languages(bd_dump) - subtitle_languages = extract_subtitle_languages(bd_dump) + bd_dump = open(f"{meta['base_dir']}/tmp/{meta['uuid']}/BD_SUMMARY_00.txt", 'r', encoding='utf-8').read() bd_dump = f'[spoiler=BDInfo][pre]{bd_dump}[/pre][/spoiler]' path = os.path.join(meta['bdinfo']['path'], 'STREAM') file_name = meta['bdinfo']['files'][0]['file'].lower() m2ts = os.path.join(path, file_name) media_info_output = str(MediaInfo.parse(m2ts, output="text", full=False)) - mi_dump_replace = media_info_output.replace('\r\n', '\n') - mi_dump_with_languages = insert_languages_into_mediainfo(mi_dump_replace, audio_languages, subtitle_languages) - mi_dump = mi_dump_with_languages + mi_dump = media_info_output.replace('\r\n', '\n') else: mi_dump = open(f"{meta['base_dir']}/tmp/{meta['uuid']}/MEDIAINFO.txt", 'r', encoding='utf-8').read() open_torrent = open(f"{meta['base_dir']}/tmp/{meta['uuid']}/[{self.tracker}]{meta['clean_name']}.torrent", 'rb') diff --git a/src/trackers/OE.py b/src/trackers/OE.py index 0f5ad62c..e536179f 100644 --- a/src/trackers/OE.py +++ b/src/trackers/OE.py @@ -228,7 +228,7 @@ def process_languages(tracks): if track.get('@type') == 'Audio': language = track.get('Language') if not language or language is None: - audio_lang = cli_ui.ask_string('No audio language present, you must enter one [English, French, Whatever]:') + audio_lang = cli_ui.ask_string('No audio language present, you must enter one:') if audio_lang: audio_languages.append(audio_lang) else: @@ -236,7 +236,7 @@ def process_languages(tracks): elif track.get('@type') == 'Text': language = track.get('Language') if not language or language is None: - subtitle_lang = cli_ui.ask_string('No subtitle language present, you must enter one [English, French, Whatever]:') + subtitle_lang = cli_ui.ask_string('No subtitle language present, you must enter one:') if subtitle_lang: subtitle_languages.append(subtitle_lang) else: