beetbox / beets

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

Discogs crashes beets 1.3.11 #1345

Closed sammcj closed 9 years ago

sammcj commented 9 years ago
beets version 1.3.11
plugins: fromfilename, duplicates, lastgenre, mbsync, lastimport, fetchart, ftintitle, discogs
Python 2.7.9
OSX 10.10
Traceback (most recent call last):
  File "/usr/local/bin/beet", line 9, in <module>
    load_entry_point('beets==1.3.11', 'console_scripts', 'beet')()
  File "/usr/local/lib/python2.7/site-packages/beets/ui/__init__.py", line 953, in main
    _raw_main(args)
  File "/usr/local/lib/python2.7/site-packages/beets/ui/__init__.py", line 943, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/local/lib/python2.7/site-packages/beets/ui/commands.py", line 876, in import_func
    import_files(lib, paths, query)
  File "/usr/local/lib/python2.7/site-packages/beets/ui/commands.py", line 853, in import_files
    session.run()
  File "/usr/local/lib/python2.7/site-packages/beets/importer.py", line 316, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/usr/local/lib/python2.7/site-packages/beets/util/pipeline.py", line 301, in run
    out = self.coro.send(msg)
  File "/usr/local/lib/python2.7/site-packages/beets/util/pipeline.py", line 183, in coro
    func(*(args + (task,)))
  File "/usr/local/lib/python2.7/site-packages/beets/importer.py", line 1236, in lookup_candidates
    task.lookup_candidates()
  File "/usr/local/lib/python2.7/site-packages/beets/importer.py", line 567, in lookup_candidates
    autotag.tag_album(self.items)
  File "/usr/local/lib/python2.7/site-packages/beets/autotag/match.py", line 433, in tag_album
    search_album, va_likely)
  File "/usr/local/lib/python2.7/site-packages/beets/autotag/hooks.py", line 565, in album_candidates
    out.extend(plugins.candidates(items, artist, album, va_likely))
  File "/usr/local/lib/python2.7/site-packages/beets/plugins.py", line 344, in candidates
    out.extend(plugin.candidates(items, artist, album, va_likely))
  File "/usr/local/lib/python2.7/site-packages/beetsplug/discogs.py", line 141, in candidates
    self.reset_auth()
  File "/usr/local/lib/python2.7/site-packages/beetsplug/discogs.py", line 86, in reset_auth
    self.setup()

Config:

directory: /Volumes/Music/beets
library: /Users/sammcj/Music/beetslibrary.blb
import:
    move: yes
    write: yes
    resume: yes
    log: beetslog.txt
plugins:
    fromfilename
    ftintitle
    duplicates
    fetchart
    lastgenre
    mbsync
    lastimport
    discogs
match:
    strong_rec_thresh: 0.30
fetchart:
    auto: yes
lastfm:
    user: sammcj2000
    api_key: <removed>
sampsyo commented 9 years ago

It looks like the traceback may have gotten cut off (it's missing the exception). Any chance there's more to paste?

oliparcol commented 9 years ago

Hello,

I think I have the same issue. The complete traceback should be:

Traceback (most recent call last):
  File "/opt/oparent/virtenv_beet/bin/beet", line 9, in <module>
    load_entry_point('beets==1.3.11', 'console_scripts', 'beet')()
  File "/home/oparent/repositories/beets/beets/ui/__init__.py", line 953, in main
    _raw_main(args)
  File "/home/oparent/repositories/beets/beets/ui/__init__.py", line 943, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/home/oparent/repositories/beets/beets/ui/commands.py", line 876, in import_func
    import_files(lib, paths, query)
  File "/home/oparent/repositories/beets/beets/ui/commands.py", line 853, in import_files
    session.run()
  File "/home/oparent/repositories/beets/beets/importer.py", line 316, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/home/oparent/repositories/beets/beets/util/pipeline.py", line 301, in run
    out = self.coro.send(msg)
  File "/home/oparent/repositories/beets/beets/util/pipeline.py", line 183, in coro
    func(*(args + (task,)))
  File "/home/oparent/repositories/beets/beets/importer.py", line 1236, in lookup_candidates
    task.lookup_candidates()
  File "/home/oparent/repositories/beets/beets/importer.py", line 567, in lookup_candidates
    autotag.tag_album(self.items)
  File "/home/oparent/repositories/beets/beets/autotag/match.py", line 436, in tag_album
    search_album, va_likely)
  File "/home/oparent/repositories/beets/beets/autotag/hooks.py", line 565, in album_candidates
    out.extend(plugins.candidates(items, artist, album, va_likely))
  File "/home/oparent/repositories/beets/beets/plugins.py", line 344, in candidates
    out.extend(plugin.candidates(items, artist, album, va_likely))
  File "/home/oparent/repositories/beets/beetsplug/discogs.py", line 141, in candidates
    self.reset_auth()
  File "/home/oparent/repositories/beets/beetsplug/discogs.py", line 86, in reset_auth
    self.setup()
TypeError: setup() takes exactly 2 arguments (1 given)

The session argument is not defined in the reset_auth method. Passing None removes the exception but then, the discogs plugin prompts for the token indefinitely.

I am using the latest discogs-client package: 2.0.2.

Thanks,

brunal commented 9 years ago

Hi, the setup() problem has just been fixed, please pull master. I recently implemented re-authorization, since the plugin used to lose it and not ask for it. I'll have a further look at whether the problem comes from us, the discogs python client or the discogs server.

scztt commented 9 years ago

Hmmm, I see: discogs: API Error: 401: You must authenticate to access this resource. (query: ) which comes from: self._log.debug(u'API Error: {0} (query: {1})', e, query)

In my case, va_likely (album might be VA) = true, and I have no album title, which creates an empty query. That's probably why there's an error, and in turn why the plugin things the auth is no longer good, and tries to reauth?

brunal commented 9 years ago

PR #1351 sidesteps the problem, but other re-auth issues may arise.

It comes from discogs-client and oauth2. I actually have a fork of discogs-client there which used oauthlib instead and is python 2 & 3 compatible. The PR still hasn't been merged. I just pinged the owners again, and I think that if it's not merged soon it might be a good idea to move to the fork.

sampsyo commented 9 years ago

It looks like we can close this issue, although other problems clearly remain. Too bad the library is unmaintained.

brunal commented 9 years ago

The PR with discogs_client has been merged and a fresh install should use it, solving the re-auth problems presented here. I'm waiting for the discogs_client maintainers to produce a new tag (for a version newer that the current 2.0.2) and I'll specify it in beets' setup.py.

sampsyo commented 9 years ago

Nice! Thanks, @brunal. I agree we should require the latest release when one is out to PyPI.

brunal commented 9 years ago

Done! Please open a new issue if you have a problem.