beetbox / beets

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

Beatport Plugin: beetsplug.beatport.BeatportAPIError: Error 401 #2236

Closed itsbrex closed 7 years ago

itsbrex commented 7 years ago

Problem

Importing folder of tracks via beet import -s '' and entering in the URL for the track in question yields this in console for the current track in question:

Finding tags for track "Adrian Hour - Funkiss (Original Mix)".
Candidates:
1. After Hour - Yah K.K. (Original Mix) (42.9%) (length, artist, title)
2. After Hour - Yah K.K. (original mix) (42.9%) (length, artist, title)
3. Adrian Hour - Move That Dope (36.7%) (title, length)
4. Adrian Hour - Chordgresion (35.7%) (title, length)
5. Adrian Hour - One Step (33.3%) (title, length)
# selection (default 1), Skip, Use as-is, Enter search, enter Id, aBort,
eDit, edit Candidates? i
Enter recording ID: https://www.beatport.com/release/funkiss-ep/1695074
No matching recordings found.
[U]se as-is, Skip, Enter search, enter Id, aBort, eDit, edit Candidates? i
Enter recording ID: https://www.beatport.com/track/funkiss-original-mix/7569017
Traceback (most recent call last):
  File "/Users/anodigital/.pyenv/versions/2.7.10/bin/beet", line 9, in <module>
    load_entry_point('beets==1.3.19', 'console_scripts', 'beet')()
  File "/Users/anodigital/.pyenv/versions/2.7.10/lib/python2.7/site-packages/beets/ui/__init__.py", line 1209, in main
    _raw_main(args)
  File "/Users/anodigital/.pyenv/versions/2.7.10/lib/python2.7/site-packages/beets/ui/__init__.py", line 1196, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/Users/anodigital/.pyenv/versions/2.7.10/lib/python2.7/site-packages/beets/ui/commands.py", line 969, in import_func
    import_files(lib, paths, query)
  File "/Users/anodigital/.pyenv/versions/2.7.10/lib/python2.7/site-packages/beets/ui/commands.py", line 946, in import_files
    session.run()
  File "/Users/anodigital/.pyenv/versions/2.7.10/lib/python2.7/site-packages/beets/importer.py", line 320, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/Users/anodigital/.pyenv/versions/2.7.10/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 "/Users/anodigital/.pyenv/versions/2.7.10/lib/python2.7/site-packages/beets/util/pipeline.py", line 312, in run
    out = self.coro.send(msg)
  File "/Users/anodigital/.pyenv/versions/2.7.10/lib/python2.7/site-packages/beets/util/pipeline.py", line 171, in coro
    task = func(*(args + (task,)))
  File "/Users/anodigital/.pyenv/versions/2.7.10/lib/python2.7/site-packages/beets/importer.py", line 1285, in user_query
    task.choose_match(session)
  File "/Users/anodigital/.pyenv/versions/2.7.10/lib/python2.7/site-packages/beets/importer.py", line 870, in choose_match
    choice = session.choose_item(self)
  File "/Users/anodigital/.pyenv/versions/2.7.10/lib/python2.7/site-packages/beets/ui/commands.py", line 810, in choose_item
    task.item, search_ids=search_id.split())
  File "/Users/anodigital/.pyenv/versions/2.7.10/lib/python2.7/site-packages/beets/autotag/match.py", line 475, in tag_item
    for track_info in hooks.tracks_for_id(trackid):
  File "/Users/anodigital/.pyenv/versions/2.7.10/lib/python2.7/site-packages/beets/autotag/hooks.py", line 562, in tracks_for_id
    plugin_tracks = plugins.track_for_id(track_id)
  File "/Users/anodigital/.pyenv/versions/2.7.10/lib/python2.7/site-packages/beets/plugins.py", line 385, in track_for_id
    res = plugin.track_for_id(track_id)
  File "/Users/anodigital/github/beets/beetsplug/beatport.py", line 385, in track_for_id
    bp_track = self.client.get_track(match.group(2))
  File "/Users/anodigital/github/beets/beetsplug/beatport.py", line 174, in get_track
    response = self._get('/catalog/3/tracks', id=beatport_id)
  File "/Users/anodigital/github/beets/beetsplug/beatport.py", line 197, in _get
    .format(response))
beetsplug.beatport.BeatportAPIError: Error 401 for '/catalog/3/tracks?id=7569017

Setup

My configuration (output of beet config) is:

lyrics:
    bing_lang_from: []
    bing_client_secret: REDACTED
    google_API_key: REDACTED
    force: no
    google_engine_ID: REDACTED
    sources:
    - google
    - lyricwiki
    - lyrics.com
    - musixmatch
    auto: yes
    fallback:
    genius_api_key: REDACTED
    bing_lang_to:
library: /Users/anodigital/github/beets/music.blb
original_date: yes
embedart:
    maxwidth: 1000
    compare_threshold: 0
    auto: yes
    ifempty: no
    remove_art_file: no
pluginpath: ~/github/beets/beetsplug

plugins: beatport fromfilename edit embedart fuzzy importadded lyrics mbsync spotify types

musicbrainz:
    user: brexy
    pass: REDACTED (this wasn't actually redacted so I just typed in 'REDACTED')
mbcollection:
    auto: yes
acousticbrainz:
    auto: yes
threaded: yes
art_filename: cover
duplicate_action: remove
none_rec_action: skip
setlister:
    playlist_dir: ~/Music/ROACH\ Music/Setlists
beatport:
    source_weight: 0.8
    tokenfile: beatport_token.json
    apikey: REDACTED
    apisecret: REDACTED
ignore: .AppleDouble ._* *~ .DS_Store
edit:
    itemfields: track title artist album
    albumfields: album albumartist
    ignore_fields: id path
lastgenre:
    fallback: ''
    canonical: ''
    source: track
    count: 4
    force: yes
    min_weight: 10
    auto: yes
    whitelist: yes
    separator: ', '

match:
    strong_rec_thresh: 0.1
directory: /Users/anodigital/Music/beets_music

import:
    copy: no
    write: yes
    resume: yes
    quiet_fallback: skip
    timid: no
    log: beetslog.txt
group_albums: no
acoustid:
    apikey: OCRrjtfen1
discogs:
    source_weight: 0.2
importadded:
    preserve_write_mtimes: no
    preserve_mtimes: no
fuzzy:
    threshold: 0.7
    prefix: '~'
spotify:
    regex: []
    artist_field: albumartist
    mode: list
    track_field: title
    album_field: album
    region_filter:
    show_failures: no
    tiebreak: popularity

Also, what is weird is that Beets is not finding these tracks as well as one would think. All the files are named with this pattern %artist% - %title% but when are rarely if ever found automatically. Is there a specific naming convention Beets uses as the query that I am not adhering to?

itsbrex commented 7 years ago

I simply deleted / re-installed the plugin and reauthorized and it seems to be working correctly now.