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

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

Open
rombat opened this issue Aug 22, 2022 · 1 comment
Open

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

rombat opened this issue Aug 22, 2022 · 1 comment
Labels
bug bugs that are confirmed and actionable

Comments

@rombat
Copy link

rombat commented Aug 22, 2022

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

  • OS: Windows 11
    beets version 1.6.0
    Python version 3.10.6
    plugins: bandcamp, convert, embedart, fetchart, ftintitle, inline, lyrics, zero

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
@rombat rombat changed the title fetchart cover_format does not seem to be working fetchart cover_format does not seem to be working (PNG => JPEG) Aug 22, 2022
@wisp3rwind wisp3rwind added the bug bugs that are confirmed and actionable label Aug 22, 2022
@wisp3rwind
Copy link
Member

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

beets/beetsplug/fetchart.py

Lines 157 to 166 in e584b04

if downscale:
return self.CANDIDATE_DOWNSCALE
elif downsize:
return self.CANDIDATE_DOWNSIZE
elif plugin.deinterlace:
return self.CANDIDATE_DEINTERLACE
elif reformat:
return self.CANDIDATE_REFORMAT
else:
return self.CANDIDATE_EXACT

See also #4133 (comment)

Happy to review a PR to improve this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs that are confirmed and actionable
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants