Bug 470529 - "cover.jpg" file not recognized for use as album art
Summary: "cover.jpg" file not recognized for use as album art
Status: RESOLVED FIXED
Alias: None
Product: Elisa
Classification: Applications
Component: general (show other bugs)
Version: 23.04.1
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Matthieu Gallien
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-01 16:45 UTC by paninomaninodesu
Modified: 2023-06-27 19:54 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
attachment-1574308-0.html (1.45 KB, text/html)
2023-06-26 20:25 UTC, Jack Hill
Details

Note You need to log in before you can comment on or make changes to this bug.
Description paninomaninodesu 2023-06-01 16:45:44 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Create album with music files and a jpg named "cover"
2. Open Elisa and catalog the new folder
3. 

OBSERVED RESULT
Elisa recognizes the folder and the music files inside it, but the interface doesn't show a cover art.

EXPECTED RESULT
Elisa's interface would show the cover art of the album using the "cover.jpg" inside the folder.
I thought this was the standard behavior for music players, most music players I tested have this behavior, but not Elisa it seems.
Would be good if this little feature could be added to Elisa, would make having cover art for all albums very simple.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Neon
(available in About System)
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.106.0
Qt Version: 5.15.9

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2023-06-05 16:34:12 UTC
Elisa does already do this. I guess that means something about it isn't working for you. Can you attach a screenshot of the folder contents for the album in question that shows the song files and also the cover art file?
Comment 2 paninomaninodesu 2023-06-07 23:24:56 UTC
(In reply to Nate Graham from comment #1)
> Elisa does already do this. I guess that means something about it isn't
> working for you. Can you attach a screenshot of the folder contents for the
> album in question that shows the song files and also the cover art file?

You're right, Elisa already does this, just not in the way I was expecting.
Problem is, apparently Elisa does not accept jpg images to use as cover album. I discovery this when I accidentally put a png inside a folder and Elisa picked that png as cover... which lead to another problem. Once Elisa picks an image as cover album you can't change the image? When I removed the wrong png image and substituted it with another png image that I wanted to use, Elisa did nothing. The album was stuck with the wrong cover art.
I insisted and restarted Elisa database rescaning everything, but Elisa still didn't updated the album art for on that folder.
Finally today I got Elisa to change the album art to the one I wanted, that's why I'm back, but still... I don't understand how Elisa works.

There were another images on that folder, scans related to the CD case.
One of them was the original wrong image that Elisa picked when I made a copy, converted from jpg to png and renamed it "cover". The name of that image is "Case Cover Back Inner". Now, I named it to "Case Cover Back Inner 2" and made a copy of image I wanted to use and renamed it to "Case Cover Back Inner". This worked.
Why? Why didn't Elisa used a image with that name before?
I removed the new "Case Cover Back Inner" image to make use Elisa didn't had picked the other identical "cover.png" inside the folder, but this made the album art vanish. I put the new "Case Cover Back Inner" back inside the folder and the album art came back.

It's not clear what pattern Elisa follows to select the album art that you manually puts inside the folders. Will Elisa refuse to use imagens simply name "cover" again if there are other imagens inside the folder? I hope this is a one off "bug" (is it a bug? No idea).
Comment 3 Jack Hill 2023-06-16 11:07:39 UTC
When you say that the file name was "Case Cover Back Inner", did this have a jpg or png file extension?

If it was .jpg, then I think the problem is that Elisa scans images with the glob "*[Cc]over*.jpg". So if you had the files "Case Cover Back Inner.jpg" and "cover.jpg" then the first match would be "Case Cover Back Inner.jpg", and so Elisa would use that as the cover image.
Comment 4 Bug Janitor Service 2023-06-16 11:45:57 UTC
A possibly relevant merge request was started @ https://invent.kde.org/multimedia/elisa/-/merge_requests/468
Comment 5 Bug Janitor Service 2023-06-16 11:45:59 UTC
A possibly relevant merge request was started @ https://invent.kde.org/multimedia/elisa/-/merge_requests/468
Comment 6 paninomaninodesu 2023-06-26 20:07:56 UTC
(In reply to Jack Hill from comment #3)
> When you say that the file name was "Case Cover Back Inner", did this have a
> jpg or png file extension?
> 
> If it was .jpg, then I think the problem is that Elisa scans images with the
> glob "*[Cc]over*.jpg". So if you had the files "Case Cover Back Inner.jpg"
> and "cover.jpg" then the first match would be "Case Cover Back Inner.jpg",
> and so Elisa would use that as the cover image.

This explains a lot...
How would I know.

So it's not a "bug", it's just that the way Elisa works internally is "obscure"?
Comment 7 Jack Hill 2023-06-26 20:25:38 UTC
Created attachment 159921 [details]
attachment-1574308-0.html

I think this behaviour is not what people expect, so I would call it a bug. I have submitted a merge request (which is linked in this bug report) so the issue should be fixed shortly.

On 26 June 2023 21:07:56 BST, bugzilla_noreply@kde.org wrote:
>https://bugs.kde.org/show_bug.cgi?id=470529
>
>--- Comment #6 from paninomaninodesu@gmail.com ---
>(In reply to Jack Hill from comment #3)
>> When you say that the file name was "Case Cover Back Inner", did this have a
>> jpg or png file extension?
>> 
>> If it was .jpg, then I think the problem is that Elisa scans images with the
>> glob "*[Cc]over*.jpg". So if you had the files "Case Cover Back Inner.jpg"
>> and "cover.jpg" then the first match would be "Case Cover Back Inner.jpg",
>> and so Elisa would use that as the cover image.
>
>This explains a lot...
>How would I know.
>
>So it's not a "bug", it's just that the way Elisa works internally is
>"obscure"?
>
>-- 
>You are receiving this mail because:
>You are on the CC list for the bug.
Comment 8 Nate Graham 2023-06-27 19:54:59 UTC
Git commit a0983ce9fa429603683f5c2dc1a892f9e2894742 by Nate Graham, on behalf of Jack Hill.
Committed on 27/06/2023 at 19:38.
Pushed by ngraham into branch 'master'.

Prioritise exact string match when searching for cover files

Previously we would search for globs like "*cover*", which would rank "case
cover back inner.jpg" higher than "cover.jpg". Now we set exact matches
to "cover", "coverimage", "folder", and "albumart" to the highest priority.

A  +-    --    autotests/data/cover_art/artist1/album3/abc_folder.jpg
A  +3    -0    autotests/data/cover_art/artist1/album3/abc_folder.jpg.license
M  +6    -1    autotests/filescannertest.cpp
M  +14   -0    src/filescanner.cpp

https://invent.kde.org/multimedia/elisa/-/commit/a0983ce9fa429603683f5c2dc1a892f9e2894742