Samik081 / beets-beatport4

Beatport API v4 compatible beets plugin
MIT License
26 stars 2 forks source link

Error when importing with specific release ID #6

Closed JOJ0 closed 1 year ago

JOJ0 commented 1 year ago

When passing an ID via the -S option of the beets importer (in that case I'm meaning a Discogs release ID) beatport4 doesn't seem to like it:

$ beet -P fromfilename import -S 75310 "/remote/data/music-archive/DrumnbassJungleDrumfunk/0-Single-Tracks/60 Minute Man/60 minute man - the only one.mp3"
Traceback (most recent call last):
  File "/home/jojo/.pyenv/versions/beets/bin/beet", line 33, in <module>
    sys.exit(load_entry_point('beets', 'console_scripts', 'beet')())
  File "/home/jojo/git/beets/beets/ui/__init__.py", line 1304, in main
    _raw_main(args)
  File "/home/jojo/git/beets/beets/ui/__init__.py", line 1291, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/home/jojo/git/beets/beets/ui/commands.py", line 1034, in import_func
    import_files(lib, paths, query)
  File "/home/jojo/git/beets/beets/ui/commands.py", line 974, in import_files
    session.run()
  File "/home/jojo/git/beets/beets/importer.py", line 340, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/home/jojo/git/beets/beets/util/pipeline.py", line 446, in run_parallel
    raise exc_info[1].with_traceback(exc_info[2])
  File "/home/jojo/git/beets/beets/util/pipeline.py", line 311, in run
    out = self.coro.send(msg)
  File "/home/jojo/git/beets/beets/util/pipeline.py", line 193, in coro
    func(*(args + (task,)))
  File "/home/jojo/git/beets/beets/importer.py", line 1408, in lookup_candidates
    task.lookup_candidates()
  File "/home/jojo/git/beets/beets/importer.py", line 661, in lookup_candidates
    autotag.tag_album(self.items, search_ids=self.search_ids)
  File "/home/jojo/git/beets/beets/autotag/match.py", line 422, in tag_album
    for id_candidate in hooks.albums_for_id(search_id):
  File "/home/jojo/git/beets/beets/autotag/hooks.py", line 584, in albums_for_id
    for a in plugins.album_for_id(album_id):
  File "/home/jojo/git/beets/beets/plugins.py", line 399, in album_for_id
    album = plugin.album_for_id(album_id)
  File "/home/jojo/git/beets-beatport4/beetsplug/beatport4.py", line 550, in album_for_id
    release = self.client.get_release(match.group(2))
  File "/home/jojo/git/beets-beatport4/beetsplug/beatport4.py", line 351, in get_release
    response = self._get(f'/catalog/releases/{beatport_id}/')
  File "/home/jojo/git/beets-beatport4/beetsplug/beatport4.py", line 409, in _get
    raise BeatportAPIError(
beetsplug.beatport4.BeatportAPIError: Error 404 for '/v4/catalog/releases/75310/

Disabling beatport4 for that import works around the problem:

$ beet -P beatport4,fromfilename import -S 75310 "/remote/data/music-archive/DrumnbassJungleDrumfunk/0-Single-Tracks/60 Minute Man/60 minute man - the only one.mp3"

/remote/data/music-archive/DrumnbassJungleDrumfunk/0-Single-Tracks/60 Minute Man/60 minute man - the only one.mp3 (1 items)
Correcting tags from:
    (unknown album)
To:
    60 Minute Man & DJ Touch - Give It Up E.P
URL:
    https://www.discogs.com/release/75310-60-Minute-Man-DJ-Touch-Give-It-Up-EP
...
...
...
Samik081 commented 1 year ago

Thank you for spotting another one! ❤️ Fixed in https://github.com/Samik081/beets-beatport4/commit/3e1558e61dd584d74316a90e8945d07a4a2cef31 v0.2.8