]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
iptv auto: add parsing of tvh-epg #EXTINF tag, see commit for all strings, fixes...
authorJaroslav Kysela <perex@perex.cz>
Wed, 3 Feb 2016 13:47:15 +0000 (14:47 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 3 Feb 2016 13:47:15 +0000 (14:47 +0100)
src/input/mpegts.h
src/input/mpegts/iptv/iptv_auto.c

index 11344ac89c670e7799e3397b6305578644361c0a..663b9a6dd06fab411cfefbd430627aeb07152c73 100644 (file)
@@ -384,7 +384,7 @@ enum mpegts_mux_epg_flag
   MM_EPG_ONLY_BULSATCOM_39E,
   MM_EPG_ONLY_PSIP,
 };
-#define MM_EPG_LAST MM_EPG_ONLY_OPENTV_SKY_AUSAT
+#define MM_EPG_LAST MM_EPG_ONLY_PSIP
 
 enum mpegts_mux_ac3_flag
 {
index 727248c7a20562ee986d7d10408f59cb929a95d1..8378f27abfb33119361ee0108c0d538a05b48258 100644 (file)
@@ -33,6 +33,35 @@ typedef struct auto_private {
   gtimer_t        in_auto_timer;
 } auto_private_t;
 
+/*
+ *
+ */
+static int _epgcfg_from_str(const char *str)
+{
+  static struct strtab cfgs[] = {
+    { "0",                 MM_EPG_DISABLE },
+    { "none",              MM_EPG_DISABLE },
+    { "disable",           MM_EPG_DISABLE },
+    { "off",               MM_EPG_DISABLE },
+    { "1",                 MM_EPG_ENABLE },
+    { "all",               MM_EPG_ENABLE },
+    { "enable",            MM_EPG_ENABLE },
+    { "on",                MM_EPG_ENABLE },
+    { "force",             MM_EPG_FORCE },
+    { "eit",               MM_EPG_ONLY_EIT },
+    { "uk_freesat",        MM_EPG_ONLY_UK_FREESAT },
+    { "uk_freeview",       MM_EPG_ONLY_UK_FREEVIEW },
+    { "viasat_baltic",     MM_EPG_ONLY_VIASAT_BALTIC },
+    { "opentv_sky_uk",     MM_EPG_ONLY_OPENTV_SKY_UK },
+    { "opentv_sky_italia", MM_EPG_ONLY_OPENTV_SKY_ITALIA },
+    { "opentv_sky_ausat",  MM_EPG_ONLY_OPENTV_SKY_AUSAT },
+    { "bulsatcom_39e",     MM_EPG_ONLY_BULSATCOM_39E },
+    { "psip",              MM_EPG_ONLY_PSIP },
+    { NULL }
+  };
+  return str ? str2val(str, cfgs) : -1;
+}
+
 /*
  *
  */
@@ -48,7 +77,7 @@ iptv_auto_network_process_m3u_item(iptv_network_t *in,
   mpegts_mux_t *mm;
   iptv_mux_t *im;
   url_t u;
-  int change;
+  int change, epgcfg;
   http_arg_list_t args;
   http_arg_t *ra1, *ra2, *ra2_next;
   htsbuf_queue_t q;
@@ -90,6 +119,7 @@ iptv_auto_network_process_m3u_item(iptv_network_t *in,
     logo = htsmsg_get_str(item, "logo");
 
   epgid = htsmsg_get_str(item, "tvg-id");
+  epgcfg = _epgcfg_from_str(htsmsg_get_str(item, "tvh-epg"));
   tags  = htsmsg_get_str(item, "tvh-tags");
   if (tags) {
     tags = n = strdupa(tags);
@@ -208,6 +238,10 @@ skip_url:
         im->mm_iptv_tags = strdup(tags);
         change = 1;
       }
+      if (epgcfg >= 0 && im->mm_epg != epgcfg) {
+        im->mm_epg = epgcfg;
+        change = 1;
+      }
       if (change)
         idnode_notify_changed(&im->mm_id);
       (*total)++;
@@ -237,6 +271,8 @@ skip_url:
     htsmsg_add_s32(conf, "scan_result", MM_SCAN_OK);
   if (custom[0])
     htsmsg_add_str(conf, "iptv_hdr", custom);
+  if (epgcfg >= 0)
+    htsmsg_add_s32(conf, "epg", epgcfg);
   im = iptv_mux_create0(in, NULL, conf);
   htsmsg_destroy(conf);