[rygel] mediathek: Make update-interval configurable



commit 09226459827cdb2bd39a85f05ffbfa91ebf2be14
Author: Jens Georg <mail jensge org>
Date:   Sun Jan 23 16:29:20 2011 +0100

    mediathek: Make update-interval configurable

 data/rygel-default.conf                            |    1 +
 data/rygel-maemo.conf                              |    1 +
 doc/man/rygel.conf.xml                             |    8 ++++++++
 .../mediathek/rygel-mediathek-root-container.vala  |   14 ++++++++++++--
 4 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/data/rygel-default.conf b/data/rygel-default.conf
index f82299e..5612008 100644
--- a/data/rygel-default.conf
+++ b/data/rygel-default.conf
@@ -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
diff --git a/data/rygel-maemo.conf b/data/rygel-maemo.conf
index b4311f5..15326eb 100644
--- a/data/rygel-maemo.conf
+++ b/data/rygel-maemo.conf
@@ -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
diff --git a/doc/man/rygel.conf.xml b/doc/man/rygel.conf.xml
index 43364d3..b92a9d2 100644
--- a/doc/man/rygel.conf.xml
+++ b/doc/man/rygel.conf.xml
@@ -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>
diff --git a/src/plugins/mediathek/rygel-mediathek-root-container.vala b/src/plugins/mediathek/rygel-mediathek-root-container.vala
index 13bdfde..c18543d 100644
--- a/src/plugins/mediathek/rygel-mediathek-root-container.vala
+++ b/src/plugins/mediathek/rygel-mediathek-root-container.vala
@@ -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;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]