From e022588ff7be2af211c1b0fc182e8b5e85864304 Mon Sep 17 00:00:00 2001 From: filipsworks <47939098+filipsworks@users.noreply.github.com> Date: Fri, 15 May 2026 11:30:23 +0200 Subject: [PATCH 1/5] eyed3 instead of musibrainz read id tags via eyed3 instead of using musicbrainz which is faultprone --- src/UltraSinger.py | 46 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/src/UltraSinger.py b/src/UltraSinger.py index 5fbf43f9..9224d627 100644 --- a/src/UltraSinger.py +++ b/src/UltraSinger.py @@ -1,6 +1,7 @@ """UltraSinger uses AI to automatically create UltraStar song files""" import copy +import eyed3 import getopt import os import sys @@ -64,7 +65,6 @@ from modules.common_print import print_support, print_help, print_version from modules.os_helper import check_file_exists, get_unused_song_output_dir from modules.plot import create_plots -from modules.musicbrainz_client import search_musicbrainz from modules.sheet import create_sheet from modules.ProcessData import ProcessData, ProcessDataPaths, MediaInfo from modules.DeviceDetection.device_detection import check_gpu_support @@ -646,6 +646,8 @@ def transcribe_audio(cache_folder_path: str, processing_audio_path: str) -> Tran def infos_from_audio_video_input_file() -> tuple[str, str, str, MediaInfo]: """Infos from audio/video input file""" + import eyed3 + basename = os.path.basename(settings.input_file_path) basename_without_ext = os.path.splitext(basename)[0] @@ -655,8 +657,30 @@ def infos_from_audio_video_input_file() -> tuple[str, str, str, MediaInfo]: else: title = basename_without_ext - song_info = search_musicbrainz(title, artist) - basename_without_ext = f"{song_info.artist} - {song_info.title}" + # Read ID3 tags from file + file_artist, file_title, year, genres, cover_image_data = None, None, None, [], None + + try: + audio_file = eyed3.load(settings.input_file_path) + if audio_file is not None and audio_file.tag is not None: + file_artist = audio_file.tag.artist or artist or "Unknown Artist" + file_title = audio_file.tag.title or title + if audio_file.tag.best_release_date: + year = audio_file.tag.best_release_date.year + if audio_file.tag.genre: + genres = [audio_file.tag.genre.name] + if audio_file.tag.images: + cover_image_data = audio_file.tag.images[0].image_data + except Exception: + file_artist = artist or "Unknown Artist" + file_title = title + + if not file_artist: + file_artist = "Unknown Artist" + if not file_title: + file_title = basename_without_ext + + basename_without_ext = f"{file_artist} - {file_title}" song_folder_output_path = os.path.join(settings.output_folder_path, basename_without_ext) song_folder_output_path = get_unused_song_output_dir(song_folder_output_path) @@ -686,20 +710,20 @@ def infos_from_audio_video_input_file() -> tuple[str, str, str, MediaInfo]: ) ultrastar_audio_input_path = os.path.join(song_folder_output_path, basename_with_ext) - # Todo: Read ID3 tags - if song_info.cover_image_data is not None: - save_image(song_info.cover_image_data, basename_without_ext, song_folder_output_path) + # Save cover image from ID3 tags + if cover_image_data is not None: + save_image(cover_image_data, basename_without_ext, song_folder_output_path) return ( basename_without_ext, song_folder_output_path, ultrastar_audio_input_path, MediaInfo( - artist=song_info.artist, - title=song_info.title, - year=song_info.year, - genre=song_info.genres, - cover_url=song_info.cover_url, + artist=file_artist, + title=file_title, + year=year, + genre=genres, + cover_url=None, audio_extension=audio_ext, video_extension=video_ext ), From 9af05978f11db1f07d956fef5137db9c58e38cab Mon Sep 17 00:00:00 2001 From: filipsworks <47939098+filipsworks@users.noreply.github.com> Date: Fri, 15 May 2026 11:31:27 +0200 Subject: [PATCH 2/5] Update dependencies in pyproject.toml Replaced 'musicbrainzngs' with 'eyed3' in dependencies. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f2eaca75..d04a285c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ dependencies = [ "demucs", "ffmpeg-python", "matplotlib", - "musicbrainzngs", + "eyed3", "python-Levenshtein", "pretty-midi", "unidecode", From 930e2ecc5952260e927b238d92dcb88bc1c2835a Mon Sep 17 00:00:00 2001 From: filipsworks <47939098+filipsworks@users.noreply.github.com> Date: Fri, 15 May 2026 11:45:56 +0200 Subject: [PATCH 3/5] Update genre assignment in UltraSinger.py Fix genre assignment to directly use genre name instead of making a list as it breaks parsing in txt converter --- src/UltraSinger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UltraSinger.py b/src/UltraSinger.py index 9224d627..1d704e36 100644 --- a/src/UltraSinger.py +++ b/src/UltraSinger.py @@ -668,7 +668,7 @@ def infos_from_audio_video_input_file() -> tuple[str, str, str, MediaInfo]: if audio_file.tag.best_release_date: year = audio_file.tag.best_release_date.year if audio_file.tag.genre: - genres = [audio_file.tag.genre.name] + genres = audio_file.tag.genre.name if audio_file.tag.images: cover_image_data = audio_file.tag.images[0].image_data except Exception: From 1f7bd33b716db3708aafef880d9092c071b19aba Mon Sep 17 00:00:00 2001 From: filipsworks <47939098+filipsworks@users.noreply.github.com> Date: Fri, 15 May 2026 11:50:26 +0200 Subject: [PATCH 4/5] Fix genre assignment to handle multiple genres Join multiple genres into a single string if available. --- src/UltraSinger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UltraSinger.py b/src/UltraSinger.py index 1d704e36..9287dea4 100644 --- a/src/UltraSinger.py +++ b/src/UltraSinger.py @@ -668,7 +668,7 @@ def infos_from_audio_video_input_file() -> tuple[str, str, str, MediaInfo]: if audio_file.tag.best_release_date: year = audio_file.tag.best_release_date.year if audio_file.tag.genre: - genres = audio_file.tag.genre.name + genres = ', '.join(genres) if genres else None if audio_file.tag.images: cover_image_data = audio_file.tag.images[0].image_data except Exception: From f8069b41b026b904483dc8821058972f703b2d99 Mon Sep 17 00:00:00 2001 From: filipsworks <47939098+filipsworks@users.noreply.github.com> Date: Fri, 15 May 2026 12:13:12 +0200 Subject: [PATCH 5/5] Refactor genre assignment in UltraSinger.py Updated genre assignment to use audio file's genre name instead of a list. --- src/UltraSinger.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/UltraSinger.py b/src/UltraSinger.py index 9287dea4..805df6fe 100644 --- a/src/UltraSinger.py +++ b/src/UltraSinger.py @@ -668,7 +668,7 @@ def infos_from_audio_video_input_file() -> tuple[str, str, str, MediaInfo]: if audio_file.tag.best_release_date: year = audio_file.tag.best_release_date.year if audio_file.tag.genre: - genres = ', '.join(genres) if genres else None + genres = audio_file.tag.genre.name if audio_file.tag.images: cover_image_data = audio_file.tag.images[0].image_data except Exception: @@ -679,6 +679,8 @@ def infos_from_audio_video_input_file() -> tuple[str, str, str, MediaInfo]: file_artist = "Unknown Artist" if not file_title: file_title = basename_without_ext + if not genres: + genres = None basename_without_ext = f"{file_artist} - {file_title}"