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

src/api/api_epg.c
src/dvr/dvr_db.c

index 47a4494c7dfa30c49a2f3db3d35da64197a3a059..0654cad442ff030060a86aaeb9cecd71356d6316 100644 (file)
@@ -185,6 +185,8 @@ api_epg_entry ( epg_broadcast_t *eb, const char *lang, access_t *perm, const cha
     if (ee->age_rating)
       htsmsg_add_u32(m, "ageRating", ee->age_rating);
 
+    if (ee->first_aired)
+      htsmsg_add_s64(m, "first_aired", ee->first_aired);
     if (ee->copyright_year)
       htsmsg_add_u32(m, "copyrightYear", ee->copyright_year);
 
index e9336380e189e38f73fd46db9511155f00761747..81ee381c04f987c57ff7eadfcacd0ec20f62ee9f 100644 (file)
@@ -3342,6 +3342,15 @@ dvr_entry_class_duplicate_get(void *o)
   return de ? &de->de_start : &null;
 }
 
+static const void *
+dvr_entry_class_first_aired_get(void *o)
+{
+  static time_t null = 0;
+  const dvr_entry_t *de = (const dvr_entry_t *)o;
+  return de && de->de_bcast && de->de_bcast->episode ?
+    &de->de_bcast->episode->first_aired : &null;
+}
+
 static const void *
 dvr_entry_class_category_get(void *o)
 {
@@ -3897,6 +3906,14 @@ const idclass_t dvr_entry_class = {
       .get      = dvr_entry_class_duplicate_get,
       .opts     = PO_RDONLY | PO_NOSAVE | PO_ADVANCED,
     },
+    {
+      .type     = PT_TIME,
+      .id       = "first_aired",
+      .name     = N_("First aired"),
+      .desc     = N_("Time when the program was first aired"),
+      .get      = dvr_entry_class_first_aired_get,
+      .opts     = PO_RDONLY | PO_NOSAVE | PO_ADVANCED,
+    },
     {
       .type     = PT_STR,
       .id       = "comment",