beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.91k stars 1.82k forks source link

beatport plugin failing #3374

Closed wualex closed 5 years ago

wualex commented 5 years ago

Hi,

Trying to test the fix made by @temrix on the beatport plugin but i get errors on any file

Running this command in verbose (-vv) mode:

$ beet -vv import /mnt/d/test/

Led to this problem:

user configuration: /root/.config/beets/config.yaml
data directory: /root/.config/beets
plugin paths:
Sending event: pluginload
library database: /mnt/d/Music/musiclibrary.db
library directory: /mnt/d/Music
Sending event: library_opened
Sending event: import_begin
Sending event: import_task_created
Sending event: import_task_start
Looking up: /mnt/d/test
Tagging Bawrut - 4x4 (Remixes)
No album ID found.
Search terms: Bawrut - 4x4 (Remixes)
Album might be VA: False
Searching for MusicBrainz releases with: {'release': u'4x4 (remixes)', 'tracks': u'1', 'artist': u'bawrut'}
Requesting MusicBrainz release f68de3a5-30e1-4849-bde5-7237833ee9f9
primary MB release type: single
Sending event: albuminfo_received
Candidate: Bawrut - Ciquita (f68de3a5-30e1-4849-bde5-7237833ee9f9)
Computing track assignment...
...done.
Success. Distance: 0.56
Requesting MusicBrainz release dda48d1f-cf31-47ba-9713-c4414ddef4c2
primary MB release type: ep
Sending event: albuminfo_received
Candidate: Wilmer X - 4x4 (dda48d1f-cf31-47ba-9713-c4414ddef4c2)
Computing track assignment...
...done.
Success. Distance: 0.75
Requesting MusicBrainz release b4c65504-6bd0-4ff8-97a7-9df3ee838b2c
primary MB release type: album
Sending event: albuminfo_received
Candidate: La Unión - 4x4 (b4c65504-6bd0-4ff8-97a7-9df3ee838b2c)
Computing track assignment...
...done.
Success. Distance: 0.80
Requesting MusicBrainz release 207c7744-b6a0-4f10-ab7c-a7b216106121
primary MB release type: album
Sending event: albuminfo_received
Candidate: McCoy Tyner Quartets - 4x4 (207c7744-b6a0-4f10-ab7c-a7b216106121)
Computing track assignment...
...done.
Success. Distance: 0.81
Requesting MusicBrainz release 8a204bbf-7a58-4421-aa19-512590dbfc1c
primary MB release type: ep
Sending event: albuminfo_received
Candidate: Works Progress Administration - 4X4 (8a204bbf-7a58-4421-aa19-512590dbfc1c)
Computing track assignment...
...done.
Success. Distance: 0.71
Traceback (most recent call last):
  File "/usr/local/bin/beet", line 11, in <module>
    load_entry_point('beets==1.5.0', 'console_scripts', 'beet')()
  File "/usr/local/lib/python2.7/dist-packages/beets/ui/__init__.py", line 1267, in main
    _raw_main(args)
  File "/usr/local/lib/python2.7/dist-packages/beets/ui/__init__.py", line 1254, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/local/lib/python2.7/dist-packages/beets/ui/commands.py", line 956, in import_func
    import_files(lib, paths, query)
  File "/usr/local/lib/python2.7/dist-packages/beets/ui/commands.py", line 926, in import_files
    session.run()
  File "/usr/local/lib/python2.7/dist-packages/beets/importer.py", line 329, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/usr/local/lib/python2.7/dist-packages/beets/util/pipeline.py", line 445, in run_parallel
    six.reraise(exc_info[0], exc_info[1], exc_info[2])
  File "/usr/local/lib/python2.7/dist-packages/beets/util/pipeline.py", line 312, in run
    out = self.coro.send(msg)
  File "/usr/local/lib/python2.7/dist-packages/beets/util/pipeline.py", line 194, in coro
    func(*(args + (task,)))
  File "/usr/local/lib/python2.7/dist-packages/beets/importer.py", line 1353, in lookup_candidates
    task.lookup_candidates()
  File "/usr/local/lib/python2.7/dist-packages/beets/importer.py", line 641, in lookup_candidates
    autotag.tag_album(self.items, search_ids=self.search_ids)
  File "/usr/local/lib/python2.7/dist-packages/beets/autotag/match.py", line 460, in tag_album
    va_likely):
  File "/usr/local/lib/python2.7/dist-packages/beets/plugins.py", line 576, in decorated
    for v in generator(*args, **kwargs):
  File "/usr/local/lib/python2.7/dist-packages/beets/autotag/hooks.py", line 637, in album_candidates
    for candidate in plugins.candidates(items, artist, album, va_likely):
  File "/usr/local/lib/python2.7/dist-packages/beets/plugins.py", line 386, in candidates
    for candidate in plugin.candidates(items, artist, album, va_likely):
  File "/usr/local/lib/python2.7/dist-packages/beetsplug/beatport.py", line 360, in candidates
    return self._get_releases(query)
  File "/usr/local/lib/python2.7/dist-packages/beetsplug/beatport.py", line 412, in _get_releases
    for x in self.client.search(query)]
  File "/usr/local/lib/python2.7/dist-packages/beetsplug/beatport.py", line 138, in search
    release = self.get_release(item['id'])
  File "/usr/local/lib/python2.7/dist-packages/beetsplug/beatport.py", line 154, in get_release
    release.tracks = self.get_release_tracks(beatport_id)
  File "/usr/local/lib/python2.7/dist-packages/beetsplug/beatport.py", line 166, in get_release_tracks
    return [BeatportTrack(t) for t in response]
  File "/usr/local/lib/python2.7/dist-packages/beetsplug/beatport.py", line 265, in __init__
    self.genre = six.text_type(data['subGenres'][0].get('name'))
IndexError: list index out of range

Here's a link to the music files that trigger the bug (if relevant): https://www.beatport.com/track/more-cowbell-jimpster-remix/10656680 https://www.beatport.com/track/shakti-pan-feat-sven-original-mix/9130725 etc. Basically any track i tried

Setup

My configuration (output of beet config) is:

paths:
    default: $genre/$year_$month/$artist_$title
    singleton: $genre/$year_$month/$artist_$title
library: /mnt/d/Music/musiclibrary.db

replace:
    '[\\/]': _
    ^\.: _
    '[\x00-\x1f]': _
    '[<>:"\?\*\|]': _
    \.$: _
    \s+$: ''
original_date: yes
path_sep_replace: _

plugins: inline beatport
directory: /mnt/d/Music

import:
    move: no
    copy: yes
    write: yes
beatport:
    source_weight: 1
    tokenfile: beatport_token.json
    apikey: REDACTED
    apisecret: REDACTED
pathfields: {}
album_fields: {}
item_fields: {}

Thank you.

sampsyo commented 5 years ago

Thanks! Looks like this result just has zero "subGenre"s, right, @temrix?

temrix commented 5 years ago

It has an attribute "subGenre" but it contains an empty list.

Also, an empty response from the API should be handled. I have also found another bug: It is only checked whether the Beatport ID is valid according to a regex and not also if the response really gives back results other than an empty list.

I am currently testing my fixes for it.