Author: duncan
Date: Sat Mar  1 06:38:41 2008
New Revision: 10459

Log:
Added a singleton to the record client so there is only one connection
Commented out the coroutine decorators as they are not used at the moment
Removed the old TRUE/FALSE that Twised required


Modified:
   branches/rel-1/freevo/src/tv/record_client.py

Modified: branches/rel-1/freevo/src/tv/record_client.py
==============================================================================
--- branches/rel-1/freevo/src/tv/record_client.py       (original)
+++ branches/rel-1/freevo/src/tv/record_client.py       Sat Mar  1 06:38:41 2008
@@ -40,8 +40,18 @@
 import tv.epg_types
 from util.marmalade import jellyToXML, unjellyFromXML
 
-TRUE  = 1
-FALSE = 0
+# Module variable that contains an initialized RecordClient() object
+_singleton = None
+
+def RecordClientSingleton():
+    global _singleton
+
+    # One-time init
+    if _singleton == None:
+        _singleton = RecordClient()
+
+    return _singleton
+
 
 
 class RecordClientException(Exception):
@@ -95,7 +105,7 @@
             return None
 
 
-    @kaa.coroutine()
+    [EMAIL PROTECTED]()
     def pingCo(self):
         now = time.time()
         print self.timeit(now)+': pingCo started'
@@ -107,7 +117,7 @@
         print self.timeit(now)+': pingCo finished' # we never get here
 
 
-    @kaa.coroutine()
+    [EMAIL PROTECTED]()
     def findNextProgramCo(self, isrecording=False):
         """ """
         now = time.time()
@@ -120,7 +130,7 @@
         print self.timeit(now)+': findNextProgramCo finished'
 
 
-    @kaa.coroutine()
+    [EMAIL PROTECTED]()
     def updateFavoritesScheduleCo(self):
         """ """
         now = time.time()
@@ -133,7 +143,7 @@
         print self.timeit(now)+': updateFavoritesScheduleCo finished'
 
 
-    @kaa.coroutine()
+    [EMAIL PROTECTED]()
     def getNextProgramStart(self):
         """ """
         now = time.time()
@@ -453,7 +463,7 @@
         print 'handler.result=%r\n"%s"' % (result, result)
         raise SystemExit
 
-    rc = RecordClient()
+    rc = RecordClientSingleton()
 
     if len(sys.argv) >= 2:
         function = sys.argv[1].lower()
@@ -568,8 +578,8 @@
             dow="ANY"
             mod="ANY"
             priority=0
-            allowDuplicates=FALSE
-            onlyNew=TRUE
+            allowDuplicates=False
+            onlyNew=True
 
             (result, msg) = 
addEditedFavorite(name,title,channel,dow,mod,priority,allowDuplicates,onlyNew)
             if not result:

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to