beets icon indicating copy to clipboard operation
beets copied to clipboard

bandcamp: Handle missing name element

Open beestiel opened this issue 6 years ago • 6 comments

Problem

Selecting the "tracks" command (T) while using the Auto-Tagger led to this problem:

Traceback (most recent call last):
  File "/home/USER/virtualenv2/bin/beet", line 11, in <module>
    sys.exit(main())
  File "/home/USER/virtualenv2/lib/python2.7/site-packages/beets/ui/__init__.py", line 1266, in main
    _raw_main(args)
  File "/home/USER/virtualenv2/lib/python2.7/site-packages/beets/ui/__init__.py", line 1253, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/home/USER/virtualenv2/lib/python2.7/site-packages/beets/ui/commands.py", line 955, in import_func
    import_files(lib, paths, query)
  File "/home/USER/virtualenv2/lib/python2.7/site-packages/beets/ui/commands.py", line 925, in import_files
    session.run()
  File "/home/USER/virtualenv2/lib/python2.7/site-packages/beets/importer.py", line 329, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/home/USER/virtualenv2/lib/python2.7/site-packages/beets/util/pipeline.py", line 445, in run_parallel
    six.reraise(exc_info[0], exc_info[1], exc_info[2])
  File "/home/USER/virtualenv2/lib/python2.7/site-packages/beets/util/pipeline.py", line 315, in run
    for msg in _allmsgs(out):
  File "/home/USER/virtualenv2/lib/python2.7/site-packages/beets/util/pipeline.py", line 466, in pull
    out = coro.send(msg)
  File "/home/USER/virtualenv2/lib/python2.7/site-packages/beets/util/pipeline.py", line 194, in coro
    func(*(args + (task,)))
  File "/home/USER/virtualenv2/lib/python2.7/site-packages/beets/importer.py", line 1351, in lookup_candidates
    task.lookup_candidates()
  File "/home/USER/virtualenv2/lib/python2.7/site-packages/beets/importer.py", line 892, in lookup_candidates
    prop = autotag.tag_item(self.item, search_ids=self.search_ids)
  File "/home/USER/virtualenv2/lib/python2.7/site-packages/beets/autotag/match.py", line 513, in tag_item
    for track_info in hooks.item_candidates(item, search_artist, search_title):
  File "/home/USER/virtualenv2/lib/python2.7/site-packages/beets/plugins.py", line 574, in decorated
    for v in generator(*args, **kwargs):
  File "/home/USER/virtualenv2/lib/python2.7/site-packages/beets/autotag/hooks.py", line 640, in item_candidates
    for candidate in plugins.item_candidates(item, artist, title):
  File "/home/USER/virtualenv2/lib/python2.7/site-packages/beets/plugins.py", line 392, in item_candidates
    for item_candidate in plugin.item_candidates(item, artist, title):
  File "/home/USER/virtualenv2/lib/python2.7/site-packages/beetsplug/bandcamp.py", line 96, in item_candidates
    return self.get_tracks(item.title)
  File "/home/USER/virtualenv2/lib/python2.7/site-packages/beetsplug/bandcamp.py", line 166, in get_tracks
    return [self.get_track_info(url) for url in track_urls]
  File "/home/USER/virtualenv2/lib/python2.7/site-packages/beetsplug/bandcamp.py", line 174, in get_track_info
    title = name_section.find(attrs={'itemprop': 'name'}).text.strip()
AttributeError: 'NoneType' object has no attribute 'text'

This happens with all of my music files.

Setup

  • OS: Linux 5.4.31-gentoo-whatbox x86_64
  • Python version: 2.7.18
  • beets version: 1.4.9
  • Turning off plugins made problem go away (yes/no): Yes, but I couldn't figure out how to get the --plugins command to work. ^^;

My configuration (output of beet config) is:

mbcollection:
    auto: yes
    remove: yes
    collection: 63cbefd8-f16c-4490-ba64-876ad3807ac3
web:
    host: REDACTED.whatbox.ca
    cors: '*'
    cors_supports_credentials: no
    reverse_proxy: no
    include_paths: no
    port: 8337
bandcamp:
    lyrics: yes
    art: yes
    split_artist_title: no
    min_candidates: 5
    source_weight: 0.5
plex:
    host: localhost
    port: 13834
    library_name: Music
    token: REDACTED

musicbrainz:
    user: beestiel
    pass: REDACTED
library: /home/USER/.config/beets/musiclibrary.db

plugins: bandcamp copyartifacts fetchart fromfilename ihate mbcollection mbsubmit plexupdate scrub web
directory: /home/USER/files/Music

import:
    ignore_hidden: yes
    bell: yes
    languages: jp
    write: no
    link: yes
    default_action: skip

match:
    preferred:
        original_year: yes
copyartifacts:
    print_ignored: yes
    extensions: .*
fetchart:
    auto: yes
    minwidth: 0
    sources:
    - filesystem
    - coverart
    - itunes
    - amazon
    - albumart
    google_engine: 001442825323518660753:hrh5ch1gjzm
    enforce_ratio: no
    cautious: no
    maxwidth: 0
    store_source: no
    google_key: REDACTED
    fanarttv_key: REDACTED
    cover_names:
    - cover
    - front
    - art
    - album
    - folder
mbsubmit:
    threshold: medium
    format: $track. $title - $artist ($length)
ihate:
    warn: []
    skip: []
scrub:
    auto: yes

beestiel avatar Nov 11 '20 02:11 beestiel

Switching off the Bandcamp plugin seems to have fixed the issue. I tried turning off the lyrics and art settings, but the problem persisted until I entirely removed "bandcamp" from the plugin list.

beestiel avatar Nov 11 '20 02:11 beestiel

Thanks! Looks like a bug—the plugin should handle this missing data instead of crashing.

sampsyo avatar Nov 11 '20 03:11 sampsyo

@beestiel I presume that you used the beets-bandcamp plugin at the time of writing - just fyi that this project seems to be dead and that you can find an up-to-date fork here if you're still after bandcamp autotagging features.

@sampsyo is beets-bandcamp mentioned anywhere in the docs? If so, would it be possible to update them to point to the fork above?

snejus avatar Aug 03 '21 01:08 snejus

Yes! Happy to merge a PR with an updated link if someone can open one.

sampsyo avatar Aug 03 '21 17:08 sampsyo

I tried grepping for the name bandcamp across the repo but did not find anything 😕 . Where should I be looking for it?

snejus avatar Aug 03 '21 17:08 snejus

Ah, looks like I was confused (a couple of times, actually). We don't yet link to the plugin, so the thing to do is to add a reference, not to change an existing reference. The list of links to external plugins is here: https://github.com/beetbox/beets/blob/master/docs/plugins/index.rst#other-plugins

Since this is an external plugin (not one distributed as part of beets), I'll also close this issue.

sampsyo avatar Aug 03 '21 17:08 sampsyo