write more errors into log-file
authorNabil Hanna <ali@users.schwerkraft.elitedvb.net>
Sun, 31 Jan 2010 11:34:47 +0000 (11:34 +0000)
committerNabil Hanna <ali@users.schwerkraft.elitedvb.net>
Sun, 31 Jan 2010 11:34:47 +0000 (11:34 +0000)
rsdownloader/src/plugin.py

index b3802f0..9ae0b7a 100644 (file)
@@ -33,7 +33,7 @@ from twisted.web.client import getPage
 from urllib2 import Request\r
 from urlparse import urlparse, urlunparse
 from xml.etree.cElementTree import parse\r
-import gettext, re, socket, urllib, urllib2\r
+import gettext, re, socket, sys, urllib, urllib2\r
 \r
 ##############################################################################\r
 \r
@@ -196,8 +196,8 @@ def reconnect(host='fritz.box', port=49000):
                s.connect((host, port))\r
                s.send(http_data)\r
                s.close()\r
-       except:\r
-               pass
+       except:
+               writeLog("Error while reconnecting fritz.Box: " + str(sys.exc_info()))
 
 ##############################################################################
 
@@ -603,8 +603,8 @@ class RS:
                        file_list.sort()\r
                        writeLog("Count of lists: " + str(len(file_list)))\r
                except:\r
-                       file_list = []\r
-                       writeLog("Could not find any list!")
+                       file_list = []
+                       writeLog("Could not find any list: " + str(sys.exc_info()))
                added_downloads = 0\r
                for x in file_list:\r
                        list = path + x\r
@@ -640,6 +640,7 @@ class RS:
                        file_list = listdir(path)\r
                except:\r
                        file_list = []
+                       writeLog("Error while searching for lists: " + str(sys.exc_info()))
                
                finished_downloads = []
                for download in self.downloads:\r
@@ -659,8 +660,8 @@ class RS:
                                        f = open(list, "w")\r
                                        f.write(content)\r
                                        f.close()\r
-                               except:\r
-                                       writeLog("Error while cleaning list %s!"%list)\r
+                               except:
+                                       writeLog("Error while cleaning list %s: %s" % (list, str(sys.exc_info())))\r
                self.startDownloading()\r
 \r
        def removeDownload(self, url):\r
@@ -681,7 +682,8 @@ class RS:
                try:\r
                        file_list = listdir(path)\r
                except:\r
-                       file_list = []\r
+                       file_list = []
+                       writeLog("Error while searching for lists: " + str(sys.exc_info()))\r
                for x in file_list:\r
                        list = path + x\r
                        try:\r
@@ -694,8 +696,8 @@ class RS:
                                f = open(list, "w")\r
                                f.write(content)\r
                                f.close()\r
-                       except:\r
-                               pass\r
+                       except:
+                               writeLog("Error while removing link from list: " + str(sys.exc_info()))\r
 \r
        def clearFinishedDownload(self, url):\r
                idx = 0\r
@@ -1047,7 +1049,7 @@ class UnrarEntry:
                                                break
                                f.close()
                        except:
-                               pass
+                               writeLog("Error while reading rar archive from list: " + str(sys.exc_info()))
                if package:
                        self.package = package
                        if self.password:
@@ -1055,7 +1057,7 @@ class UnrarEntry:
                        else:
                                self.command = "unrar -o+ x %s %s"%(package, config.plugins.RSDownloader.downloads_directory.value)
                else:
-                       writeLog("Error finding rar-archives in list: %s"%self.name)
+                       writeLog("Error finding rar-archives in list: " + self.name)
 
        def startUnrar(self):
                self.working = True
@@ -1071,7 +1073,7 @@ class UnrarEntry:
                        f.write(result)
                        f.close()
                except:
-                       print "[RS Downloader] Result of unrar:",result
+                       print "[RS Downloader] Result of unrar:", result
                self.finishCallback(self.name)
 
        def allDownloaded(self):
@@ -1467,7 +1469,8 @@ class RSMain(ChangedScreen):
                try:\r
                        file_list = listdir(config.plugins.RSDownloader.lists_directory.value)\r
                except:\r
-                       file_list = []\r
+                       file_list = []
+                       writeLog("Error while searching for container files: " + str(sys.exc_info()))\r
                list = []\r
                for file in file_list:\r
                        if file.lower().endswith(".ccf") or file.lower().endswith(".dlc") or file.lower().endswith(".rsdf"):\r
@@ -1491,8 +1494,8 @@ class RSMain(ChangedScreen):
                                                f.write("%s\n"%link)\r
                                        f.close()
                                        remove(file)\r
-                               except:\r
-                                       pass\r
+                               except:
+                                       writeLog("Error while writing list file: " + str(sys.exc_info()))\r
                                self.refreshTimer.stop()\r
                                rapidshare.startDownloading()\r
                                self.updateList()