Author: rshortt
Date: Mon Mar 13 02:24:05 2006
New Revision: 1284

Modified:
   trunk/WIP/epg2/src/server.py

Log:
Keep track of tuner ids on load.


Modified: trunk/WIP/epg2/src/server.py
==============================================================================
--- trunk/WIP/epg2/src/server.py        (original)
+++ trunk/WIP/epg2/src/server.py        Mon Mar 13 02:24:05 2006
@@ -56,7 +56,6 @@
         }
 
         self._clients = []
-        self._tuner_ids = []
         self._db = db
         self._load()
         
@@ -94,6 +93,17 @@
         if len(res):
             self._num_programs = res[0][0]
 
+        self._tuner_ids = []
+        channels = self._db.query(type = "channel")
+        for c in channels:
+            for t in c["tuner_id"]:
+                if t in self._tuner_ids:
+                    log.warning('loading channel %s with tuner_id %s '+\
+                                'allready claimed by another channel',
+                                c["short_name"], t)
+                else:
+                    self._tuner_ids.append(t)
+
 
     def _client_connected(self, client):
         """
@@ -207,14 +217,14 @@
 
             for t in tuner_id:
                 if t not in c2["tuner_id"]:
-                    if t not in self._tuner_ids:
+                    if t in self._tuner_ids:
+                        log.warning('not adding tuner_id %s for channel %s - 
'+\
+                            'it is claimed by another channel', t, short_name)
+                    else:
                         # only add this id if it's not already there and not
                         # claimed by another channel
                         c2["tuner_id"].append(t)
                         self._tuner_ids.append(t)
-                    else:
-                        log.warning('not adding tuner_id %s for channel %s - 
'+\
-                            'it is claimed by another channel', t, short_name)
 
             # TODO: if everything is the same do not update
             self._db.update_object(("channel", c2["id"]),
@@ -222,7 +232,9 @@
                                    long_name = long_name)
             return c2["id"]
 
+        log.debug('self._tuner_ids: %s', self._tuner_ids)
         for t in tuner_id:
+            log.debug('new chan with tuner_id %s', t)
             if t in self._tuner_ids:
                 log.warning('not adding tuner_id %s for channel %s - it is '+\
                             'claimed by another channel', t, short_name)
@@ -331,7 +343,7 @@
         global shutdown_timer
         global _server
 
-        log.debug("clients: %s", len(_server._clients))
+        #log.debug("clients: %s", len(_server._clients))
         if _server and len(_server._clients) > 0:
             shutdown_timer = 5
             return True


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to