Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

beet update: Do not stop when files (including album art) cannot be moved #2419

Open
azrdev opened this issue Jan 29, 2017 · 6 comments
Labels
bug

Comments

@azrdev
Copy link

@azrdev azrdev commented Jan 29, 2017

Problem

Running beet up fails for me with messages like

moving album art /srv/music/beets/ASP/Aus der Tiefe_ Der schwarze Schmetterling, Teil IV/cover.jpg to /srv/music/beets/ASP/Aus der Tiefe_ Der schwarze Schmetterling, Teil IV [5622]/cover.1.
jpg
Traceback (most recent call last):
  File "/srv/home/azrael/dev/beets/upstream/beets/util/__init__.py", line 470, in move
    shutil.copyfile(path, dest)
  File "/usr/lib64/python2.7/shutil.py", line 82, in copyfile
    with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: '/srv/music/beets/ASP/Aus der Tiefe_ Der schwarze Schmetterling, Teil IV/cover.jpg'

Setup

  • OS: Fedora 23
  • Python version: 2.7.11
  • beets version: v1.4.3-71-g0a13240 (git HEAD)
  • Turning off plugins made problem go away (yes/no):

My configuration (output of beet config) is:

importfeeds:
    relative_to: /srv/music
    dir: /srv/music/lib/beets_importfeeds
    formats: m3u
    absolute_path: no
    m3u_name: imported.m3u

paths:
    singleton: $albumartist/$album%aunique{}/$track $title
    comp: $albumartist/$album%aunique{}/$track $title
play:
    command: bash -c 'cat $0 | mpc add'
    relative_to: /srv/music
    use_folders: no
    raw: no
    warning_threshold: 100
mpdstats:
    host: localhost
    port: 6600
    music_directory: /srv/music/
    rating: no
chroma:
    auto: no
convert: (...)
embedart:
    auto: no
    compare_threshold: 0
    ifempty: no
    remove_art_file: no
    maxwidth: 0
library: ~/.share/beets/library.blb

plugins: acousticbrainz embedart fetchart fromfilename info missing duplicates chroma info convert importfeeds play
directory: /srv/music/beets

import:
    move: yes
    log: ~/.share/beets/import.log
fetchart:
    auto: yes
    minwidth: 0
    sources:
    - filesystem
    - coverart
    - itunes
    - amazon
    - albumart
    google_engine: 001442825323518660753:hrh5ch1gjzm
    enforce_ratio: no
    cautious: no
    maxwidth: 0
    store_source: no
    google_key: REDACTED
    fanarttv_key: REDACTED
    cover_names:
    - cover
    - front
    - art
    - album
    - folder
duplicates:
    count: no
    full: no
    format: ''
    keys: []
    move: ''
    tag: ''
    path: no
    copy: ''
    tiebreak: {}
    album: no
    strict: no
    checksum: ''
    merge: no
    delete: no
missing:
    count: no
    total: no
acousticbrainz:
    auto: yes
    force: no
@sampsyo sampsyo added the needinfo label Jan 29, 2017
@sampsyo

This comment has been minimized.

Copy link
Member

@sampsyo sampsyo commented Jan 29, 2017

Huh, that's interesting! Thanks for the report.

Is really the full error output? It looks like there are only a couple of frames in the traceback there, and I'd expect it to go all the way back to main. Or I'd expect this to be above an explicit "Error" line reported by beets. Is there any other context above or below that error output?

In any case, the problem is similar to #1926. The idea there is to report the error, as we already do, but just move past it. The mechanism would be more or less the same for beet move and beet update.

@sampsyo sampsyo changed the title `beet update` dies when fetchart doesn't find file beet update: Do not stop when files (including album art) cannot be moved Jan 29, 2017
@azrdev

This comment has been minimized.

Copy link
Author

@azrdev azrdev commented Jan 29, 2017

The traceback is complete, and the full context doesn't contain anything interesting AFAICT:

Sending event: before_item_moved
Sending event: item_moved
moving album art /srv/music/beets/ASP/Aus der Tiefe_ Der schwarze Schmetterling, Teil IV/cover.jpg to /srv/music/beets/ASP/Aus der Tiefe_ Der schwarze Schmetterling, Teil IV [5622]/cover.1.
jpg
Traceback (most recent call last):
  File "/srv/home/azrael/dev/beets/upstream/beets/util/__init__.py", line 470, in move
    shutil.copyfile(path, dest)
  File "/usr/lib64/python2.7/shutil.py", line 82, in copyfile
    with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: '/srv/music/beets/ASP/Aus der Tiefe_ Der schwarze Schmetterling, Teil IV/cover.jpg'

Error: No such file or directory while moving /srv/music/beets/ASP/Aus der Tiefe_ Der schwarze Schmetterling, Teil IV/cover.jpg to /srv/music/beets/ASP/Aus der Tiefe_ Der schwarze Schmetter
ling, Teil IV [5622]/cover.1.jpg
@sampsyo

This comment has been minimized.

Copy link
Member

@sampsyo sampsyo commented Jan 30, 2017

That does it; thanks. It was the "Error:" line I was interested in, which indicates that the error was handled and reported.

In any case, we should indeed fix this, probably at the same time as #1926.

@sampsyo sampsyo added bug and removed needinfo labels Jan 30, 2017
@RollingStar

This comment has been minimized.

Copy link
Contributor

@RollingStar RollingStar commented Jul 19, 2017

Is there any supported method in beets currently for fixing moved/deleted files? My beets database surely has a lot of files like this that have since been renamed. I don't need to keep them in the database. Most of the time, I have added them again after changing my config.yaml to change the filenames given to tracks or cover art.

