beetbox / beets

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

traceback: failed to fetch art...putting in wrong directory...mangled file names. #5195

Open iconoclasthero opened 2 months ago

iconoclasthero commented 2 months ago
$ echo "$PWD"; ls */ -d
/library/music/Cat Stevens/Cat Stevens -- On the Road to Find Out (2001)
'Cat Stevens - The Boxset 2001 Art/'
$ beet fetchart -q "$PWD"
Traceback (most recent call last):
  File "/usr/share/beets/beets/util/__init__.py", line 496, in move
    os.replace(path, dest)
FileNotFoundError: [Errno 2] No such file or directory: b'/tmp/tmp31c51_h5.png' -> b'/library/music/Cat Stevens/Cat Stevens -- On the Road to Find Out (2001)/The Boxset CD01 The City/Cat Stevens -- 00 - On the Road to Find Out.png'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/beets/beets/util/__init__.py", line 503, in move
    shutil.copyfile(path, tmp)
  File "/usr/lib/python3.12/shutil.py", line 262, in copyfile
    with open(dst, 'wb') as fdst:
         ^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/library/music/Cat Stevens/Cat Stevens -- On the Road to Find Out (2001)/The Boxset CD01 The City/.Cat Stevens -- 00 - On the Road to Find Out.pngrcnq849p.beets'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/beets/beets/util/__init__.py", line 508, in move
    raise FilesystemError(exc, 'move', (path, dest),
beets.util.FilesystemError: No such file or directory while moving /tmp/tmp31c51_h5.png to /library/music/Cat Stevens/Cat Stevens -- On the Road to Find Out (2001)/The Boxset CD01 The City/Cat Stevens -- 00 - On the Road to Find Out.png

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/beet", line 33, in <module>
    sys.exit(load_entry_point('beets==1.6.0', 'console_scripts', 'beet')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/beets/beets/ui/__init__.py", line 1285, in main
    _raw_main(args)
  File "/usr/share/beets/beets/ui/__init__.py", line 1272, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/share/beets/beetsplug/fetchart.py", line 1083, in func
    self.batch_fetch_art(lib, lib.albums(ui.decargs(args)), opts.force,
  File "/usr/share/beets/beetsplug/fetchart.py", line 1145, in batch_fetch_art
    self._set_art(album, candidate)
  File "/usr/share/beets/beetsplug/fetchart.py", line 1048, in _set_art
    album.set_art(candidate.path, delete)
  File "/usr/share/beets/beets/library.py", line 1317, in set_art
    util.move(path, artdest)
  File "/usr/share/beets/beets/util/__init__.py", line 512, in move
    os.remove(tmp)
FileNotFoundError: [Errno 2] No such file or directory: '/library/music/Cat Stevens/Cat Stevens -- On the Road to Find Out (2001)/The Boxset CD01 The City/.Cat Stevens -- 00 - On the Road to Find Out.pngrcnq849p.beets'

the root has the .flacs. the art directory that beet/fetchart is trying to save to is not an appropriate place for art to go. it looks like the file names are getting mangled by the parser, but I'm not sure.....either way, I don't know what to do about this traceback...the plugin needs to be able to handle subdirectories inside of album folders... there's no way I can go through 3800 albums looking for subdirectories and then deciding if I want to remove them... plus this breaks the beet run so it aborts whenever there's an issue which defeats the run-in-background functionality of beets.

Problem

Running this command in verbose (-vv) mode:

$ beet -vv; beet config
user configuration: $HOME/.config/beets/config.yaml
data directory: $HOME/.config/beets
plugin paths: 
Sending event: pluginload
library database: /library/music/.share/beets/beets.db
library directory: /library/music
Sending event: library_opened
---
directory: /library/music/
library: /library/music/.share/beets/beets.db
art_filename: $albumartist -- 00 - $album

import:
    copy: no
    write: no
    move: no

plugins: mbsync fetchart
fetchart:
    auto: no
    cautious: yes
    high_resolution: yes
    google_key: REDACTED
    fanarttv_key: REDACTED
    lastfm_key: REDACTED
    store_source: yes
    cover_format: PNG
    sources:
    - filesystem
    -   coverart: release releasegroup
    - itunes
    - lastfm
    - fanarttv
    - google
    - '*'
    minwidth: 0
    maxwidth: 0
    quality: 0
    max_filesize: 0
    enforce_ratio: no
    cover_names:
    - cover
    - front
    - art
    - album
    - folder
    google_engine: 001442825323518660753:hrh5ch1gjzm
    deinterlace: no

Setup

$ uname -a; python3 --version; beet --version; beet --plugins=fetchart version
Linux gigabyte 6.8.4-060804-generic #202404041833 SMP PREEMPT_DYNAMIC Thu Apr  4 18:46:22 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Python 3.12.2
beets version 1.6.0
Python version 3.12.2
plugins: fetchart, mbsync
beets version 1.6.0
Python version 3.12.2
plugins: fetchart
iconoclasthero commented 2 months ago

Actually, it looks like it is trying to save it in a directory that doesn't exist based on a file name that does... there is no directory with "CD01" in the name... here's what's in the directory:

$ ls 
'01-01 - Cat Stevens -- Back to the Good Old Times.flac'
'01-02 - Cat Stevens -- I Love My Dog.flac'
'01-03 - Cat Stevens -- Portobello Road.flac'
'01-04 - Cat Stevens -- Here Comes My Baby.flac'
'01-05 - Cat Stevens -- Matthew & Son.flac'
'01-06 - Cat Stevens -- The Tramp.flac'
"01-07 - Cat Stevens -- I'm Gonna Get Me a Gun.flac"
'01-08 - Cat Stevens -- School Is Out.flac'
'01-09 - Cat Stevens -- A Bad Night.flac'
'01-10 - Cat Stevens -- The Laughing Apple.flac'
'01-11 - Cat Stevens -- Kitty.flac'
'01-12 - Cat Stevens -- Blackness of the Night.flac'
'01-13 - Cat Stevens -- The First Cut Is the Deepest.flac'
'01-14 - Cat Stevens -- Northern Wind.flac'
'01-15 - Cat Stevens -- Moonstone.flac'
'01-16 - Cat Stevens -- Come on Baby (Shift That Log).flac'
'01-17 - Cat Stevens -- Lovely City (When Do You Laugh?).flac'
'01-18 - Cat Stevens -- Here Comes My Wife.flac'
'01-19 - Cat Stevens -- The View From the Top.flac'
'01-20 - Cat Stevens -- Where Are You.flac'
'01-21 - Cat Stevens -- If Only Mother Could See Me Now.flac'
'01-22 - Cat Stevens -- Honey Man (feat. Elton John).flac'
'01-23 - Cat Stevens -- The Joke.flac'
'02-01 - Cat Stevens -- Time _ Fill My Eyes.flac'
"02-02 - Cat Stevens -- Lady d'Arbanville.flac"
'02-03 - Cat Stevens -- Trouble.flac'
'02-04 - Cat Stevens -- Pop Star.flac'
'02-05 - Cat Stevens -- Katmandu.flac'
'02-06 - Cat Stevens -- Lilywhite.flac'
"02-07 - Cat Stevens -- I've Got a Thing About Seeing My Grandson Grow Old.flac"
'02-08 - Cat Stevens -- Where Do the Children Play?.flac'
'02-09 - Cat Stevens -- Wild World.flac'
'02-10 - Cat Stevens -- Sad Lisa.flac'
'02-11 - Cat Stevens -- On the Road to Find Out.flac'
'02-12 - Cat Stevens -- Father and Son.flac'
'02-13 - Cat Stevens -- Love Lives in the Sky.flac'
"02-14 - Cat Stevens -- Don't Be Shy.flac"
'02-15 - Cat Stevens -- If You Want to Sing Out, Sing Out.flac'
'02-16 - Cat Stevens -- The Day They Make Me Tsar.flac'
'02-17 - Cat Stevens -- The Wind.flac'
'02-18 - Cat Stevens -- Moonshadow.flac'
'02-19 - Cat Stevens -- Morning Has Broken.flac'
'02-20 - Cat Stevens -- How Can I Tell You.flac'
'02-21 - Cat Stevens -- Peace Train.flac'
'02-22 - Cat Stevens -- I Want to Live in a Wigwam.flac'
'03-01 - Cat Stevens -- Crab Dance.flac'
'03-02 - Cat Stevens -- Sitting.flac'
'03-03 - Cat Stevens -- Silent Sunlight.flac'
'03-04 - Cat Stevens -- Angelsea.flac'
"03-05 - Cat Stevens -- Can't Keep It In.flac"
'03-06 - Cat Stevens -- 18th Avenue (Kansas City Nightmare).flac'
'03-07 - Cat Stevens -- The Hurt.flac'
'03-08 - Cat Stevens -- Foreigner Suite.flac'
'03-09 - Cat Stevens -- Oh Very Young.flac'
'03-10 - Cat Stevens -- Music.flac'
'03-11 - Cat Stevens -- Sun _ C79.flac'
'03-12 - Cat Stevens -- King of Trees.flac'
'03-13 - Cat Stevens -- Bad Penny (live).flac'
'03-14 - Cat Stevens -- Lady d'\''Arbanville (live).flac'
'03-15 - Cat Stevens -- Another Saturday Night.flac'
'04-01 - Cat Stevens -- Whistlestar.flac'
"04-02 - Cat Stevens -- Novim's Nightmare.flac"
'04-03 - Cat Stevens -- Majik of Majiks.flac'
'04-04 - Cat Stevens -- Banapple Gas.flac'
'04-05 - Cat Stevens -- Blue Monday.flac'
'04-06 - Cat Stevens -- Doves (Majikat Earth Tour Theme Song).flac'
'04-07 - Cat Stevens -- Hard Headed Woman (live).flac'
'04-08 - Cat Stevens -- Tuesday'\''s Dead (live).flac'
'04-09 - Cat Stevens -- Ruins (live).flac'
'04-10 - Cat Stevens -- (Remember the Days of the) Old Schoolyard.flac'
'04-11 - Cat Stevens -- Life.flac'
'04-12 - Cat Stevens -- (I Never Wanted) To Be a Star.flac'
'04-13 - Cat Stevens -- Child for a Day.flac'
'04-14 - Cat Stevens -- Just Another Night.flac'
'04-15 - Cat Stevens -- Daytime.flac'
'04-16 - Cat Stevens -- Last Love Song.flac'
'04-17 - Cat Stevens -- Never.flac'
'04-18 - Cat Stevens -- Father and Son (live).flac'
'04-19 - Cat Stevens -- God Is the Light.flac'
'Cat Stevens - The Boxset 2001 Art/'
'Cat Stevens - The Boxset CD01 The City.ffp'
'Cat Stevens - The Boxset CD01 The City.jpg'
'Cat Stevens - The Boxset CD02 The Search.ffp'
'Cat Stevens - The Boxset CD02 The Search.jpg'
'Cat Stevens - The Boxset CD03 The Hurt.ffp'
'Cat Stevens - The Boxset CD03 The Hurt.jpg'
'Cat Stevens - The Boxset CD04 The Last.ffp'
'Cat Stevens - The Boxset CD04 The Last.jpg'

'Cat Stevens - The Boxset 2001 Art/' < terminal / added... this is a subdirectory.