beetbox / beetbox/beets

convert: Don't stop when files can't be copied

Open
#2,330 6 comments 0 reactions 0 assignees View on GitHub
convert feature
Dominant language
Python
Stars
15.7k
Forks
2.1k
Avg merge
4d 21h
Merged PRs (30d)
31

Description

### Problem
In the process of exporting my whole music library in a lossy format (`beet convert --dest /path/to/dest/`) I stumbled upon a few invalid database entries that stopped the conversion.

```sh
$ beet -vv convert --dest .
user configuration: /home/tmplt/.config/beets/config.yaml
data directory: /home/tmplt/.config/beets
plugin paths:
Sending event: pluginload
library database: /home/tmplt/media/music/.lib/musiclibrary.blb
library directory: /home/tmplt/media/music
Sending event: library_opened

[All tracks in the library]

Convert? (Y/n)
convert: Copying /home/tmplt/media/music/__/00.mp3
convert: Copying /home/tmplt/media/music/__/00.1.mp3
convert: Copying /home/tmplt/media/music/__/00.3.mp3
convert: Copying /home/tmplt/media/music/__/00.2.mp3
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/beets/util/__init__.py", line 442, in copy
shutil.copyfile(path, dest)
File "/usr/lib/python2.7/shutil.py", line 82, in copyfile
with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: '/home/tmplt/media/music/__/00.mp3'

Error: No such file or directory while copying /home/tmplt/media/music/__/00.mp3 to /home/tmplt/.mnt/Palaven/music_export/_/[0000]/00.mp3
```

I've had the library for a while; unfortunately I don't remember what created those entries.

Is there a way to remove these entries, alternatively force the conversion, ignoring possible errors?

### Setup

* OS: Arch Linux
* Python version: 2.7.12
* beets version: 1.4.2
* Turning off plugins made problem go away (yes/no):

My configuration (output of `beet config`) is:

```yaml
convert:
embed: yes
quiet: yes
never_convert_lossy_files: yes
format: ogg
formats:
mp3:
command: ffmpeg -i $source -qscale:a 0 $dest
extension: mp3
ogg:
command: oggenc -q6 -o $dest $source
extension: ogg
alac:
command: ffmpeg -i $source -y -vn -acodec alac $dest
extension: m4a
aac:
command: ffmpeg -i $source -y -vn -acodec libfaac -aq 100 $dest
extension: m4a
opus: ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest
flac: ffmpeg -i $source -y -vn -acodec flac $dest
wma: ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest
album_art_maxwidth: 0
dest:
auto: no
threads: 4
copy_album_art: no
tmpdir:
max_bitrate: 500

paths: {}
pretend: no
smartplaylist:
relative_to: ~/media/music
playlist_dir: ~/.mpd/playlists
playlists:
- name: all.m3u
query: ''
- name: Rock.m3u
query: genre:rock
- name: Metal.m3u
query: genre:metal
- name: Rap.m3u
query: genre:rap
- name: Space.m3u
query: ['artist:Ben Prunty', 'artist:Keldian', 'album:Space metal']
- name: Power Metal.m3u
query: genre:Power Metal
- name: Symphonic Metal.m3u
query: genre:Symphonic Metal
auto: yes
embedart:
remove_art_file: yes
compare_threshold: 0
auto: yes
ifempty: no
maxwidth: 0
replaygain:
backend: gstreamer
targetlevel: 89
auto: yes
overwrite: no
ihate:
warn: ['album:christmas', 'genre:polka']
skip: []
library: ~/media/music/.lib/musiclibrary.blb

plugins: chroma fetchart embedart mpdstats ihate smartplaylist replaygain convert fetchart lastgenre fuzzy
directory: ~/media/music

import:
move: no
lastgenre:
count: 1
source: album
prefer_specific: no
force: yes
min_weight: 10
auto: yes
whitelist: yes
separator: ', '
fallback:
canonical: no
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
fuzzy:
threshold: 0.7
prefix: '~'
mpd:
rating: yes
rating_mix: 0.75
host: localhost
music_directory: /home/tmplt/media/music
password: REDACTED
port: 6600
chroma:
auto: yes
```

Contributor guide

Open the contributing guide

Research direction

Start in beets/util/__init__.py at the copy function around line 442, then follow how the convert command handles its copy errors. Determine how a missing source file can be reported without stopping other conversions. Done means conversion continues past invalid library entries while clearly reporting the files that could not be copied.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.