Samik081 / beets-beatport4

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

NoneType error while splitting length #4

Closed JOJ0 closed 1 year ago

JOJ0 commented 1 year ago

Hi, quick and dirty report :-)

Get back to me if you need further details.

HTH!

Correcting tags from:
    Aux 88 - Aux 88
To:
    AUX 88 - Aux 88
URL:
    https://musicbrainz.org/release/b27469e6-5652-4dee-bc1c-79480bbd033c
(Similarity: 48.6%) (missing tracks, label, year) (CD, 2005, US, Submerge Recordings, SUBCD-3011-2)
 * Intro
Missing tracks (12/13 - 92.3%):
 ! We Make Beats                          (# 2) (3:55)
 ! We Are The Future                      (# 3) (5:17)
 ! Rated AUX                              (# 4) (5:10)
 ! K-1 Theme                              (# 5) (5:20)
 ! Tom Tom Beats                          (# 6) (4:36)
 ! Lost In Space Mixdown                  (# 7) (3:54)
 ! Step Into The Light                    (# 8) (4:46)
 ! Don't Bite My Beats                    (# 9) (3:55)
 ! Clones                                 (#10) (5:57)
 ! Detroit Non Stop                       (#11) (3:52)
 ! Aux Mind 2005                          (#12) (4:55)
 ! Electro Planetary Acknowedments Part 1 (#13) (5:52)
Apply, More candidates, Skip, Use as-is, as Tracks, Group albums,
Enter search, enter Id, aBort, eDit, edit Candidates, plaY? a
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 461, in tag_album
    for matched_candidate in hooks.album_candidates(items,
  File "/home/jojo/git/beets/beets/plugins.py", line 573, in decorated
    for v in generator(*args, **kwargs):
  File "/home/jojo/git/beets/beets/autotag/hooks.py", line 632, in album_candidates
    yield from plugins.candidates(items, artist, album, va_likely, extra_tags)
  File "/home/jojo/git/beets/beets/plugins.py", line 384, in candidates
    yield from plugin.candidates(items, artist, album, va_likely,
  File "/home/jojo/git/beets-beatport4/beetsplug/beatport4.py", line 525, in candidates
    return self._get_releases(query)
  File "/home/jojo/git/beets-beatport4/beetsplug/beatport4.py", line 581, in _get_releases
    albums = [self._get_album_info(x)
  File "/home/jojo/git/beets-beatport4/beetsplug/beatport4.py", line 581, in <listcomp>
    albums = [self._get_album_info(x)
  File "/home/jojo/git/beets-beatport4/beetsplug/beatport4.py", line 338, in search
    yield self.get_release(release['id'])
  File "/home/jojo/git/beets-beatport4/beetsplug/beatport4.py", line 354, in get_release
    release.tracks = self.get_release_tracks(beatport_id)
  File "/home/jojo/git/beets-beatport4/beetsplug/beatport4.py", line 368, in get_release_tracks
    return [self.get_track(t['id']) for t in response]
  File "/home/jojo/git/beets-beatport4/beetsplug/beatport4.py", line 368, in <listcomp>
    return [self.get_track(t['id']) for t in response]
  File "/home/jojo/git/beets-beatport4/beetsplug/beatport4.py", line 378, in get_track
    return BeatportTrack(response)
  File "/home/jojo/git/beets-beatport4/beetsplug/beatport4.py", line 137, in __init__
    min, sec = data.get('length', '0:0').split(':')
AttributeError: 'NoneType' object has no attribute 'split'
   prod  (beets)    ~/git/beets   all_in  
Samik081 commented 1 year ago

Hey @JOJ0 thank you for reporting another one! ❤️ I have fixed the issue by adding a fallback when length field has None value/type (https://github.com/Samik081/beets-beatport4/commit/8c28c6178eed616fe4c831d01efcc62d0f808954, v0.2.7). Nevertheless, I couldn't reproduce your case, I ended up with something like this working correctly:

Correcting tags from:
    Aux 88 - Aux 88
To:
    AUX 88 - Aux 88
URL:
    https://musicbrainz.org/release/b27469e6-5652-4dee-bc1c-79480bbd033c
(Similarity: 47.5%) (missing tracks, year) (CD, 2005, US, Submerge Recordings, SUBCD-3011-2)
Missing tracks (12/13 - 92.3%):
 ! We Make Beats                          (# 2) (3:55)
 ! We Are The Future                      (# 3) (5:17)
 ! Rated AUX                              (# 4) (5:10)
 ! K-1 Theme                              (# 5) (5:20)
 ! Tom Tom Beats                          (# 6) (4:36)
 ! Lost In Space Mixdown                  (# 7) (3:54)
 ! Step Into The Light                    (# 8) (4:46)
 ! Don't Bite My Beats                    (# 9) (3:55)
 ! Clones                                 (#10) (5:57)
 ! Detroit Non Stop                       (#11) (3:52)
 ! Aux Mind 2005                          (#12) (4:55)
 ! Electro Planetary Acknowedments Part 1 (#13) (5:52)
Apply, More candidates, Skip, Use as-is, as Tracks, Group albums,
Enter search, enter Id, aBort? a

I got the same MB release, but some other tags are different (apparently label one) and looks like I'm getting different Beatport candidates. Could you possibly dump and paste here the Beatport track ID that is failing?