blastbeng / spotisub

Spotify to subsonic Playlist Generator and Importer
MIT License
105 stars 6 forks source link

Problem: ISRC is actually MBID and missing searches #77

Open gabeklavans opened 1 week ago

gabeklavans commented 1 week ago

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:

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