beetbox / beets

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

Fatal Spotify plugin error - Bad gateway #4789

Open sleroq opened 1 year ago

sleroq commented 1 year ago

When importing a lot of music with Spotify plugin, sometimes I get a "Bad gateway" error which is fatal. With quiet imports I can't resume the import and have to start again.

It would be great if this error could be made non-fatal. Maybe that the song could be retried later?

Problem

Running this command in verbose (-vv) mode:

$ beet -vv import -q -s folder

Led to this problem:

spotify: Searching Spotify for '[Blue Archive] Theme 99 (Onsen/Hotspring Event Lobby BGM) artist:Salieri AS Beta'
Sending event: import_task_created
error: Spotify API error:
{
  "error" : {
    "status" : 502,
    "message" : "Bad gateway."
  }
}
URL:
https://api.spotify.com/v1/search
params:
{'q': '[Blue Archive] Theme 99 (Onsen/Hotspring Event Lobby BGM) artist:Salieri AS Beta', 'type': 'track'}

Here's a link to the music files that trigger the bug (if relevant):

Setup

My configuration (output of beet config) is:

lyrics:
    bing_lang_from: []
    sources: genius tekstowo
    auto: yes
    bing_client_secret: REDACTED
    bing_lang_to:
    google_API_key: REDACTED
    google_engine_ID: REDACTED
    genius_api_key: REDACTED
    fallback:
    force: no
    local: no
    dist_thresh: 0.1
directory: ~/Sync/storj/music
library: ~/Music/storj-music-library.db

import:
    move: yes

plugins: discogs spotify fetchart lyrics lastgenre web
discogs:
    user_token: REDACTED
    apikey: REDACTED
    apisecret: REDACTED
    tokenfile: discogs_token.json
    source_weight: 0.5
    separator: ', '
    index_tracks: no
    append_style_genre: no
spotify:
    source_weight: 0.5
    mode: list
    tiebreak: popularity
    show_failures: no
    artist_field: albumartist
    album_field: album
    track_field: title
    region_filter:
    regex: []
    client_id: 4e414367a1d14c75a5c5129a627fcab8
    client_secret: REDACTED
    tokenfile: spotify_token.json
lastgenre:
    whitelist: yes
    min_weight: 10
    count: 1
    fallback:
    canonical: no
    source: album
    force: yes
    auto: yes
    separator: ', '
    prefer_specific: no
    title_case: yes
web:
    host: 127.0.0.1
    port: 8337
    cors: ''
    cors_supports_credentials: no
    reverse_proxy: no
    include_paths: no
    readonly: yes
fetchart:
    auto: yes
    minwidth: 0
    maxwidth: 0
    quality: 0
    max_filesize: 0
    enforce_ratio: no
    cautious: no
    cover_names:
    - cover
    - front
    - art
    - album
    - folder
    sources:
    - filesystem
    - coverart
    - itunes
    - amazon
    - albumart
    store_source: no
    high_resolution: no
    deinterlace: no
    cover_format:
    google_key: REDACTED
    google_engine: 001442825323518660753:hrh5ch1gjzm
    fanarttv_key: REDACTED
    lastfm_key: REDACTED
arsaboo commented 1 year ago

502 errors are weird...they often are resolved if you retry after some time. Moreover, most likely you will get the same 502 error with the next album. Also, I am wondering if we skip the current album and move to the next one, the current album may be marked as skipped (not-tested) and may not be imported in the next round (unless you import from the log files).