scrub: Catch error when re-embedding illegal album art
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 31
Description
### Problem
Running import on MP4 files in my collection is causing beets to crash with the error
ValueError: MP4 files only supports PNG and JPEG images
Running this command in verbose (`-vv`) mode:
```sh
$ beet -vv import -t
```
Led to this problem:
[log.txt](https://github.com/beetbox/beets/files/878632/log.txt)
Here's a link to the music files that trigger the bug (if relevant):
### Setup
* OS: Linux
* Python version: 2.7.13
* beets version: 1.4.3
* Turning off plugins made problem go away (yes/no): No. However, running ```beet clearart``` prior to importing resolves the issue.
My configuration (output of `beet config`) is:
```yaml
plugins: fetchart convert scrub web inline embedart
directory: /export/Music/Cleaned
library: /config/musiclibrary.db
art_filename: albumart
threaded: yes
original_date: no
per_disc_numbering: yes
convert:
auto: no
ffmpeg: /usr/bin/ffmpeg
opts: -ab 320k -ac 2 -ar 48000
max_bitrate: 320
threads: 1
paths:
default: $albumartist/$album%aunique{}/%if{$multidisc, $disc-}$track $title
singleton: Non-Album/$artist - $title
comp: Compilations/$album%aunique{}/%if{$multidisc, $disc-}$track $title
albumtype_soundtrack: Soundtracks/$album/%if{$multidisc, $disc-}$track $title
item_fields:
multidisc: 1 if disctotal > 1 else 0
import:
write: yes
copy: no
move: yes
resume: ask
incremental: yes
quiet_fallback: skip
timid: no
log: /config/beet.log
lastgenre:
auto: yes
source: album
embedart:
auto: no
fetchart:
auto: yes
replaygain:
auto: no
scrub:
auto: yes
replace:
'^\.': _
'[\x00-\x1f]': _
'[<>:"\?\*\|]': _
'[\xE8-\xEB]': e
'[\xEC-\xEF]': i
'[\xE2-\xE6]': a
'[\xF2-\xF6]': o
'[\xF8]': o
'\.$': _
'\s+$': ''
web:
host: 0.0.0.0
port: 8337
```
Contributor guide
Research direction
Start by reproducing the crash with `beet -vv import -t` on an affected MP4 and review the linked log. Compare behavior with the `scrub`, `embedart`, and `fetchart` plugins enabled, noting that `beet clearart` avoids the problem. Done means importing the affected files no longer crashes when album art is not PNG or JPEG.
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