summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2010-02-02 22:15:48 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2010-02-02 22:15:48 +0100
commitdc97a68f74dc0966b1df9e8f8231d76ecd9f2673 (patch)
treeba05b6850867bf5033d1fa725a442ba7d325956b /module
parentforgot file (diff)
downloadpyload-dc97a68f74dc0966b1df9e8f8231d76ecd9f2673.tar.xz
some gui fixes, i18n update
Diffstat (limited to 'module')
-rw-r--r--module/download_thread.py50
-rw-r--r--module/file_list.py8
-rw-r--r--module/gui/Collector.py15
-rw-r--r--module/gui/Queue.py11
-rw-r--r--module/gui/connector.py3
-rw-r--r--module/plugins/decrypter/SerienjunkiesOrg.py1
-rw-r--r--module/thread_list.py57
7 files changed, 81 insertions, 64 deletions
diff --git a/module/download_thread.py b/module/download_thread.py
index 65c7e1e23..7c899b185 100644
--- a/module/download_thread.py
+++ b/module/download_thread.py
@@ -1,22 +1,26 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-#
-#Copyright (C) 2009 sp00b, sebnapi
-#
-#This program is free software; you can redistribute it and/or modify
-#it under the terms of the GNU General Public License as published by
-#the Free Software Foundation; either version 3 of the License,
-#or (at your option) any later version.
-#
-#This program is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#See the GNU General Public License for more details.
-#
-#You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-###
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay
+ @author: spoob
+ @author: sebnapi
+ @version: v0.3
+"""
+
import threading
import traceback
from os.path import join
@@ -108,9 +112,9 @@ class Download_Thread(threading.Thread):
code, msg = e
if code == 7:
sleep(60)
- self.parent.parent.logger.info("Hoster unvailable, wait 60 seconds")
+ self.parent.parent.logger.info(_("Hoster unvailable, wait 60 seconds"))
except Exception, f:
- self.parent.parent.logger.debug("Error getting error code: "+ str(f))
+ self.parent.parent.logger.debug(_("Error getting error code: %s") % f)
if self.parent.parent.config['general']['debug_mode']:
traceback.print_exc()
self.loadedPyFile.status.type = "failed"
@@ -156,13 +160,13 @@ class Download_Thread(threading.Thread):
20 - unknown error
"""
if code == 0:
- self.parent.parent.logger.info("Checksum ok ('%s')" % status.filename)
+ self.parent.parent.logger.info(_("Checksum ok ('%s')") % status.filename)
elif code == 1:
- self.parent.parent.logger.info("Checksum not matched! ('%s')" % status.filename)
+ self.parent.parent.logger.info(_("Checksum not matched! ('%s')") % status.filename)
elif code == 5:
- self.parent.parent.logger.debug("Can't get checksum for %s" % status.filename)
+ self.parent.parent.logger.debug(_("Can't get checksum for %s") % status.filename)
elif code == 10:
- self.parent.parent.logger.debug("Checksum not implemented for %s" % status.filename)
+ self.parent.parent.logger.debug(_("Checksum not implemented for %s") % status.filename)
if not check:
raise Checksum(code, location)
diff --git a/module/file_list.py b/module/file_list.py
index b9f70bd27..d251868b9 100644
--- a/module/file_list.py
+++ b/module/file_list.py
@@ -84,11 +84,11 @@ class File_List(object):
self.lock.release()
if len(self.data["collector"]) > 0:
- self.core.logger.info("Found %s links in linkcollector" % len(self.data["collector"]))
+ self.core.logger.info(_("Found %s links in linkcollector") % len(self.data["collector"]))
if len(self.data["packages"]) > 0:
- self.core.logger.info("Found %s unqueued packages" % len(self.data["packages"]))
+ self.core.logger.info(_("Found %s unqueued packages") % len(self.data["packages"]))
if len(self.data["queue"]) > 0:
- self.core.logger.info("Added %s packages to queue" % len(self.data["queue"]))
+ self.core.logger.info(_("Added %s packages to queue") % len(self.data["queue"]))
def save(self):
self.lock.acquire()
@@ -298,8 +298,6 @@ class File_List(object):
pyfile.plugin.req.abort = True
sleep(0.1)
del packager.file_list.data[key][n]
- if key == "packages":
- key = "collector"
packager.file_list.core.pullManager.addEvent(RemoveEvent("pack", id, key))
finally:
packager.file_list.lock.release()
diff --git a/module/gui/Collector.py b/module/gui/Collector.py
index c0754aa42..ebdbd372d 100644
--- a/module/gui/Collector.py
+++ b/module/gui/Collector.py
@@ -66,12 +66,12 @@ class PackageCollector(QObject):
for pack in ItemIterator(self.rootItem):
for k, child in enumerate(pack.getChildren()):
if child.getFileData()["id"] == event[3]:
- pack.takeChild(k)
+ pack.removeChild(child)
break
else:
for k, pack in enumerate(ItemIterator(self.rootItem)):
if pack.getPackData()["id"] == event[3]:
- self.rootItem.takeChild(k)
+ self.rootItem.removeChild(pack)
break
def insertEvent(self, event):
@@ -99,6 +99,8 @@ class PackageCollector(QObject):
def updateEvent(self, event):
if event[2] == "file":
info = self.connector.getLinkInfo(event[3])
+ if not info:
+ return
for pack in ItemIterator(self.rootItem):
if pack.getPackData()["id"] == info["package"]:
child = pack.getChild(event[3])
@@ -145,7 +147,7 @@ class PackageCollector(QObject):
def clearAll(self):
for k, pack in enumerate(ItemIterator(self.rootItem)):
if not pack.getPackData()["id"] == "fixed":
- self.rootItem.takeChild(k)
+ self.rootItem.removeChild(pack)
class PackageCollectorPack(QTreeWidgetItem):
def __init__(self, collector):
@@ -238,7 +240,7 @@ class LinkCollector(QObject):
if event[2] == "file":
for k, file in enumerate(ItemIterator(self.rootItem)):
if file.getFileData()["id"] == event[3]:
- self.rootItem.takeChild(k)
+ self.rootItem.removeChild(file)
break
def insertEvent(self, event):
@@ -251,6 +253,8 @@ class LinkCollector(QObject):
def updateEvent(self, event):
if event[2] == "file":
data = self.connector.getLinkInfo(event[3])
+ if not data:
+ return
file = getFile(event[3])
file.setFileData(data)
self.addFile(event[3], file)
@@ -281,7 +285,8 @@ class LinkCollector(QObject):
return None
def clearAll(self):
- self.rootItem.takeChildren()
+ for k, file in enumerate(ItemIterator(self.rootItem)):
+ self.rootItem.removeChild(file)
class LinkCollectorFile(QTreeWidgetItem):
def __init__(self, collector):
diff --git a/module/gui/Queue.py b/module/gui/Queue.py
index 9659137ec..bd45e27dc 100644
--- a/module/gui/Queue.py
+++ b/module/gui/Queue.py
@@ -89,7 +89,6 @@ class Queue(QObject):
self.addPack(pack.getPackData()["id"], pack)
def fullReload(self):
- locker = QMutexLocker(self.mutex)
self.clearAll()
packs = self.connector.getPackageQueue()
for data in packs:
@@ -106,6 +105,7 @@ class Queue(QObject):
self.addPack(data["id"], pack)
def addEvent(self, event):
+ locker = QMutexLocker(self.mutex)
if event[0] == "reload":
self.fullReload()
elif event[0] == "remove":
@@ -120,12 +120,12 @@ class Queue(QObject):
for pack in ItemIterator(self.rootItem):
for k, child in enumerate(pack.getChildren()):
if child.getFileData()["id"] == event[3]:
- pack.takeChild(k)
+ pack.removeChild(child)
break
else:
for k, pack in enumerate(ItemIterator(self.rootItem)):
if pack.getPackData()["id"] == event[3]:
- self.rootItem.takeChild(k)
+ self.rootItem.removeChild(pack)
break
def insertEvent(self, event):
@@ -155,6 +155,8 @@ class Queue(QObject):
def updateEvent(self, event):
if event[2] == "file":
info = self.connector.getLinkInfo(event[3])
+ if not info:
+ return
for pack in ItemIterator(self.rootItem):
if pack.getPackData()["id"] == info["package"]:
child = pack.getChild(event[3])
@@ -219,7 +221,8 @@ class Queue(QObject):
return None
def clearAll(self):
- self.rootItem.takeChildren()
+ for pack in ItemIterator(self.rootItem):
+ self.rootItem.removeChild(pack)
def getWaitingProgress(self, q):
locker = QMutexLocker(self.mutex)
diff --git a/module/gui/connector.py b/module/gui/connector.py
index 3146ecf5b..b6c383956 100644
--- a/module/gui/connector.py
+++ b/module/gui/connector.py
@@ -131,7 +131,8 @@ class connector(QThread):
info["downloading"] = None
return info
except Exception, e:
- self.emit(SIGNAL("proxy_error"), "getLinkInfo", e)
+ #self.emit(SIGNAL("proxy_error"), "getLinkInfo", e)
+ return None
finally:
self.mutex.unlock()
diff --git a/module/plugins/decrypter/SerienjunkiesOrg.py b/module/plugins/decrypter/SerienjunkiesOrg.py
index af7dc8169..d8396bd0b 100644
--- a/module/plugins/decrypter/SerienjunkiesOrg.py
+++ b/module/plugins/decrypter/SerienjunkiesOrg.py
@@ -5,6 +5,7 @@ import re
from module.Plugin import Plugin
from module.BeautifulSoup import BeautifulSoup
from module.unescape import unescape
+from module.download_thread import CaptchaError
class SerienjunkiesOrg(Plugin):
def __init__(self, parent):
diff --git a/module/thread_list.py b/module/thread_list.py
index 1a66bf6f5..a50d73aaf 100644
--- a/module/thread_list.py
+++ b/module/thread_list.py
@@ -1,22 +1,27 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-#
-#Copyright (C) 2009 sp00b, sebnapi, RaNaN
-#
-#This program is free software; you can redistribute it and/or modify
-#it under the terms of the GNU General Public License as published by
-#the Free Software Foundation; either version 3 of the License,
-#or (at your option) any later version.
-#
-#This program is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#See the GNU General Public License for more details.
-#
-#You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-###
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay
+ @author: spoob
+ @author: sebnapi
+ @author: RaNaN
+ @version: v0.3
+"""
+
from __future__ import with_statement
from os.path import exists
import re
@@ -80,9 +85,9 @@ class Thread_List(object):
self.occ_plugins.append(pyfile.modul.__name__)
pyfile.active = True
if pyfile.plugin.props['type'] == "container":
- self.parent.logger.info('Get links from: ' + pyfile.url)
+ self.parent.logger.info(_("Get links from: %s") % pyfile.url)
else:
- self.parent.logger.info('Download starts: ' + pyfile.url)
+ self.parent.logger.info(_("Download starts: %s") % pyfile.url)
self.lock.release()
return pyfile
@@ -128,27 +133,27 @@ class Thread_List(object):
self.list.packager.removeFileFromPackage(pyfile.id, pyfile.package.data["id"])
if newLinks:
- self.parent.logger.info("Parsed links from %s: %i" % (pyfile.status.filename, newLinks))
+ self.parent.logger.info(_("Parsed links from %s: %i") % (pyfile.status.filename, newLinks))
else:
- self.parent.logger.info("No links in %s" % pyfile.status.filename)
+ self.parent.logger.info(_("No links in %s") % pyfile.status.filename)
#~ self.list.packager.removeFileFromPackage(pyfile.id, pyfile.package.id)
#~ for link in pyfile.plugin.links:
#~ id = self.list.collector.addLink(link)
#~ pyfile.packager.pullOutPackage(pyfile.package.id)
#~ pyfile.packager.addFileToPackage(pyfile.package.id, pyfile.collector.popFile(id))
else:
- self.parent.logger.info("Download finished: %s" % pyfile.url)
+ self.parent.logger.info(_("Download finished: %s") % pyfile.url)
elif pyfile.status.type == "reconnected":
pyfile.plugin.req.init_curl()
elif pyfile.status.type == "failed":
- self.parent.logger.warning("Download failed: " + pyfile.url + " | " + pyfile.status.error)
+ self.parent.logger.warning(_("Download failed: %s | %s") % (pyfile.url, pyfile.status.error))
with open(self.parent.config['general']['failed_file'], 'a') as f:
f.write(pyfile.url + "\n")
elif pyfile.status.type == "aborted":
- self.parent.logger.info("Download aborted: " + pyfile.url)
+ self.parent.logger.info(_("Download aborted: %s") % pyfile.url)
self.list.save()
@@ -198,7 +203,7 @@ class Thread_List(object):
return False
def reconnect(self):
- self.parent.logger.info("Start reconnect")
+ self.parent.logger.info(_("Starting reconnect"))
ip = re.match(".*Current IP Address: (.*)</body>.*", urllib2.urlopen("http://checkip.dyndns.org/").read()).group(1)
self.parent.hookManager.beforeReconnecting(ip)
reconn = subprocess.Popen(self.parent.config['reconnect']['method'])#, stdout=subprocess.PIPE)
@@ -212,7 +217,7 @@ class Thread_List(object):
ip = ""
time.sleep(1)
self.parent.hookManager.afterReconnecting(ip)
- self.parent.logger.info("Reconnected, new IP: " + ip)
+ self.parent.logger.info(_("Reconnected, new IP: %s") % ip)
def stopAllDownloads(self):
self.pause = True