beetbox / beets

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

fetchart cover_format does not seem to be working (PNG => JPEG) #4452

Open rombat opened 2 years ago

rombat commented 2 years ago

PNG image is resized, but not converted as JPG

Problem

Running this command in verbose (-vv) mode:

beet -vv import '.\2007 - Alive! [FLAC]\'
user configuration: C:\Users\tinbapakk\AppData\Roaming\beets\config.yaml
data directory: C:\Users\tinbapakk\AppData\Roaming\beets
plugin paths:
artresizer: method is (2, (7, 1, 0), False)
lyrics: Disabling google source: no API key configured.
inline: adding item field disc_and_track
Sending event: pluginload
library database: D:\Downloads\beets\musiclibrary.db
library directory: D:\Downloads\beets
Sending event: library_opened
Sending event: import_begin
Sending event: import_task_created
Sending event: import_task_start
Looking up: D:\Downloads\soulseektemp\Omnia\2007 - Alive! [FLAC]
Tagging Omnia - Alive!
No album ID found.
Search terms: Omnia - Alive!
Additional search terms: {'year': 2007, 'catalognum': ''}
Album might be VA: False
Searching for MusicBrainz releases with: {'release': 'alive!', 'artist': 'omnia', 'tracks': '9', 'date': '2007'}
Requesting MusicBrainz release 6bb83f74-1345-47ba-af3b-b9c1dbfdf7f6

[...]

fetchart: trying source bandcamp for album Omnia - Alive!
bandcamp: Not fetching art for a non-bandcamp album URL
fetchart: trying source filesystem for album Omnia - Alive!
fetchart: using well-named art file front.png
fetchart: image size: (2000, 2000)
fetchart: image needs rescaling (2000 > 1600)
fetchart: image needs reformatting: PNG -> JPEG
fetchart: using local image D:\Downloads\soulseektemp\Omnia\2007 - Alive! [FLAC]\front.png
artresizer: ImageMagick resizing D:\Downloads\soulseektemp\Omnia\2007 - Alive! [FLAC]\front.png to C:\Users\TINBAP~1\AppData\Local\Temp\tmpy62i2_si.png
lyrics: Received unusual song page html

[...]

embedart: Resizing album art to 1200 pixels wide and encoding at quality               level 0
artresizer: ImageMagick resizing \\?\D:\Downloads\beets\Omnia\2007 - Alive!\cover.png to C:\Users\TINBAP~1\AppData\Local\Temp\tmp469734r0.png
embedart: Embedding album art into Omnia - Alive!
embedart: embedding C:\Users\TINBAP~1\AppData\Local\Temp\tmp469734r0.png

Led to this problem:

Embeded file is still a png, and the folder file is cover.png

Setup

My configuration (output of beet config) is:

directory: D:\Downloads\beets
library: D:\Downloads\beets\musiclibrary.db

import:
    copy: yes
    write: yes
    timid: yes
    languages: fr en jp

artist_credit: yes
per_disc_numbering: yes
original_date: yes

match:
    preferred:
        media: ['CD', 'Digital Media|File']
        original_year: yes

paths:
    default: $albumartist/$year - $album%aunique{}/$disc_and_track - $title
    singleton: Non-Album/$artist/$title
    albumtype:soundtrack: Soundtracks/$album/$track - $title
    albumtype:anime: Anime/[$original_year-$original_month-$original_day] $album/$track - $title
    albumtype:game: Game/[$original_year-$original_month-$original_day] $album/$track - $title
    comp: Various Artists/[$original_year-$original_month-$original_day] $album%aunique{}/$track - $title

musicbrainz:
    extra_tags: [year, catalognum]

plugins: fetchart lyrics embedart inline convert zero ftintitle bandcamp

fetchart: 
    cover_format: JPEG
    minwidth: 800
    maxwidth: 1600
    sources: filesystem coverart itunes amazon albumart fanarttv lastfm google
#    quality: 90

embedart:
    maxwidth: 1200
#    quality: 90

item_fields:
    disc_and_track: u'%2i.%02i' % (disc, track) if disctotal > 1 else u'%02i' % (track)

convert:
    format: aac
    formats: 
        aac:
            command: qaac --ignorelength --threading -q 2 --tvbr 118 --rate keep $source -o $dest
            extension: m4a
    dest: D:\Downloads\beets
    copy_album_art: yes
    embed: yes
    auto: yes
    never_convert_lossy_files: yes

zero:
    auto: yes
    fields: albumartist_sort composer_sort artist_sort original_month original_day

ftintitle:
    auto: yes

bandcamp:
    art: yes
    genre:
        maximum: 1

lyrics:
    auto: true,
    sources: google genius musixmatch
wisp3rwind commented 2 years ago

The issue is that fetchart gained the downsize/deinterlace/reformat options, but the ArtResizerdispatcher doesn't accommodate all combinations of those options properly:

https://github.com/beetbox/beets/blob/e584b043be0acec39b9b214415970c5316cc9282/beetsplug/fetchart.py#L157-L166

See also https://github.com/beetbox/beets/pull/4133#issuecomment-968268133

Happy to review a PR to improve this!