beets icon indicating copy to clipboard operation
beets copied to clipboard

fetchart says "found album art" but it downloads nothing

Open simonbcn opened this issue 9 years ago • 6 comments

Problem

fetchart says "found album art" but it downloads nothing

$ beet -vv fetchart -f "a‐ha"
user configuration: /home/juan/.config/beets/config.yaml
data directory: /home/juan/.config/beets
plugin paths: 
Sending event: pluginload
artresizer: method is (2, (6, 9, 8))
thumbnails: using IM to write metadata
thumbnails: using GIO to compute URIs
library database: /home/juan/.beets/musiclibrary.blb
library directory: /home/juan/Música
Sending event: library_opened
fetchart: trying source filesystem for album a‐ha - The Singles: 1984-2004
fetchart: trying source coverart for album a‐ha - The Singles: 1984-2004
fetchart: downloading image: https://coverartarchive.org/release/73bb4da7-b5ed-34c4-b586-b96568e5f68d/front
fetchart: downloaded art to: /tmp/tmp3eqeiahi.jpg
fetchart: image size: (1200, 1200)
fetchart: image needs resizing (1200 > 300)
fetchart: using remote image /tmp/tmp3eqeiahi.jpg
artresizer: ImageMagick resizing /tmp/tmp3eqeiahi.jpg to /tmp/tmplkpq54qa.jpg
Sending event: art_set
embedart: Resizing album art to 300 pixels wide
artresizer: ImageMagick resizing /home/juan/Música/a‐ha/The Singles_ 1984-2004/cover.jpg to /tmp/tmp2hmxchkz.jpg
embedart: Embedding album art into a‐ha - The Singles: 1984-2004
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
Sending event: after_write
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
Sending event: after_write
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
open failed: [Errno 2] No such file or directory: b'/home/juan/M\xc3\xbasica/a-ha/The Singles_ 1984-2004/03 - Train of Thought (remix).mp3'
error reading /home/juan/Música/a-ha/The Singles_ 1984-2004/03 - Train of Thought (remix).mp3: [Errno 2] No such file or directory: b'/home/juan/M\xc3\xbasica/a-ha/The Singles_ 1984-2004/03 - Train of Thought (remix).mp3'
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
Sending event: after_write
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
Sending event: after_write
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
Sending event: after_write
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
Sending event: after_write
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
Sending event: after_write
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
Sending event: after_write
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
Sending event: after_write
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
Sending event: after_write
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
Sending event: after_write
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
Sending event: after_write
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
Sending event: after_write
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
Sending event: after_write
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
Sending event: after_write
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
Sending event: after_write
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
Sending event: after_write
embedart: embedding /tmp/tmp2hmxchkz.jpg
Sending event: write
zero: comments:  -> None
zero: albumartist_sort:  -> None
zero: artist_sort:  -> None
Sending event: after_write
thumbnails: generating thumbnail for a‐ha - The Singles: 1984-2004
artresizer: ImageMagick resizing /home/juan/Música/a‐ha/The Singles_ 1984-2004/cover.jpg to /home/juan/.cache/thumbnails/large/1231e5c72c04d8c15b14fcd1ecacfdd5.png
artresizer: ImageMagick resizing /home/juan/Música/a‐ha/The Singles_ 1984-2004/cover.jpg to /home/juan/.cache/thumbnails/normal/1231e5c72c04d8c15b14fcd1ecacfdd5.png
thumbnails: wrote thumbnail for a‐ha - The Singles: 1984-2004
Sending event: database_change
fetchart: a‐ha - The Singles: 1984-2004: found album art
Sending event: cli_exit

Led to this problem:

$ ls Música/a-ha/The\ Singles_\ 1984-2004
04 - Hunting High and Low (remix).mp3  12 - Move to Memphis.mp3
05 - I've Been Losing You.mp3          13 - Dark Is the Night.mp3
06 - Cry Wolf.mp3                      14 - Shapes That Go Together.mp3
07 - Manhattan Skyline.mp3             15 - Summer Moved On.mp3
08 - The Living Daylights.mp3          16 - Minor Earth, Major Sky.mp3
09 - Stay on These Roads.mp3           17 - Velvet.mp3
10 - Touchy!.mp3                       18 - Forever Not Yours.mp3
11 - Crying in the Rain.mp3            19 - Lifelines.mp3

Setup

  • OS: Arch Linux
  • Python version: 3.6.1
  • beets version: beets-git 1.4.3.r351.g01480704-1 (installed from AUR package)

My configuration (output of beet config) is:

directory: "/home/juan/M\xFAsica/"
library: /home/juan/.beets/musiclibrary.blb
threaded: no

plugins: convert fetchart info duplicates badfiles zero replaygain embedart lastgenre scrub chroma discogs fromfilename thumbnails
fetchart:
    auto: yes
    maxwidth: 300
    cover_names: cover front art album folder Frontal frontal
    google_key: REDACTED
    sources: filesystem coverart itunes amazon albumart google *
    minwidth: 0
    enforce_ratio: no
    cautious: no
    google_engine: 001442825323518660753:hrh5ch1gjzm
    fanarttv_key: REDACTED
    store_source: no