A fix for this bug would be great, because even if the database still stores records I don't need, at least I could update my library.

@sampsyo

This comment has been minimized.

Copy link
Member

@sampsyo sampsyo commented Jul 20, 2017

There’s not a great way around this, unfortunately—we don’t even really have a command that lets you manually remove dangling references to art files. And yes, the update command should absolutely also have the power to clean up art files. Sorry about that; it’s clearly a missing piece!

msjyoo added a commit to msjyoo/beets that referenced this issue Jan 7, 2018
This patch takes care not to update library path references if the filesystem
operation has failed.

Fixes beetbox#1926, beetbox#2036, beetbox#2768 (beet move issue)
Fixes beetbox#2419, beetbox#2724 (Fixed because edit calls try_sync() -> move(), update calls move())
@goodzack

This comment has been minimized.

Copy link

@goodzack goodzack commented Mar 29, 2018

Perhaps it's obvious, but I think the problem might be different than just not being able to find the file. Let's say I run beet -v update /(my music library folder)/, and due to some issues I had before, it's not able to find the cover art file; often, I find that it's gotten renamed to cover.1.jpg. Even if I provide another cover.jpg that it's looking for, it still runs into the issue.

This happens either

if I rename cover.1.jpg to cover.jpg, in which case I get the error and end up with a cover.1.jpg, or
if I copy cover.1.jpg and rename it to cover.jpg in case beets update can find what it needs with either file. (Sorry, kind of a naïve perception of what it's really doing.) In that case, I end up with the error, cover.1.jpg, AND cover.2.jpg.

OS: OS X 10.13.13
Python version: 2.7.13
beets version: v1.4.6
Turning off plugins made problem go away (yes/no):

my config:

`directory: /Volumes/CritterKeeper/Tunes/Library/
library : /Volumes/CritterKeeper/Tunes/beetlibrary/library.db

import:
bell : yes
resume : ask
write: yes
replace:
'[\/]': ''
'^.': ''
'[\x00-\x1f]': ''
'[<>:"?*|]': ''
'.$': ''
'\s+$': ''
'^\s+': ''
'^-': ''
paths:
default: /$albumartist/%if{$original_year='0000',%if{$year='0000',,$year},$originalyear} $album [$format]/$track $title
singleton: /$albumartist/'non-album tracks'/$title/$title
compilations: /Compilations/%if($original_year) $album%aunique{} [$format]/$track $title
plugins: fetchart duplicates`

part of log before error:

` Sending event: database_change
skipping /Volumes/CritterKeeper/Tunes/Library/A Winged Victory for the Sullen/A Winged Victory for the Sullen [MP3]/01 We Played Some Open Chords and Rejoiced, for the Earth Had Circled the Sun Yet Another Year.1.mp3 because mtime is up to date (1521428795.0)
skipping /Volumes/CritterKeeper/Tunes/Library/A Winged Victory for the Sullen/A Winged Victory for the Sullen [MP3]/02 Requiem for the Static King, Part One.mp3 because mtime is up to date (1521428796.0)
skipping /Volumes/CritterKeeper/Tunes/Library/A Winged Victory For The Sullen/A Winged Victory For The Sullen [MP3]/02 Requiem for the Static King, Part One.mp3 because mtime is up to date (1521428796.0)
skipping /Volumes/CritterKeeper/Tunes/Library/A Winged Victory for the Sullen/A Winged Victory for the Sullen [MP3]/03 Requiem for the Static King, Part Two.mp3 because mtime is up to date (1521428798.0)
A Winged Victory for the Sullen - A Winged Victory For The Sullen - Requiem for the Static King, Part Two
disctotal: 00 -> 01
albumstatus: -> official
month: 00 -> 09
albumartist: A Winged Victory For The Sullen -> A Winged Victory for the Sullen
album: A Winged Victory For The Sullen -> A Winged Victory for the Sullen
mb_albumid: -> 319476eb-7c42-48e4-8fd2-43c2b5ad74d2
mb_releasegroupid: -> 7c8ec4a1-ed83-4fa8-9ba7-72360e60a927
script: -> Latn
catalognum: -> ERATP032LP
asin: -> B005BV5DQY
genre: HOME LISTENING / MODERN CLASSICAL / AMBIENT ->
day: 00 -> 13
original_year: 0000 -> 2011
country: -> GB
mb_albumartistid: -> 67c179d3-f358-43bf-8ecc-d9c560878b65
label: -> Erased Tapes Records
albumtype: -> album
Sending event: before_item_moved
Sending event: item_moved
moving album art /Volumes/CritterKeeper/Tunes/Library/A Winged Victory for the Sullen/A Winged Victory For The Sullen [MP3]/cover.jpg to /Volumes/CritterKeeper/Tunes/Library/A Winged Victory For The Sullen/A Winged Victory for the Sullen [MP3]/cover.jpg
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/beets/util/init.py", line 481, in move
shutil.copyfile(path, dest)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 82, in copyfile
with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: '/Volumes/CritterKeeper/Tunes/Library/A Winged Victory for the Sullen/A Winged Victory For The Sullen [MP3]/cover.jpg'

Error: No such file or directory while moving /Volumes/CritterKeeper/Tunes/Library/A Winged Victory for the Sullen/A Winged Victory For The Sullen [MP3]/cover.jpg to /Volumes/CritterKeeper/Tunes/Library/A Winged Victory For The Sullen/A Winged Victory for the Sullen [MP3]/cover.jpg `

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.