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]