Re: [PATCH 2/3] tests: added a small test program for local-metadata




On Thu, 27 Jan 2011 12:51:09 +0100, Guillaume Emont <gemont igalia com> wrote:
On 27/01/2011 09:17, Iago Toral wrote:

On Wed, 26 Jan 2011 19:32:27 +0100, Guillaume Emont
<gemont igalia com> wrote:
(...)
+static GrlMedia *
+make_grl_image (const gchar *path)
+{
+  GFile *file;
+  GrlMedia *media;
+  gchar *full_path, *uri;
+
+
+  file = g_file_new_for_path (path);
+
+  media = grl_media_image_new ();
+
+  full_path = g_file_get_path (file);
+  grl_media_set_id (media, full_path);
+  g_free (full_path);
+
+  uri = g_file_get_uri (file);
+  grl_media_set_url (media, uri);
+  g_free (uri);
+
+  return media;
+}


Not that it is very important, but just in case you missed it, you
could've used this instead for creating the media object:

GrlMedia *
grl_media_source_get_media_from_uri_sync (GrlMediaSource *source,
                                          const gchar *uri,
                                          const GList *keys,
                                          GrlMetadataResolutionFlags
flags,
                                          GError **error)

basically, it does the same thing without you having to set the media
id directly in the GrlMedia in the client code.
Hmm, that call needs a GrlMediaSource. I guess I could easily get a hold
of the filesystem source for that, but I'd rather have the test of a
given plugin not depend on another plugin, or even on its existence...

Sure, I think that's reasonable.

Iago


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