summaryrefslogtreecommitdiffstats
path: root/pyLoadGui.py
diff options
context:
space:
mode:
authorGravatar Jeix <devnull@localhost> 2010-10-01 17:28:48 +0200
committerGravatar Jeix <devnull@localhost> 2010-10-01 17:28:48 +0200
commit22c3e0e9e0efb4445720b951c8f22ae1324c5dbd (patch)
treef6e3c644b3fc5c99931ded9ce4237002bb8b33b7 /pyLoadGui.py
parentfixed proxy support, downloadCheck function (diff)
downloadpyload-22c3e0e9e0efb4445720b951c8f22ae1324c5dbd.tar.xz
issue #139 fixed, thanks for the diff!
Diffstat (limited to 'pyLoadGui.py')
-rwxr-xr-xpyLoadGui.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/pyLoadGui.py b/pyLoadGui.py
index e03843054..85acc0682 100755
--- a/pyLoadGui.py
+++ b/pyLoadGui.py
@@ -33,6 +33,7 @@ from xmlrpclib import Binary
from os.path import abspath
from os.path import join
from os.path import basename
+from os.path import commonprefix
from module import InitHomeDir
from module.gui.ConnectionManager import *
@@ -580,8 +581,19 @@ class main(QObject):
text = self.clipboard.text()
pattern = re.compile(r"(http|https|ftp)://[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))])
+
+ # thanks to: jmansour //#139
+ links = [str(match.group(0)) for match in matches]
+ if len(links) == 0:
+ return
+
+ filenames = [link.rpartition("/")[2] for link in links]
+
+ packagename = commonprefix(filenames)
+ if len(packagename) == 0:
+ packagename = filenames[0]
+
+ self.slotAddPackage(packagename, links)
def slotSetClipboardStatus(self, status):
"""