embedart:
    auto: yes
    maxwidth: 300
    compare_threshold: 0
    ifempty: no
    remove_art_file: no

match:
    strong_rec_thresh: 0.2

import:
    art: yes
    languages: es en

paths:
    default: $albumartist/$album/$track - $title
    singleton: $artist - $title
    comp: Varios/$album/$track - $title
replaygain:
    backend: gstreamer
    overwrite: yes
    auto: yes
    targetlevel: 89
lastgenre:
    auto: yes
    canonical: yes
    count: 3
    whitelist: yes
    min_weight: 10
    fallback:
    source: album
    force: yes
    separator: ', '
    prefer_specific: no
convert:
    auto: yes
    tmpdir: /tmp
    command: ffmpeg -i $source -y -codec:a libmp3lame -vn -qscale:a 1 $dest
    extension: mp3
    quiet: yes
    never_convert_lossy_files: yes
    dest:
    pretend: no
    threads: 8
    format: mp3
    formats:
        aac:
            command: ffmpeg -i $source -y -vn -acodec aac -aq 1 $dest
            extension: m4a
        alac:
            command: ffmpeg -i $source -y -vn -acodec alac $dest
            extension: m4a
        flac: ffmpeg -i $source -y -vn -acodec flac $dest
        mp3: ffmpeg -i $source -y -vn -aq 2 $dest
        opus: ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest
        ogg: ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest
        wma: ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest
    max_bitrate: 500
    embed: yes

    paths: {}
    copy_album_art: no
    album_art_maxwidth: 0
duplicates:
    count: yes
    full: yes
    album: no
    checksum: ''
    copy: ''
    delete: no
    format: ''
    keys: []
    merge: no
    move: ''
    path: no
    tiebreak: {}
    strict: no
    tag: ''
scrub:
    auto: yes
zero:
    fields: comments albumartist_sort artist_sort albumartist_sort
    update_database: yes
    auto: yes
    keep_fields: []
acoustid:
    apikey: REDACTED
thumbnails:
    auto: yes
    force: no
    dolphin: no
discogs:
    apikey: REDACTED
    apisecret: REDACTED
    tokenfile: discogs_token.json
    source_weight: 0.5
    user_token: REDACTED
chroma:
    auto: yes

simonbcn avatar May 26 '17 13:05 simonbcn

Hi! Can you please try to narrow down what's going wrong? You might try disabling other plugins, for example, to see if you can get more specific evidence. The goal should be to let other people reproduce the problem—at the moment, everything seems to be working fine with fetchart, so we need a place to start investigating.

sampsyo avatar May 26 '17 13:05 sampsyo

I can guess the directory naming is the problem, fetchart saves to /home/juan/Música/a‐ha/ while embedart expect /home/juan/M\xc3\xbasica/a-ha/.

legalize_path(), sanitize_path() or some util path function might help. But wouldn't know exactly how to apply them in this case. Just a thought!

peace899 avatar May 26 '17 14:05 peace899

Hmm; I think those are actually the same path—one's the UTF-8-encoded bytes, and one is the printed Unicode result:

>>> print(b'/home/juan/M\xc3\xbasica/a-ha/'.decode('utf8'))
/home/juan/Música/a-ha/

But an encoding problem is a good guess in any case!

sampsyo avatar May 26 '17 14:05 sampsyo

The problem isn't the name of Music folder (Música), there are several albums inside that folder and they don't fail. I think the problem is the group name. I see now that beets has created 2 folders for same album: one with name a‐ha and other with a-ha, it seems equal but it isn't:

>>> print("a-ha".encode('utf8'))
b'a-ha'
>>> print("a‐ha".encode('utf8'))
b'a\xe2\x80\x90ha'

By some reason, someone has created this group with that symbol in musicbrainz:

$ beet import -CP Música/a-ha/The\ Singles_\ 1984-2004 

/home/juan/Música/a-ha/The Singles_ 1984-2004 (19 items)
Tagging:
    a‐ha - The Singles: 1984-2004
URL:
    https://musicbrainz.org/release/73bb4da7-b5ed-34c4-b586-b96568e5f68d
(Similarity: 100.0%) (CD, 2004, XE, Warner Strategic Marketing United Kingdom)
This album is already in the library!
could not get filesize: [Errno 2] No such file or directory: b'/home/juan/M\xc3\xbasica/a\xe2\x80\x90ha/The Singles_ 1984-2004/01 - Take On Me.mp3'
could not get filesize: [Errno 2] No such file or directory: b'/home/juan/M\xc3\xbasica/a\xe2\x80\x90ha/The Singles_ 1984-2004/02 - The Sun Always Shines on T.V_.mp3'
Old: 19 items, MP3, 232kbps, 79:46, 119.3 MiB
New: 19 items, MP3, 232kbps, 79:46, 133.8 MiB
[S]kip new, Keep both, Remove old? r

simonbcn avatar May 26 '17 19:05 simonbcn

OK! So is the image file located in the other folder?

sampsyo avatar May 26 '17 19:05 sampsyo

I have merged those 2 folders and now it seems work well.

simonbcn avatar May 26 '17 19:05 simonbcn