Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: ISRC is actually MBID and missing searches #77

Open
gabeklavans opened this issue Nov 12, 2024 · 0 comments
Open

Problem: ISRC is actually MBID and missing searches #77

gabeklavans opened this issue Nov 12, 2024 · 0 comments

Comments

@gabeklavans
Copy link

The README claims that the ISRC is used first to match songs. Indeed, I see in the code for this repo the function is get_isrc_by_id. However, from looking at logs and at the source code, there are two problems:

  • The first step in match_with_subsonic_track is not to search my subsonic library for the ISRC of the Spotify track. It's actually to do a text search in my subsonic library for artist / track, then compare ISRCs of those results. This seems to yield a lot of missed tracks for my library, I'm guessing because the subsonic text search is just kinda bad.
  • You're actually using the MBID of the song to match, not the ISRC. I could tell pretty clearly by printing the song object in the logs:
spotisub  | 2024-11-12 06:00:37 INFO     {'id': 'tr-2941', 'album': 'Over the Garden Wall (Original Television Soundtrack)', 'artist': 'T
he Blasting Company', 'artists': [{'id': 'ar-230', 'name': 'The Blasting Company'}], 'displayArtist': '', 'albumArtists': None, 'displayA
lbumArtist': '', 'bitRate': 1299, 'contentType': 'audio/flac', 'coverArt': 'al-690', 'created': '2024-08-22T17:16:24.81479545Z', 'duratio
n': 83, 'isDir': False, 'isVideo': False, 'parent': 'al-690', 'path': 'The Petrojvic Blasting Company/Over the Garden Wall (Original Tele
vision Soundtrack)/28. The Old Mill.flac', 'size': 13654855, 'suffix': 'flac', 'title': 'The Old Mill', 'track': 28, 'discNumber': 1, 'ty
pe': 'music', 'year': 2016, 'musicBrainzId': '9610a5ed-2c78-465d-b44b-8327f2c0207e'}

The value for musicBrainzId (as the README for this repo mentions) is in the MBID format, not the ISRC format (which is CCOOOYYSSSSS). Additionally, you use the musicbrainzngs.get_recording_by_id from the musicbrainzngs library, which searches by MBID. There is a different function for retrieving based on ISRC, called musicbrainzngs.get_recordings_by_isrc.

For me specifically, I'm not getting any matches for my entire library, but I think that's because I'm hitting a rate limit:

spotisub  | Traceback (most recent call last):
spotisub  |   File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
spotisub  |     self.run()
spotisub  |   File "/usr/local/lib/python3.10/threading.py", line 953, in run
spotisub  |     self._target(*self._args, **self._kwargs)
spotisub  |   File "/home/user/spotisub/spotisub/generator.py", line 743, in <lambda>
spotisub  |     target=lambda: reimport_all_thread(),
spotisub  |   File "/home/user/spotisub/spotisub/generator.py", line 751, in reimport_all_thread
spotisub  |     import_all_my_recommendations()
spotisub  |   File "/home/user/spotisub/spotisub/generator.py", line 767, in import_all_my_recommendations
spotisub  |     my_recommendations_run(playlist_info.uuid)
spotisub  |   File "/home/user/spotisub/spotisub/generator.py", line 374, in my_recommendations_run
spotisub  |     results = sp.recommendations(seed_tracks=seed_track_ids[0:5], limit=int(os.environ.get(
spotisub  |   File "/home/user/.local/lib/python3.10/site-packages/spotipy/client.py", line 1728, in recommendations
spotisub  |     return self._get("recommendations", **params)
spotisub  |   File "/home/user/.local/lib/python3.10/site-packages/spotipy/client.py", line 327, in _get
spotisub  |     return self._internal_call("GET", url, payload, kwargs)
spotisub  |   File "/home/user/.local/lib/python3.10/site-packages/spotipy/client.py", line 297, in _internal_call
spotisub  |     raise SpotifyException(
spotisub  | spotipy.exceptions.SpotifyException: http status: 400, code:-1 - https://api.spotify.com/v1/recommendations?limit=1000&seed_t
racks=12usPU2WnqgCHAW1EK2dfd%2C1BCufLrvRpgnyFkmujLAzA%2C5tXOuIoDO0ZtGLijEOD6HZ%2C3EEiCf8qXklctn4OoG11Mb%2C5zaiAW0kRj8AgdgV19nxxR:
spotisub  |  invalid request, reason: None

But I'm also seeing logs like this, where it tries to compare MBID (named ISRC in the code for now) with a random song or a few in my library that it got from the subsonic text search then giving up (this song IS in my subsonic library so the comparison should have succeed):

spotisub  | 2024-11-12 06:00:53 INFO     (139626862103040) Searching KANA-BOON - ないものねだり - Revenge THE FIRST TAKE in your music library
spotisub  | 2024-11-12 06:00:53 INFO     subsonic song obj:
spotisub  | 2024-11-12 06:00:53 INFO     {'id': 'tr-2860', 'album': 'J-Rock', 'artist': 'Gnilp Lasso', 'artists': [{'id': 'ar-196', 'name': 'Gnilp Lasso'}], 'displayArtist':>
ated': '2024-08-22T17:16:24.254469708Z', 'duration': 243, 'isDir': False, 'isVideo': False, 'parent': 'al-620', 'path': 'Gnilp Lasso/J-Rock/7. Haruka Kanata.m4a', 'size': 90>
': 2002, 'musicBrainzId': '832e984d-f446-4044-8d0f-ca0bd6e07351'}
spotisub  | 2024-11-12 06:00:54 INFO     musicbrainz obj:
spotisub  | 2024-11-12 06:00:54 INFO     {'recording': {'id': '832e984d-f446-4044-8d0f-ca0bd6e07351', 'title': 'Haruka Kanata', 'length': '240000'}}
spotisub  | 2024-11-12 06:00:54 INFO     (139626862103040) Comparing song "Gnilp Lasso - Haruka Kanata - J-Rock" with Spotify track "KANA-BOON - ないものねだり - Revenge THE>
spotisub  | 2024-11-12 06:00:54 WARNING  (139626862103040) Track KANA-BOON - ないものねだり - Revenge THE FIRST TAKE not found in your music library
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant