summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2009-12-27 22:16:51 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2009-12-27 22:16:51 +0100
commit090c9d2abdac07025fe6d7351e376e85aabc0891 (patch)
tree8177a488a95cc977bab10b66caa2d4b738a18d20
parentcloses #51 (diff)
downloadpyload-090c9d2abdac07025fe6d7351e376e85aabc0891.tar.xz
fixed uploaded.to and netload.in, gui clipboard check
-rw-r--r--module/file_list.py8
-rw-r--r--module/gui/MainWindow.py35
-rw-r--r--module/gui/connector.py1
-rw-r--r--module/plugins/hoster/NetloadIn.py2
-rw-r--r--module/plugins/hoster/UploadedTo.py4
-rwxr-xr-xpyLoadCore.py8
-rwxr-xr-xpyLoadGui.py25
7 files changed, 75 insertions, 8 deletions
diff --git a/module/file_list.py b/module/file_list.py
index bb04ae898..d80310cdd 100644
--- a/module/file_list.py
+++ b/module/file_list.py
@@ -365,6 +365,14 @@ class File_List(object):
pyfile.status.type = None
finally:
packager.file_list.lock.release()
+
+ def abortFile(packager, fileid):
+ packager.file_list.lock.acquire()
+ try:
+ key, n, pyfile, pypack, pid = packager._getFileFromID(fileid)
+ pyfile.plugin.req.abort = True
+ finally:
+ packager.file_list.lock.release()
#oooops, duplicate?
def removeFileFromPackage(packager, id, pid):
diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py
index 06df7447c..1e769110b 100644
--- a/module/gui/MainWindow.py
+++ b/module/gui/MainWindow.py
@@ -121,9 +121,12 @@ class MainWindow(QMainWindow):
self.actions["status_stop"] = self.toolbar.addAction(QIcon("icons/gui/toolbar_stop.png"), "Stop")
self.toolbar.addSeparator()
self.actions["add"] = self.toolbar.addAction(QIcon("icons/gui/toolbar_add.png"), "Add")
- #self.toolbar.addAction(QIcon("icons/gui/toolbar_remove.png"), "Remove")
+ self.toolbar.addSeparator()
+ self.actions["clipboard"] = self.toolbar.addAction(QIcon("icons/gui/clipboard.png"), "Check Clipboard")
+ self.actions["clipboard"].setCheckable(True)
self.connect(self.actions["toggle_status"], SIGNAL("toggled(bool)"), self.slotToggleStatus)
+ self.connect(self.actions["clipboard"], SIGNAL("toggled(bool)"), self.slotToggleClipboard)
self.connect(self.actions["status_stop"], SIGNAL("triggered()"), self.slotStatusStop)
self.addMenu = QMenu()
packageAction = self.addMenu.addAction("Package")
@@ -185,6 +188,8 @@ class MainWindow(QMainWindow):
"""
create context menus
"""
+ self.activeMenu = None
+ #queue
self.queueContext = QMenu()
self.queueContext.buttons = {}
self.queueContext.item = (None, None)
@@ -194,6 +199,14 @@ class MainWindow(QMainWindow):
self.queueContext.addAction(self.queueContext.buttons["restart"])
self.connect(self.queueContext.buttons["remove"], SIGNAL("triggered()"), self.slotRemoveDownload)
self.connect(self.queueContext.buttons["restart"], SIGNAL("triggered()"), self.slotRestartDownload)
+
+ #package collector
+ self.packageCollectorContext = QMenu()
+ self.packageCollectorContext.buttons = {}
+ self.packageCollectorContext.item = (None, None)
+ self.packageCollectorContext.buttons["remove"] = QAction(QIcon("icons/gui/remove_small.png"), "Remove", self.packageCollectorContext)
+ self.packageCollectorContext.addAction(self.packageCollectorContext.buttons["remove"])
+ self.connect(self.packageCollectorContext.buttons["remove"], SIGNAL("triggered()"), self.slotRemoveDownload)
def slotToggleStatus(self, status):
"""
@@ -317,13 +330,23 @@ class MainWindow(QMainWindow):
self.queueContext.item = (i.data(0, Qt.UserRole).toPyObject(), i.parent() == None)
menuPos = QCursor.pos()
menuPos.setX(menuPos.x()+2)
+ self.activeMenu = self.queueContext
self.queueContext.exec_(menuPos)
def slotPackageCollectorContextMenu(self, pos):
"""
custom context menu in package collector view requested
"""
- pass
+ globalPos = self.tabs["collector"]["package_view"].mapToGlobal(pos)
+ i = self.tabs["collector"]["package_view"].itemAt(pos)
+ if not i:
+ return
+ i.setSelected(True)
+ self.packageCollectorContext.item = (i.data(0, Qt.UserRole).toPyObject(), i.parent() == None)
+ menuPos = QCursor.pos()
+ menuPos.setX(menuPos.x()+2)
+ self.activeMenu = self.packageCollectorContext
+ self.packageCollectorContext.exec_(menuPos)
def slotLinkCollectorContextMenu(self, pos):
"""
@@ -343,7 +366,13 @@ class MainWindow(QMainWindow):
"""
remove download action is triggered
"""
- id, isTopLevel = self.queueContext.item
+ id, isTopLevel = self.activeMenu.item
if not id == None:
self.emit(SIGNAL("removeDownload"), id, isTopLevel)
+
+ def slotToggleClipboard(self, status):
+ """
+ check clipboard (toolbar)
+ """
+ self.emit(SIGNAL("setClipboardStatus"), status)
diff --git a/module/gui/connector.py b/module/gui/connector.py
index 8458d74b9..3f594d68e 100644
--- a/module/gui/connector.py
+++ b/module/gui/connector.py
@@ -335,6 +335,7 @@ class connector(QThread):
"""
self.mutex.lock()
try:
+ self.proxy.pause_server()
self.proxy.stop_downloads()
except Exception, e:
self.emit(SIGNAL("proxy_error"), "stopAllDownloads", e)
diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py
index bc755fb58..dc639df45 100644
--- a/module/plugins/hoster/NetloadIn.py
+++ b/module/plugins/hoster/NetloadIn.py
@@ -64,7 +64,7 @@ class NetloadIn(Plugin):
def download_api_data(self):
url = self.parent.url
- id_regex = re.compile("http://netload.in/datei(.*?)(?:\.htm|/)")
+ id_regex = re.compile("http://.*netload.in/datei(.*?)(?:\.htm|/)")
match = id_regex.search(url)
if match:
apiurl = "http://netload.in/share/fileinfos2.php"
diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py
index bb623b4e6..0d487be46 100644
--- a/module/plugins/hoster/UploadedTo.py
+++ b/module/plugins/hoster/UploadedTo.py
@@ -84,9 +84,6 @@ class UploadedTo(Plugin):
self.api_data["checksum"] = lines[2] #sha1
def download_html(self):
- if self.config['premium']:
- self.config['username'], self.config['password']
- self.req.load("http://uploaded.to/login", None, { "email" : self.config['username'], "password" : self.config['password']})
url = self.parent.url
self.html = self.req.load(url, cookies=False)
@@ -131,6 +128,7 @@ class UploadedTo(Plugin):
def proceed(self, url, location):
if self.config['premium']:
+ self.req.load("http://uploaded.to/login", None, { "email" : self.config['username'], "password" : self.config['password']}, cookies=True)
self.req.download(url, location, cookies=True)
else:
self.req.download(url, location, cookies=False, post={"download_submit": "Free Download"})
diff --git a/pyLoadCore.py b/pyLoadCore.py
index c062374bc..d0a6195d4 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -537,6 +537,14 @@ class ServerMethods():
def stop_downloads(self):
self.core.thread_list.stopAllDownloads()
+ def stop_download(self, type, id):
+ if type == "pack":
+ ids = self.core.file_list.getPackageFiles(id)
+ for fid in ids:
+ self.core.file_list.packager.abortFile(fid)
+ else:
+ self.core.file_list.packager.abortFile(id)
+
def update_available(self):
return self.core.update_available
diff --git a/pyLoadGui.py b/pyLoadGui.py
index ea106c516..681feec8a 100755
--- a/pyLoadGui.py
+++ b/pyLoadGui.py
@@ -27,7 +27,7 @@ from PyQt4.QtCore import *
from PyQt4.QtGui import *
from uuid import uuid4 as uuid
-
+import re
from os.path import basename
from module.gui.ConnectionManager import *
@@ -59,6 +59,7 @@ class main(QObject):
self.connectSignals()
self.parser = XMLParser("module/config/gui.xml", "module/config/gui_default.xml")
+ self.checkClipboard = False
self.refreshConnections()
self.connData = None
self.connWindow.show()
@@ -75,11 +76,15 @@ class main(QObject):
self.initPackageCollector()
self.initLinkCollector()
self.mainloop.start()
+ self.clipboard = self.app.clipboard()
+ self.connect(self.clipboard, SIGNAL('dataChanged()'), self.slotClipboardChange)
+ self.mainWindow.actions["clipboard"].setChecked(self.checkClipboard)
def stopMain(self):
"""
stop all refresh threads and hide main window
"""
+ self.disconnect(self.clipboard, SIGNAL('dataChanged()'), self.slotClipboardChange)
self.mainloop.stop()
self.connector.stop()
self.mainWindow.saveWindow()
@@ -113,6 +118,7 @@ class main(QObject):
self.connect(self.mainWindow, SIGNAL("removeDownload"), self.slotRemoveDownload)
self.connect(self.mainWindow, SIGNAL("addContainer"), self.slotAddContainer)
self.connect(self.mainWindow, SIGNAL("stopAllDownloads"), self.slotStopAllDownloads)
+ self.connect(self.mainWindow, SIGNAL("setClipboardStatus"), self.slotSetClipboardStatus)
def slotShowConnector(self):
"""
@@ -486,6 +492,23 @@ class main(QObject):
"""
self.connector.stopAllDownloads()
+ def slotClipboardChange(self):
+ """
+ called if clipboard changes
+ """
+ if self.checkClipboard:
+ text = self.clipboard.text()
+ pattern = re.compile(r"(http|https)://[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?/.*)?")
+ matches = pattern.finditer(text)
+ for match in matches:
+ self.slotAddLinks([str(match.group(0))])
+
+ def slotSetClipboardStatus(self, status):
+ """
+ set clipboard checking
+ """
+ self.checkClipboard = status
+
class Loop(QThread):
"""
main loop (not application loop)