]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
dvr: Send credits, category and keywords to UI for DVR (#4594).
authorE.Smith <31170571+azlm8t@users.noreply.github.com>
Sun, 19 Nov 2017 11:17:13 +0000 (11:17 +0000)
committerJaroslav Kysela <perex@perex.cz>
Thu, 23 Nov 2017 08:00:38 +0000 (09:00 +0100)
Issue: #4594.

src/dvr/dvr_db.c

index fdc07da41dee5a10f9748a6ac4763029c37bf195..e9336380e189e38f73fd46db9511155f00761747 100644 (file)
@@ -36,6 +36,7 @@
 #include "access.h"
 #include "notify.h"
 #include "compat.h"
+#include "string_list.h"
 
 struct dvr_entry_list dvrentries;
 static int dvr_in_init;
@@ -3341,6 +3342,45 @@ dvr_entry_class_duplicate_get(void *o)
   return de ? &de->de_start : &null;
 }
 
+static const void *
+dvr_entry_class_category_get(void *o)
+{
+  const dvr_entry_t *de = (dvr_entry_t *)o;
+  htsmsg_t *l;
+  if (de->de_bcast && de->de_bcast->category) {
+    l = string_list_to_htsmsg(de->de_bcast->category);
+  } else {
+    l = htsmsg_create_list();
+  }
+  return l;
+}
+
+static const void *
+dvr_entry_class_credits_get(void *o)
+{
+  const dvr_entry_t *de = (dvr_entry_t *)o;
+  htsmsg_t *l;
+  if (de->de_bcast && de->de_bcast->credits) {
+    l = htsmsg_copy(de->de_bcast->credits);
+  } else {
+    l = htsmsg_create_map();
+  }
+  return l;
+}
+
+static const void *
+dvr_entry_class_keyword_get(void *o)
+{
+  const dvr_entry_t *de = (dvr_entry_t *)o;
+  htsmsg_t *l;
+  if (de->de_bcast && de->de_bcast->keyword) {
+    l = string_list_to_htsmsg(de->de_bcast->keyword);
+  } else {
+    l = htsmsg_create_list();
+  }
+  return l;
+}
+
 htsmsg_t *
 dvr_entry_class_duration_list(void *o, const char *not_set, int max, int step, const char *lang)
 {
@@ -3864,6 +3904,33 @@ const idclass_t dvr_entry_class = {
       .desc     = N_("Free-form text field, enter whatever you like here."),
       .off      = offsetof(dvr_entry_t, de_comment),
     },
+    {
+      .type     = PT_STR,
+      .islist   = 1,
+      .id       = "category",
+      .name     = N_("Category"),
+      .desc     = N_("Extra categories, typically from xmltv"),
+      .get      = dvr_entry_class_category_get,
+      .opts     = PO_RDONLY | PO_NOSAVE | PO_NOUI
+    },
+    {
+      .type     = PT_STR,
+      .islist   = 1,
+      .id       = "credits",
+      .name     = N_("Credits"),
+      .desc     = N_("Credits such as cast members"),
+      .get      = dvr_entry_class_credits_get,
+      .opts     = PO_RDONLY | PO_NOSAVE | PO_NOUI
+    },
+    {
+      .type     = PT_STR,
+      .islist   = 1,
+      .id       = "keyword",
+      .name     = N_("Keyword"),
+      .desc     = N_("Extra keywords, typically from xmltv"),
+      .get      = dvr_entry_class_keyword_get,
+      .opts     = PO_RDONLY | PO_NOSAVE | PO_NOUI
+    },
     {}
   }
 };