We have moved to a new Sailfish OS Forum. Please start new discussions there.
27

Album art in Media Player randomly does not show

asked 2014-02-28 13:23:08 +0200

2Ti gravatar image

updated 2014-07-24 10:10:34 +0200

jiit gravatar image

The media player app very randomly displays some album art but not others. I've been trying to figure out what could be causing this and it would seem to have something to do with the filesize of the folder.jpg file.

I've removed all album art from the .mp3 files' ID3 tags and instead have all cover art as folder.jpg files in the album folder. This still, however, does not display the album art for some albums, but I can't figure out why, some albums are fixed using a smaller file size but not all.

Under my home directory there are ~/.cache/media-art and ~/.cache/tracker directories. Should I clear these caches, if so how do I do that (I'm happy to ssh on to the phone)?

There is a similar question (here) but that deals with FLAC files and is not specifically about album cover art.

UPDATE

After a while, the Media Player started to display both album art images. So I am thinking that this has something to do with the file size of the folder.jpg file. I had only recently changed the file size of the first image, and have now added both the large (~560kB) and the small (~120kB) files. The ~120kB version seems to be working after a while (presumably some cache files need to be updated).

One way to get the media player to update it's cache seems to be deleting a song from the folder, close media player, open media player, close media player, upload song again, open media player.

edit retag flag offensive close delete

Comments

I have found the Media Player to have many faults.
However in my case the Album are is showing correctly, something my N9 never did. I have my album art embedded into the MP3 files as an option on Media Monkey and it works very well. This also means I don't have the album are cluttering my Gallery. An idea to consider?

bockersjv ( 2014-02-28 13:40:13 +0200 )edit

Not so random, but it does not show in the album list if at least one track in it has a different artist.

pycage ( 2014-03-23 21:11:06 +0200 )edit

3 Answers

Sort by » oldest newest most voted
3

answered 2014-03-01 20:32:14 +0200

2Ti gravatar image

updated 2014-06-17 11:46:11 +0200

I think I've figured it out. There are many interacting components here one of which is the Media Player cache. This is generated by a process called tracker and stored in ~/.cache/tracker. The tracker does a whole bunch of other stuff as well, not only generating the Media Player caches.

tracker-control --list-processes gives the following output.

Found 254 PIDs… 
Found process ID 1184 for 'tracker-miner-fs'
Found process ID 1190 for 'tracker-store'

Running tracker-control --hard-reset will

Kill all Tracker processes and remove all databases

So that seems to be what we want. After that run tracker-control --start all to restart all the tracker processes. This should regenerate the Media Player cache (after a bit) and show any changes you've made to the directories under ~/Music (or where ever you keep your music files).

In terms of getting the album art to show here's what I've tried

  • A folder.jpg file in a directory of .mp3 files (works at least for file sizes less than ~700kB)
  • A folder.jpg file in a directory of .m4a files (works at least for file sizes less than ~700kB)
  • Album art embedded into .mp3 files (works).
  • Album art embedded into .m4a files (DOES NOT WORK).
  • Album art embedded into .ogg files (DOES NOT WORK).

I'm guessing that for the .m4a files the tracker is looking for a field called APIC in the file, but for MP4 files the cover art is stored under covr at least under iTunes, there might be other standards as well, I don't know.

edit flag offensive delete publish link more

Comments

Just be aware that as --hard-reset wipes the complete tracker index, tracker will probably have to crawl the whole content of your filesystem (both internal & any uSD card) again. If you have many files and/or many multimedia files, this can take some time.

MartinK ( 2014-03-02 02:49:03 +0200 )edit

@MartinK that's a fair point, there is definitely a lag in the music index coming back up after running the hard reset. This is currently the only way though I know to get media player to refresh its content.

2Ti ( 2014-03-02 03:22:55 +0200 )edit

I have failures of cover.jpg with much smaller files, one being ~360kB. The ones I have that are ~100kB show fine. I've tried poking around in the tracker database but I can't seem to find where it references the pictures.

On the plus side, I've confirmed cases where .flac pictures are shown, but I can find no rhyme or reason; using metaflac --export-picture-to on ones that work and ones that don't, many of both are just 600x600 JPEGs.

keithzg ( 2014-03-21 22:03:25 +0200 )edit

after the latest update i cant get the album art to show up from folder.jpg on the new stuff i added. also resetting tracker with the commands above didn't do anything, everything i had still shows in the media just fine it, and cover art for the new stuff is still missing.

Whippler ( 2014-03-29 19:36:44 +0200 )edit

thanks a lot 2Ti, works just fine for me!

lunatix ( 2014-04-02 10:59:51 +0200 )edit
3

answered 2014-03-21 23:28:15 +0200

keithzg gravatar image

It's also possible to manually add album art, and this doesn't require wiping tracker's index.

Tracker follows the Media Art Storage Spec, which specifies that album art is stored as:

album-md5sum1-md5sum2.jpeg

where the first md5sum is the lowercase, sanitized artist name, and the second is the same for the album title. So for example, the filename for the cover art for the album "Future, And It Doesn't Work + Remixes" by Starscream can be derived with:

coverartfilename=album-$(echo -n "starscream" | md5sum | cut -d ' ' -f 1)-$(echo -n "future, and it doesnt work remixes" | md5sum | cut -d ' ' -f 1).jpeg

which spits out album-3a929676851388eb2360738a17fe053e-0197d66016bfa6620a37f361474d9d44.jpeg

Similarly, the band White Lung whose music on Bandcamp is tagged as "WHITE LUNG" would be derived by md5summing "white lung".

Tracker stores the album art in /home/nemo/.cache/media-art/, either as actual copies or as symbolic links if the album is located on the sdcard (in which case the actual files are in /path/to/album/folder/.mediaartlocal/). So by copying a piece of album art into the /home/nemo/.cache/media-art/ folder with the appropriate filename, you can manually add cover art. It has worked so far for me!

My coding skills are pretty poor, but this does seem like a good case for a simple app (or at least script) that can be pointed at a track and generate from its metadata the right filename and plunk a respective .jpeg in the cache folder, and I might take a stab at that---might be nice sometimes to manually set cover art anyways.

I also haven't checked yet if the Media app supports per-track art (the example that came to my mind, and appears to be cited in the Media Art Storage Spec, is NIN's Ghosts I-IV, where every track has unique art).

