]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Minor correction to the handling of content types in DVR auto rec table.
authorAdam Sutton <dev@adamsutton.me.uk>
Fri, 6 Jul 2012 13:18:12 +0000 (14:18 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Mon, 30 Jul 2012 12:34:23 +0000 (13:34 +0100)
src/dvr/dvr_autorec.c

index 60829d88e311a16fc4c0a87eb30d3aac1b80371d..3269d9966a3517ec8648b52ab923beb06d068a00 100644 (file)
@@ -222,6 +222,7 @@ build_weekday_mask(const char *str)
 static htsmsg_t *
 autorec_record_build(dvr_autorec_entry_t *dae)
 {
+  const char *s;
   char str[30];
   htsmsg_t *e = htsmsg_create_map();
 
@@ -241,7 +242,11 @@ autorec_record_build(dvr_autorec_entry_t *dae)
   if(dae->dae_channel_tag != NULL)
     htsmsg_add_str(e, "tag", dae->dae_channel_tag->ct_name);
 
+  // Note: Mixed usage creates problems, for now we have to store
+  //       both values!
   htsmsg_add_u32(e, "contenttype",dae->dae_content_type);
+  if ((s = epg_content_group_get_name(dae->dae_content_type)))
+    htsmsg_add_str(e, "contentgrp", s);
 
   htsmsg_add_str(e, "title", dae->dae_title ?: "");
 
@@ -349,7 +354,15 @@ autorec_record_update(void *opaque, const char *id, htsmsg_t *values,
     }
   }
 
-  dae->dae_content_type = htsmsg_get_u32_or_default(values, "contenttype", 0);
+  // Note: unfortunately there is a mixed usage here, DVR code uses
+  // contenttype however UI code uses contentgrp. so we test for both!
+  if (htsmsg_get_u32(values, "contenttype", &u32)) {
+    if ((s = htsmsg_get_str(values, "contentgrp")))
+      u32 = epg_content_group_find_by_name(s);
+    else
+      u32 = 0;
+  }
+  dae->dae_content_type = u32;
 
   if((s = htsmsg_get_str(values, "approx_time")) != NULL) {
     if(strchr(s, ':') != NULL) {