diff --git a/src/trackers/HUNO.py b/src/trackers/HUNO.py index 623ed3f7..aa8b0b97 100644 --- a/src/trackers/HUNO.py +++ b/src/trackers/HUNO.py @@ -114,22 +114,23 @@ def get_audio(self, meta): if dual: language = "DUAL" else: - # Read the MEDIAINFO.txt file - media_info_path = f"{meta['base_dir']}/tmp/{meta['uuid']}/MEDIAINFO.txt" - with open(media_info_path, 'r', encoding='utf-8') as f: - media_info_text = f.read() - - # Extract the first audio section - first_audio_section = re.search(r'Audio\s+ID\s+:\s+2(.*?)\n\n', media_info_text, re.DOTALL) - if not first_audio_section: # Fallback in case of a different structure - first_audio_section = re.search(r'Audio(.*?)Text', media_info_text, re.DOTALL) - - if first_audio_section: - # Extract language information from the first audio track - language_match = re.search(r'Language\s*:\s*(.+)', first_audio_section.group(1)) - if language_match: - language = language_match.group(1).strip() - language = re.sub(r'\(.+\)', '', language) # Remove text in parentheses + if not meta['is_disc']: + # Read the MEDIAINFO.txt file + media_info_path = f"{meta['base_dir']}/tmp/{meta['uuid']}/MEDIAINFO.txt" + with open(media_info_path, 'r', encoding='utf-8') as f: + media_info_text = f.read() + + # Extract the first audio section + first_audio_section = re.search(r'Audio\s+ID\s+:\s+2(.*?)\n\n', media_info_text, re.DOTALL) + if not first_audio_section: # Fallback in case of a different structure + first_audio_section = re.search(r'Audio(.*?)Text', media_info_text, re.DOTALL) + + if first_audio_section: + # Extract language information from the first audio track + language_match = re.search(r'Language\s*:\s*(.+)', first_audio_section.group(1)) + if language_match: + language = language_match.group(1).strip() + language = re.sub(r'\(.+\)', '', language) # Remove text in parentheses # Handle special cases if language == "zxx": @@ -235,7 +236,7 @@ async def get_cat_id(self, category_name): async def get_type_id(self, meta): type = meta['type'] - video_encode = meta['video_encode'] + video_encode = meta.get('video_encode') if type == 'REMUX': return '2'