Hi again!

On Friday 29 September 2006 08:25, Duncan Webb wrote:
> The mail included tv_grab_failure_153 patch, what does this do?

Oh, that's a good one, too: It adds error handling to the tv_grab helper, 
simply telling the user that xmltv failed instead of silently failing.  IIRC, 
this was also accepted for the unstable branch, but not committed to the 
stable back then.

> I can't see the lirc_suspend.diff patch in the mail.

Oh, I attached it this time. ;-)

-- 
Ciao, /  /                                                    .o.
     /--/                                                     ..o
    /  / ANS                                                  ooo
Index: src/rc.py
===================================================================
--- src/rc.py	(Revision 8248)
+++ src/rc.py	(Arbeitskopie)
@@ -161,22 +161,22 @@
     """
     def __init__(self):
         try:
+            global pylirc
             import pylirc
         except ImportError:
             print 'WARNING: PyLirc not found, lirc remote control disabled!'
-            raise Exception
+            raise
         try:
             if os.path.isfile(config.LIRCRC):
-                pylirc.init('freevo', config.LIRCRC)
-                pylirc.blocking(0)
+                self.resume()
             else:
                 raise IOError
         except RuntimeError:
             print 'WARNING: Could not initialize PyLirc!'
-            raise Exception
+            raise
         except IOError:
             print 'WARNING: %s not found!' % config.LIRCRC
-            raise Exception
+            raise
 
         self.nextcode = pylirc.nextcode
 
@@ -193,6 +193,21 @@
         PYLIRC = True
 
         
+    def resume(self):
+        """
+        (re-)initialize pylirc, e.g. after calling close()
+        """
+        pylirc.init('freevo', config.LIRCRC)
+        pylirc.blocking(0)
+
+
+    def suspend(self):
+        """
+        cleanup pylirc, close devices
+        """
+        pylirc.exit()
+
+
     def get_last_code(self):
         """
         read the lirc interface
@@ -443,6 +458,18 @@
         self.lock.release()
 
         
+    def suspend(self):
+        for i in self.inputs:
+            if hasattr(i, 'suspend'):
+                i.suspend()
+
+
+    def resume(self):
+        for i in self.inputs:
+            if hasattr(i, 'resume'):
+                i.resume()
+
+
     def shutdown(self):
         """
         shutdown the rc
@@ -498,10 +525,15 @@
         # search for events in the queue
         if len(self.queue):
             self.lock.acquire()
-            ret = self.queue[0]
-            del self.queue[0]
-            self.lock.release()
-            return ret
+            try:
+                try:
+                    ret = self.queue[0]
+                    del self.queue[0]
+                    return ret
+                except IndexError:
+                    pass
+            finally:
+                self.lock.release()
 
         # search all input objects for new events
         for i in self.inputs:

Attachment: pgpHuexkpM0Ic.pgp
Description: PGP signature

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to