[grilo-plugins] thetvdb: Force updating the show name



commit aa4e59325e056781d413d3e173cc290788157cdb
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Dec 2 17:17:49 2015 +0100

    thetvdb: Force updating the show name
    
    TheTVDB has localised show names, and will correct any missing
    punctuation and casing that might be lost parsing filenames.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=758959

 src/thetvdb/grl-thetvdb.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/thetvdb/grl-thetvdb.c b/src/thetvdb/grl-thetvdb.c
index a42fd59..414c678 100644
--- a/src/thetvdb/grl-thetvdb.c
+++ b/src/thetvdb/grl-thetvdb.c
@@ -345,7 +345,8 @@ grl_thetvdb_source_init (GrlTheTVDBSource *source)
 
   /* All supported keys in a GList */
   source->priv->supported_keys =
-    grl_metadata_key_list_new (GRL_METADATA_KEY_SEASON,
+    grl_metadata_key_list_new (GRL_METADATA_KEY_SHOW,
+                               GRL_METADATA_KEY_SEASON,
                                GRL_METADATA_KEY_EPISODE,
                                GRL_METADATA_KEY_GENRE,
                                GRL_METADATA_KEY_PERFORMER,
@@ -840,6 +841,7 @@ thetvdb_update_media_from_resources (GrlMediaVideo *video,
 {
   gint failed_keys = 0;
   GList *it;
+  gchar *str = NULL;
 
   if (sres == NULL)
     return;
@@ -847,7 +849,6 @@ thetvdb_update_media_from_resources (GrlMediaVideo *video,
   for (it = keys; it != NULL; it = it->next) {
     GrlKeyID key_id = GRLPOINTER_TO_KEYID (it->data);
     gint num = -1;
-    gchar *str = NULL;
 
     switch (key_id) {
     case GRL_METADATA_KEY_SEASON:
@@ -1046,6 +1047,14 @@ thetvdb_update_media_from_resources (GrlMediaVideo *video,
     }
   }
 
+  /* Always set the series/show name */
+  str = NULL;
+  g_object_get (sres, SERIES_COLUMN_SERIES_NAME, &str, NULL);
+  if (str != NULL) {
+    grl_media_video_set_show (video, str);
+    g_free (str);
+  }
+
   if (failed_keys == g_list_length (keys)) {
     GRL_DEBUG ("Couldn't resolve requested keys for %s",
                grl_media_video_get_show (video));


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