mediathek: Make update-interval configurable
authorJens Georg <mail@jensge.org>
Sun, 23 Jan 2011 15:29:20 +0000 (16:29 +0100)
committerJens Georg <mail@jensge.org>
Thu, 27 Jan 2011 18:09:34 +0000 (19:09 +0100)
data/rygel-default.conf
data/rygel-maemo.conf
doc/man/rygel.conf.xml
src/plugins/mediathek/rygel-mediathek-root-container.vala

index f82299e..5612008 100644 (file)
@@ -93,6 +93,7 @@ title=Audio/Video playback on @HOSTNAME@
 enabled=false
 # List of ids of broadcasts
 rss=508
+update-interval=1800
 
 [GstLaunch]
 enabled=false
index b4311f5..15326eb 100644 (file)
@@ -93,6 +93,7 @@ title=Audio/Video playback on @HOSTNAME@
 enabled=false
 # List of ids of broadcasts
 rss=508
+update-interval=1800
 
 [GstLaunch]
 enabled=false
index 43364d3..b92a9d2 100644 (file)
@@ -270,6 +270,14 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/
           <para>A list of broadcast ids. How to get the broadcast ids from the web site is described in the file README.Mediathek (in german only).</para>
         </listitem>
       </varlistentry>
+      <varlistentry>
+        <term>
+          <option>update-interval</option>
+        </term>
+        <listitem>
+          <para>Time in seconds after which the plugin checks for new content. Default is 1800s (30 minutes). The minimum timeout is 10 minutes.</para>
+        </listitem>
+      </varlistentry>
     </variablelist>
   </refsect1>
   <refsect1>
index 13bdfde..c18543d 100644 (file)
@@ -26,7 +26,7 @@ using Soup;
 public class Rygel.Mediathek.RootContainer : Rygel.SimpleContainer {
     private SessionAsync session;
     private static RootContainer instance;
-    private static uint UPDATE_TIMEOUT = 1800;
+    private static int DEFAULT_UPDATE_INTERVAL = 1800;
 
     public static RootContainer get_instance () {
         if (RootContainer.instance == null) {
@@ -48,6 +48,7 @@ public class Rygel.Mediathek.RootContainer : Rygel.SimpleContainer {
 
     private void init () {
         Gee.ArrayList<int> feeds = null;
+        int update_interval = DEFAULT_UPDATE_INTERVAL;
 
         var config = Rygel.MetaConfig.get_default ();
         try {
@@ -61,11 +62,20 @@ public class Rygel.Mediathek.RootContainer : Rygel.SimpleContainer {
             feeds.add (508);
         }
 
+        try {
+            update_interval = config.get_int ("ZDFMediathek",
+                                              "update-interval",
+                                              600,
+                                              int.MAX);
+        } catch (Error error) {
+            update_interval = DEFAULT_UPDATE_INTERVAL;
+        }
+
         foreach (int id in feeds) {
             this.add_child_container (new RssContainer (this, id));
         }
 
-        Timeout.add_seconds (UPDATE_TIMEOUT, () => {
+        Timeout.add_seconds (update_interval, () => {
             foreach (var child in this.children) {
                 var container = child as RssContainer;