]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
config: migrate DVR config to stream profiles (v13)
authorJaroslav Kysela <perex@perex.cz>
Thu, 9 Oct 2014 12:30:27 +0000 (14:30 +0200)
committerJaroslav Kysela <perex@perex.cz>
Thu, 9 Oct 2014 12:30:27 +0000 (14:30 +0200)
src/config.c

index ba9f396d8d7a7c59840cb0324b9719a5675b2019..cd5f70324798c459e05b6d28dedd450733b127b8 100644 (file)
@@ -1017,6 +1017,30 @@ config_migrate_v12 ( void )
   }
 }
 
+static void
+config_migrate_v13 ( void )
+{
+  htsmsg_t *c, *e;
+  htsmsg_field_t *f;
+  int i;
+
+  if ((c = hts_settings_load("dvr/config")) != NULL) {
+    HTSMSG_FOREACH(f, c) {
+      if (!(e = htsmsg_field_get_map(f))) continue;
+      if (!htsmsg_get_bool(e, "container", &i)) {
+        htsmsg_delete_field(e, "container");
+        if (i == 1)
+          htsmsg_add_str(e, "profile", "matroska");
+        else if (i == 4)
+          htsmsg_add_str(e, "profile", "pass");
+      }
+      htsmsg_delete_field(e, "rewrite-pat");
+      htsmsg_delete_field(e, "rewrite-pmt");
+      hts_settings_save(e, "dvr/config/%s", f->hmf_name);
+    }
+  }
+}
+
 /*
  * Perform backup
  */
@@ -1117,7 +1141,8 @@ static const config_migrate_t config_migrate_table[] = {
   config_migrate_v9,
   config_migrate_v10,
   config_migrate_v11,
-  config_migrate_v12
+  config_migrate_v12,
+  config_migrate_v13
 };
 
 /*