Author: rshortt
Date: Tue Mar  7 15:51:06 2006
New Revision: 8055

Modified:
   trunk/tvserver/bin/freevo-epg

Log:
Update favourites.


Modified: trunk/tvserver/bin/freevo-epg
==============================================================================
--- trunk/tvserver/bin/freevo-epg       (original)
+++ trunk/tvserver/bin/freevo-epg       Tue Mar  7 15:51:06 2006
@@ -53,6 +53,7 @@
 
 # FIXME: create logger objects in conf
 import freevo.conf
+import freevo.ipc
 import freevo.ipc.epg as epg
 
 # get logging object
@@ -61,6 +62,8 @@
 # set log level TODO: get and do this in config
 log.setLevel(logging.DEBUG)
 
+TVSERVER = {'type': 'home-theatre', 'module': 'tvserver'}
+
 
 def update_progress(cur, total):
     n = 0
@@ -72,6 +75,20 @@
         print
 
 
+def updated(result):
+    if result:
+        log.info('updated favorites')
+    else:
+        log.info('unable to update favorites')
+    sys.exit(0)
+
+
+def new_entity(entity):
+    if not entity.matches(TVSERVER):
+        return True
+    entity.rpc('home-theatre.favorite.update', updated).call()
+
+
 if len(sys.argv) > 1:
     if sys.argv[1] == 'update':
         guide = epg.connect()
@@ -112,7 +129,7 @@
 
                 else:
                     log.error('xmltv grabbing failed and returned exit code 
%d.', ec >> 8)
-                    log.error('if you did not change your system, it's likely 
'+
+                    log.error('if you did not change your system, it is likely 
'+
                               'that the site being grabbed did.  You might 
want to try '+
                               'updating your xmltv: http://www.xmltv.org/')
 
@@ -130,14 +147,23 @@
         else:
             log.info('not configured to use xmltv')
 
-                    
 
         if epg.config.use_zap2it == 1:
             guide.update("zap2it", username=str(epg.config.zap2it_username), 
                                    passwd=str(epg.config.zap2it_password))
+
+        else:
+            log.info('not configured to use Zap2it')
+
+ 
+        log.info('connecting to tvserver')
+        mbus = freevo.ipc.Instance()
+        mbus.signals['new-entity'].connect(new_entity)
+        kaa.notifier.OneShotTimer(updated, False).start(2)
+
         kaa.main()
 
-        print 'done'
+        log.info('done')
         sys.exit(0)
 
     elif sys.argv[1] == 'search':


-------------------------------------------------------
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