edit flag offensive delete publish link more

Comments

damn it's a huge mess, why cant it just read folder.jpg from the album folder anymore o.O just added some music, and the latest update doesnt seem to find the cover art at all.

Whippler ( 2014-03-29 19:10:44 +0200 )edit

"this does seem like a good case for a simple app (or at least script) that can be pointed at a track and generate from its metadata the right filename and plunk a respective .jpeg in the cache folder" Isn't this exactly what tracker is supposed to do here.

Yaniel ( 2014-04-10 20:44:18 +0200 )edit

@Yaniel: You're right, this is exactly what Tracker is supposed to do, it just does a rather poor and inconsistent job of it, unfortunately. And writing a quick script or basic app might be within my abilities (and in fairness, one might want to override or manually set covers for some reason or another anyways), but debugging Tracker is far beyond me . . .

keithzg ( 2014-04-10 21:56:25 +0200 )edit

What about albums with various artists? Which name should I choose for the first md5sum? And where can I check wich name I should choose for the first md5sum?

Alex ( 2014-04-24 20:26:47 +0200 )edit

@Alex: For albums with various artists, it appears that tracker realizes that the same coverart and album name is being used, and simply symlinks every subsequent instance to that. So each artist needs their own album-artistMD5-albumMD5.jpeg but quite reasonably it's merely a symlink to the first one actually indexed.

For example, I have an album called National Parks Project, and every single song is by a different set of artists, so of the 20 filenames for it in ~/.cache/media-art, one is an actual jpeg and the other 19 are symbolic links to it.

keithzg ( 2014-04-25 22:34:00 +0200 )edit
0

answered 2015-09-15 23:02:55 +0200

coolman gravatar image

updated 2015-09-15 23:03:52 +0200

This (more workaround than) solution should work on Mac / iTunes combination with Jolla m4a files based on this source. It requires the mp4v2 (tools) to be installed – install with MacPorts or any other install method you prefer.

This shell script extracts all the album cover available inside the mp4 music files and puts them into the folder media-art which could finally be transferred to the jolla phone.

recurse() gets all m4a files inside the iTunes directory of current user. create() extracts the cover art (if one exists) and saves it with the required filename of album-artist’s md5-album’s md5.

Before the md5 sums were made, the artist and the album names are “simplified”: To lower case, deleting parenthesis including there inner content, eliminating longer than single spaces, removing some unwanted character and final the translation of utf-8 to non-combined, compatibility form (NFKD).

Please have a look to the previous discussions to get the right understanding about the missed functionality of the Jolla and the requirements of a possible fix.

#!/bin/bash

normalize() {
 norm=$(echo -n "$1" | sed -e s/'([^)]*)'/''/g | sed -e s/'\s{2,}'/' '/g | tr -d '\046''\047''\057' | iconv -f utf-8 -t utf-8-mac)
 echo -n $norm
}

create() {
 artist=$(normalize "$(mp4info "$1" | egrep "^ Artist:" | cut -c10- | tr '[:upper:]' '[:lower:]')")
 album=$(normalize "$(mp4info "$1" | egrep "^ Album:" | cut -c9- | tr '[:upper:]' '[:lower:]')")
 coverartfilename=album-$(echo -n $artist | md5)-$(echo -n $album | md5).jpeg
 echo $artist: $album
 echo $coverartfilename
 cp "$1" media-art/music.mp4
 mp4art --extract media-art/music.mp4
 if [ -f media-art/music.art[0].jpg ]; then
  mv media-art/music.art[0].jpg media-art/$coverartfilename
 fi
}

recurse() {
 for i in "$1"/*;do
  if [ -d "$i" ];then
    recurse "$i"
   elif [ -f "$i" ]; then
    if [[ $i == *.m4a ]]; then
     create "$i"
    fi
   fi
 done
}

itunes=~/Music/iTunes
if test -d media-art; then
 rm media-art/*.jpeg
else
 mkdir media-art
fi
recurse $itunes
rm media-art/music.mp4
edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
9 followers

Stats

Asked: 2014-02-28 13:23:08 +0200

Seen: 4,422 times

Last updated: Sep 15 '15