summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/CaptchaManager.py4
-rw-r--r--module/gui/Collector.py10
-rw-r--r--module/gui/connector.py2
-rw-r--r--module/remote/thriftbackend/Handler.py10
-rwxr-xr-xpyLoadCore.py5
-rwxr-xr-xpyLoadGui.py6
6 files changed, 23 insertions, 14 deletions
diff --git a/module/CaptchaManager.py b/module/CaptchaManager.py
index 7672aa645..7bb98dde9 100644
--- a/module/CaptchaManager.py
+++ b/module/CaptchaManager.py
@@ -52,7 +52,7 @@ class CaptchaManager():
def getTaskByID(self, tid):
self.lock.acquire()
for task in self.tasks:
- if task.id == str(tid): #task ids are strings
+ if task.id == tid:
self.lock.release()
return task
self.lock.release()
@@ -82,7 +82,7 @@ class CaptchaManager():
class CaptchaTask():
def __init__(self, id, img, type, temp):
- self.id = str(id)
+ self.id = id
self.captchaImg = img
self.captchaType = type
self.captchaFile = temp
diff --git a/module/gui/Collector.py b/module/gui/Collector.py
index 833942eac..cae429de3 100644
--- a/module/gui/Collector.py
+++ b/module/gui/Collector.py
@@ -144,7 +144,10 @@ class CollectorModel(QAbstractItemModel):
inserts a new element in the model
"""
if event.type == ElementType.File:
- info = self.connector.getFileData(event.id)
+ try:
+ info = self.connector.getFileData(event.id)
+ except FileDoesNotExists:
+ return
for k, package in enumerate(self._data):
if package.id == info.package:
@@ -167,8 +170,9 @@ class CollectorModel(QAbstractItemModel):
update an element in the model
"""
if event.type == ElementType.File:
- info = self.connector.proxy.getFileData(event.id)
- if not info:
+ try:
+ info = self.connector.proxy.getFileData(event.id)
+ except FileDoesNotExists:
return
for p, package in enumerate(self._data):
if package.id == info.packageID:
diff --git a/module/gui/connector.py b/module/gui/connector.py
index 634912f64..707bb6a32 100644
--- a/module/gui/connector.py
+++ b/module/gui/connector.py
@@ -154,4 +154,6 @@ class DispatchRPC(QObject):
finally:
self.mutex.unlock()
if lost:
+ from traceback import print_exc
+ print_exc()
self.dispatcher.emit(SIGNAL("connectionLost"))
diff --git a/module/remote/thriftbackend/Handler.py b/module/remote/thriftbackend/Handler.py
index d71b4337e..7209c6bd5 100644
--- a/module/remote/thriftbackend/Handler.py
+++ b/module/remote/thriftbackend/Handler.py
@@ -6,6 +6,8 @@ from thriftgen.pyload.Pyload import Iface
from module.PyFile import PyFile
from module.utils import freeSpace
+from base64 import b64encode
+
class Handler(Iface):
def __init__(self, backend):
self.backend = backend
@@ -442,10 +444,10 @@ class Handler(Iface):
Parameters:
- exclusive
"""
- tid, data, type = self.serverMethods.get_captcha_task(exclusive)
- tid = int(tid)
-
- t = CaptchaTask(tid, data, type)
+ t = CaptchaTask()
+ t.tid, t.data, t.type = self.serverMethods.get_captcha_task(exclusive)
+ t.tid = int(t.tid)
+ t.data = b64encode(t.data)
return t
def getCaptchaTaskStatus(self, tid):
diff --git a/pyLoadCore.py b/pyLoadCore.py
index fc2ce8e29..dd05c9e99 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -759,15 +759,14 @@ class ServerMethods():
if task:
task.setWatingForUser(exclusive=exclusive)
c = task.getCaptcha()
- return str(task.id), c[0], str(c[1])
+ return int(task.id), c[0], str(c[1])
else:
return None, None, None
def get_task_status(self, tid):
self.core.lastClientConnected = time()
t = self.core.captchaManager.getTaskByID(tid)
- if t:
- return t.getStatus()
+ return t.getStatus() if t else ""
def set_captcha_result(self, tid, result):
self.core.lastClientConnected = time()
diff --git a/pyLoadGui.py b/pyLoadGui.py
index dd74f3653..6935c502e 100755
--- a/pyLoadGui.py
+++ b/pyLoadGui.py
@@ -23,6 +23,8 @@ import sys
from uuid import uuid4 as uuid # should be above PyQt imports
from time import sleep, time
+from base64 import b64decode
+
from PyQt4.QtCore import *
from PyQt4.QtGui import *
@@ -639,11 +641,11 @@ class main(QObject):
def checkCaptcha(self):
if self.connector.isCaptchaWaiting() and self.mainWindow.captchaDock.isFree():
- t = self.connector.getCaptchaTask()
+ t = self.connector.getCaptchaTask(False)
self.mainWindow.show()
self.mainWindow.raise_()
self.mainWindow.activateWindow()
- self.mainWindow.captchaDock.emit(SIGNAL("setTask"), t.tid, t.data, t.type)
+ self.mainWindow.captchaDock.emit(SIGNAL("setTask"), t.tid, b64decode(t.data), t.type)
elif not self.mainWindow.captchaDock.isFree():
status = self.connector.getCaptchaTaskStatus(self.mainWindow.captchaDock.currentID)
if not (status == "user" or status == "shared-user"):