[grilo-plugins] tmdb: Also report the TMDB ID in 'tmdb-id'



commit ab31ae4654d265d44458a5929fd9d45caa269086
Author: Mathias Hasselmann <mathias openismus com>
Date:   Tue Oct 16 18:17:09 2012 +0200

    tmdb: Also report the TMDB ID in 'tmdb-id'

 src/tmdb/grl-tmdb.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/tmdb/grl-tmdb.c b/src/tmdb/grl-tmdb.c
index 60862ad..8f2c05d 100644
--- a/src/tmdb/grl-tmdb.c
+++ b/src/tmdb/grl-tmdb.c
@@ -54,6 +54,7 @@ enum {
 static GrlKeyID GRL_TMDB_METADATA_KEY_BACKDROPS = GRL_METADATA_KEY_INVALID;
 static GrlKeyID GRL_TMDB_METADATA_KEY_POSTERS = GRL_METADATA_KEY_INVALID;
 static GrlKeyID GRL_TMDB_METADATA_KEY_IMDB_ID = GRL_METADATA_KEY_INVALID;
+static GrlKeyID GRL_TMDB_METADATA_KEY_TMDB_ID = GRL_METADATA_KEY_INVALID;
 static GrlKeyID GRL_TMDB_METADATA_KEY_KEYWORDS = GRL_METADATA_KEY_INVALID;
 static GrlKeyID GRL_TMDB_METADATA_KEY_PERFORMER = GRL_METADATA_KEY_INVALID;
 static GrlKeyID GRL_TMDB_METADATA_KEY_PRODUCER = GRL_METADATA_KEY_INVALID;
@@ -162,6 +163,12 @@ grl_tmdb_source_plugin_init (GrlRegistry *registry,
                            "tmdb-imdb-id",
                            "ID of this movie at imdb.org");
 
+  GRL_TMDB_METADATA_KEY_TMDB_ID =
+    register_metadata_key (registry,
+                           "tmdb-id",
+                           "tmdb-id",
+                           "ID of this movie at tmdb.org");
+
   GRL_TMDB_METADATA_KEY_KEYWORDS =
     register_metadata_key (registry,
                            "tmdb-keywords",
@@ -272,6 +279,8 @@ grl_tmdb_source_init (GrlTmdbSource *self)
                     GINT_TO_POINTER (GRL_TMDB_METADATA_KEY_POSTERS));
   g_hash_table_add (self->priv->supported_keys,
                     GINT_TO_POINTER (GRL_METADATA_KEY_PUBLICATION_DATE));
+  g_hash_table_add (self->priv->supported_keys,
+                    GINT_TO_POINTER (GRL_TMDB_METADATA_KEY_TMDB_ID));
 
   /* Slow keys */
   g_hash_table_add (self->priv->slow_keys,
@@ -829,6 +838,15 @@ on_search_ready (GObject *source,
     resolve_closure_free (closure);
     return;
   }
+
+  if (SHOULD_RESOLVE (GRL_TMDB_METADATA_KEY_TMDB_ID)) {
+    char *tmdb_id = g_strdup_printf ("%" G_GINT64_FORMAT,
+                                     g_value_get_int64 (value));
+    grl_data_set_string (GRL_DATA (closure->rs->media),
+                         GRL_TMDB_METADATA_KEY_TMDB_ID, tmdb_id);
+    g_free (tmdb_id);
+  }
+
   closure->id = g_value_get_int64 (value);
   g_value_unset (value);
 



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