Re: =?UTF-8?Q?media=5Ffrom=5Fsite=20API?=




On Fri, 03 Dec 2010 12:44:01 +0100, "Juan A. Suarez Romero" <jasuarez igalia com> wrote:

Sorry for being late. I know you have already proposed an
implementation, so forget about this if you think it isn't worth.


When I saw this feature request, I was thinking about a way of doing it
more generic.

So my idea was to have a function similar to grl_media_source_metadata()
to do it.

The API for the proposed function would be

guint
grl_multiple_source_inverse_metadata (const GList *sources,
                                 GrlKeyID *field,
                                 GValue *value,
                                 const GList *keys,
                                 GrlMetadataResolutionFlags flags,
                                 GrlMediaSourceMetadataCb callback,
                                 gpointer user_data);


So for the case of youtube, you'd use GRL_METADATA_KEY_SITE as field and the appropriate value. And it would return in the callback the GrlMedia
already filled with the requested keys.

Each source would register which keys they support for inverse
resolution.

This would allow for future extensions if plugins can resolve medias by
other fields besides the site url.

Anything that makes this more generic and usable is ok with me, but as I always say, we have to be practical and not try to do super-generic stuff that ends up being used for just one case.

The case of the URL conversion is an obvious use case that makes sense. Do you have any examples where other data could be used and the url is not available? If you find good use cases for that I would be willing to go for this version, otherwise, I would postpone the idea until we have specific use cases that we think are reasonable and I would keep it simple for now.

Also, there is another issue, for the case of the url, it is not enough to know if the source supports conversion from the url, you also need to know if the source supports that url in particular (hence that test_media_from_site), probably this is specific for the url case because with other that this check would probably not make sense, so even in the situation of wanting a more generic approach, it could still make sense to have the media_from_site API as a separate option.

Iago


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