RE: Problem With File Browsing through Grilo



Thanks. The suggested method works.

However, I may not be use it in my application. The constraint here is that I need to know the uri of every media file. I just know which folder the media files reside in. it will be time consuming to get all uris through gnome-vfs and then use these APIs (grl_media_source_test_media_from_uri() and grl_media_source_get_media_from_uri() )

Using grl_media_source_browse/grl_media_source_browse_async gives all the media files that are available in that container along with their metadata. But this needs the container ID. So we are back to the same problem again. What GrlMedia container needs to be specified to use grl_media_source_browse/grl_media_source_browse_async with tracker plugin?

-----Original Message-----
From: Juan A. Suarez Romero [mailto:jasuarez igalia com]
Sent: Wednesday, 13. June 2012 9:03 PM
To: Rakesh Dhanya (RBEI/ECP2)
Cc: grilo-list gnome org
Subject: Re: Problem With File Browsing through Grilo

On Wed, 2012-06-13 at 23:08 +0800, Rakesh Dhanya (RBEI/ECP2) wrote:
> Am I doing something wrong in my code?. I have attached the code once
> again.

I guess so, unless your code is actually a pseudo-code :)

This the "offending" line:

 GList *mediaList = grl_media_source_browse_sync (GRL_MEDIA_SOURCE
(source), media_from_id("<Path to Media Files >"), keys, 0, 10,
GRL_RESOLVE_IDLE_RELAY | GRL_RESOLVE_FULL, &error);


The key is the media_from_id(): the ID of a media is something defined
by the plugin, and thus it isn't the URI or the path to the media file.
Granted, in the case of grl-filesystem, it turns out that the ID ==
path. But not in other sources. And could be that in future
grl-filesystem changes the way it creates IDs, so I wouldn't rely on
this assumption.


So, what is the correct way of doing it: using
grl_media_source_test_media_from_uri() and
grl_media_source_get_media_from_uri()

In the first, case you invoke it with a source and an uri (it must be
uri, like file:///home/myhome/myfile.mp3, not a path), and it returns
TRUE if the source can return a Grilo media with that URI. If so, you
can use  grl_media_source_get_media_from_uri(): it works similar to
grl_media_source_metadata() but you pass an URI instead of a GrlMedia.

Note also that not all plugins implement it: use
grl_metadata_source_supported_operations() to check if
GRL_OP_MEDIA_FROM_URI is implemented.

Checking both Tracker and Filesystem plugin, seems that only the later
is implementing it. If you really need it for Tracker, I suggest to file
a bug.

Hope this helps you.

        J.A.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]