After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 734636 - Tracker plugin doesn't get thumbnails
Tracker plugin doesn't get thumbnails
Status: RESOLVED FIXED
Product: grilo
Classification: Other
Component: plugins
git master
Other Linux
: Normal normal
: ---
Assigned To: grilo-maint
grilo-maint
Depends on:
Blocks:
 
 
Reported: 2014-08-12 01:40 UTC by Jeremy Whiting
Modified: 2014-08-15 21:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add thumbnail url to GrlMedia objects gotten with g_file_query_info. (2.62 KB, patch)
2014-08-12 01:40 UTC, Jeremy Whiting
rejected Details | Review
Ask libmediaart for thumbnails from both cache and local paths (1.47 KB, patch)
2014-08-14 17:30 UTC, Jeremy Whiting
needs-work Details | Review
Updated to fix leak (1.54 KB, patch)
2014-08-14 17:55 UTC, Jeremy Whiting
needs-work Details | Review
initialize strings to NULL (1.63 KB, patch)
2014-08-15 16:45 UTC, Jeremy Whiting
accepted-commit_now Details | Review
use GRL_DEBUG (1.63 KB, patch)
2014-08-15 17:56 UTC, Jeremy Whiting
committed Details | Review

Description Jeremy Whiting 2014-08-12 01:40:11 UTC
Created attachment 283150 [details] [review]
Add thumbnail url to GrlMedia objects gotten with g_file_query_info.

Grl-tracker plugin doesn't add thumbnail information to GrlMedia objects given in browse or search operations, since tracker doesn't store that (but tracker-needle displays thumbnails by using g_file_query_info).

The attached patch adds thumbnail information and works in my testing, but it could definitely use a good review.
Comment 1 Bastien Nocera 2014-08-12 07:31:26 UTC
Review of attachment 283150 [details] [review]:

2 problems:
1) This is making a blocking call, urgh
2) You should use the local-metadata plugin to request additional file-based metadata. That's how grilo's metadata system works.
Comment 2 Jeremy Whiting 2014-08-12 20:13:12 UTC
1) Yes I realize I should have used the async call for getting the file info.
2) Looking at the local-metadata plugin I see it doesn't do search or browse operations at all, but only resolve? So in order to get a list of media from grilo applications should do the following:

Search and/or Browse to get a list of GrlMedia
Resolve also, to make sure we have all known information about the given media.

Is that right?
Comment 3 Bastien Nocera 2014-08-12 20:54:37 UTC
(In reply to comment #2)
> 1) Yes I realize I should have used the async call for getting the file info.
> 2) Looking at the local-metadata plugin I see it doesn't do search or browse
> operations at all, but only resolve? So in order to get a list of media from
> grilo applications should do the following:
> 
> Search and/or Browse to get a list of GrlMedia
> Resolve also, to make sure we have all known information about the given media.
> 
> Is that right?

That's right. This is what Totem does to get thumbnails.
Comment 4 Jeremy Whiting 2014-08-13 21:15:57 UTC
Ok, I figured out how to get resolving to work. However, if tracker indexed an audio file it puts the mediaart into ~/.cache/media-art but grl-local-metadata is only looking for the mediaart in a local file (.mediaartlocal) not in ~/.cache/media-art. I've created a patch that makes it check both, that seems to work fine. Should I attach that here or post it to a new bug ?
Comment 5 Bastien Nocera 2014-08-14 06:54:32 UTC
(In reply to comment #4)
> Ok, I figured out how to get resolving to work. However, if tracker indexed an
> audio file it puts the mediaart into ~/.cache/media-art but grl-local-metadata
> is only looking for the mediaart in a local file (.mediaartlocal) not in
> ~/.cache/media-art. I've created a patch that makes it check both, that seems
> to work fine. Should I attach that here or post it to a new bug ?

local-metadata uses libmediaart, as tracker should. Which version of grilo-plugins are you testing this against?
Comment 6 Jeremy Whiting 2014-08-14 17:29:06 UTC
I'm using grilo-plugins 0.2.12 and libmediaart 0.4.0. I created the grl-local-metadata patch against master though. libmediaart's api lets you ask for a cache_path and a local_path, and grilo-plugins grl-local-metadata was previously only asking for the local_path, so would only get the .mediaartlocal files, nothing in ~/.cache/media-art would appear.  I'll attach the patch here it's pretty small.
Comment 7 Jeremy Whiting 2014-08-14 17:30:37 UTC
Created attachment 283405 [details] [review]
Ask libmediaart for thumbnails from both cache and local paths

Here's the small patch that makes grl-local-metadata resolve thumbnails from both ~/.cache/media-art and .mediaartlocal locations.
Comment 8 Bastien Nocera 2014-08-14 17:32:35 UTC
Review of attachment 283405 [details] [review]:

::: src/local-metadata/grl-local-metadata.c
@@ +647,3 @@
   if (thumbnail_uri) {
     grl_media_set_thumbnail (rs->media, thumbnail_uri);
     g_free (thumbnail_uri);

This leaks when both cache_uri and thumbnail_uri are set.
Comment 9 Bastien Nocera 2014-08-14 17:33:45 UTC
Review of attachment 283405 [details] [review]:

Also, awful API. From reading the API docs, I really thought that path and local_uri were two versions of the same data.
Comment 10 Jeremy Whiting 2014-08-14 17:55:17 UTC
Created attachment 283406 [details] [review]
Updated to fix leak

Yes, the libmediaart api is a bit strange in that regard, I agree. Anyway, this patch fixes the leak.
Comment 11 Bastien Nocera 2014-08-15 08:33:56 UTC
Review of attachment 283406 [details] [review]:

::: src/local-metadata/grl-local-metadata.c
@@ +653,3 @@
   }
+  if (thumbnail_uri)
+    g_free (thumbnail_uri);

g_free() can take a NULL. But you'll need to initialise it to NULL.
Comment 12 Bastien Nocera 2014-08-15 08:36:14 UTC
I filed bug 734837 against libmediaart as well.
Comment 13 Jeremy Whiting 2014-08-15 16:45:44 UTC
Created attachment 283535 [details] [review]
initialize strings to NULL

Updated to initialize the strings to NULL and always call g_free on them. removes two if statements.
Comment 14 Bastien Nocera 2014-08-15 17:51:58 UTC
Review of attachment 283535 [details] [review]:

Looks good, other than that.

::: src/local-metadata/grl-local-metadata.c
@@ +650,3 @@
+    grl_media_set_thumbnail (rs->media, cache_uri);
+  else
+    g_debug ("Found no thumbnail for artist %s and album %s", artist, album);

GRL_DEBUG()
Comment 15 Jeremy Whiting 2014-08-15 17:56:46 UTC
Created attachment 283538 [details] [review]
use GRL_DEBUG

Good catch, feel free to push I don't have git push access.