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 uses .jpg, extractart uses .jpeg #2254

Closed
tweitzel opened this issue Nov 7, 2016 · 4 comments · Fixed by #2255
Closed

fetchart uses .jpg, extractart uses .jpeg #2254

tweitzel opened this issue Nov 7, 2016 · 4 comments · Fixed by #2255
Labels
bug bugs that are confirmed and actionable

Comments

@tweitzel
Copy link
Contributor

tweitzel commented Nov 7, 2016

The extractart command in the embedart plugin uses the string output of imghdr.what as an extension. That's "jpeg."

ext = imghdr.what(None, h=art)

Meanwhile, over in fetchart, it seems to use the first entry in IMAGE_EXTENSIONS for mime type image/jpeg, which is .jpg.

CONTENT_TYPES = {

To reproduce:

Import something with no art, but has jpeg art in a configured fetchart source.
beet fetchart album
beet embedart album
beet extractart album
now you have cover.jpg and cover.jpeg or sometimes cover.1.jpeg or sometimes cover.1.jpg... it's kind of a big mess and seems weirdly nondeterministic at times.

This is normally harmless, but sometimes results in excessive clutter when re-importing old things.

@sampsyo sampsyo added the bug bugs that are confirmed and actionable label Nov 7, 2016
@sampsyo sampsyo changed the title fetchart uses .jpg, extractart uses .jpeg. fetchart uses .jpg, extractart uses .jpeg Nov 7, 2016
@sampsyo
Copy link
Member

sampsyo commented Nov 7, 2016

Thanks! We should definitely make that consistent.

@nathdwek
Copy link
Member

nathdwek commented Nov 7, 2016

This should be a quick fix. This seems to indicate jpg is the most commonly used extension, so I would advocate for it to be used.

@sampsyo
Copy link
Member

sampsyo commented Nov 7, 2016

Sounds good to me. Staying consistent with fetchart seems more useful than obeying extractart, which is less commonly used.

@nathdwek
Copy link
Member

nathdwek commented Nov 7, 2016

BTW this makes me realize that my fix in #1545 should have targeted this too, but it didn't, and extractart fails on the same types of images for the same reason:

$ beet -l beetsdb.db -d beetsdir/ embedart  -f /f/tmp/beetsdir/ZZ\ Top/Tres\ hombres/only-magic-bytes.jpg
$ beet -l beetsdb.db -d /beetsdir/ extractart 
embedart: Unknown image type in /f/tmp/beetsdir/ZZ Top/Tres hombres/08 La Grange.mp3

I will try to bring all of this under one umbrella while fixing this issue.

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.

3 participants