From 8c342ae1ef82090b7bd36c54fcb25763bc5e0984 Mon Sep 17 00:00:00 2001 From: mkaay Date: Mon, 16 Nov 2009 17:00:10 +0100 Subject: bump --- pyLoadCore.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyLoadCore.py b/pyLoadCore.py index c4c5dd9f0..d84353902 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -405,3 +405,4 @@ if __name__ == "__main__": testLoader = Core() testLoader.start() + -- cgit v1.2.3 From b0d9967fdafa38fdf7875a4b8f43d10e97c6f4f7 Mon Sep 17 00:00:00 2001 From: mkaay Date: Mon, 16 Nov 2009 17:43:33 +0100 Subject: added lastEffectiveURL --- module/network/Request.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/module/network/Request.py b/module/network/Request.py index eb67da95d..9f27af4ec 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -47,6 +47,7 @@ class Request: self.abort = False + self.lastEffectiveURL = None self.lastURL = None self.auth = False @@ -138,6 +139,7 @@ class Request: self.pycurl.perform() + self.lastEffectiveURL = self.pycurl.getinfo(pycurl.EFFECTIVE_URL) self.lastURL = url header = self.get_header() @@ -165,6 +167,7 @@ class Request: if rep.headers["content-encoding"] == "gzip": output = GzipFile('', 'r', 0, StringIO(output)).read() + self.lastEffectiveURL = rep.geturl() self.lastURL = url return output -- cgit v1.2.3 From 032bb8d837dc91742746ba39d6e9cb8e1323f22b Mon Sep 17 00:00:00 2001 From: mkaay Date: Mon, 16 Nov 2009 18:22:29 +0100 Subject: relink.us fix --- module/plugins/RelinkUs.py | 50 +++++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/module/plugins/RelinkUs.py b/module/plugins/RelinkUs.py index 4bfa5a18b..840497413 100644 --- a/module/plugins/RelinkUs.py +++ b/module/plugins/RelinkUs.py @@ -2,8 +2,9 @@ # -*- coding: utf-8 -*- import re +import time -from module.Plugin import Plugin +from Plugin import Plugin class RelinkUs(Plugin): @@ -12,14 +13,15 @@ class RelinkUs(Plugin): props = {} props['name'] = "RelinkUs" props['type'] = "container" - props['pattern'] = r"http://(www\.)?relink.us/go.php" - props['version'] = "0.1" + props['pattern'] = r"http://(www\.)?relink.us/(f|((view|go).php))" + props['version'] = "0.2" props['description'] = """Relink.us Container Plugin""" - props['author_name'] = ("spoob") - props['author_mail'] = ("spoob@pyload.org") + props['author_name'] = ("Sleeper-") + props['author_mail'] = ("@nonymous") self.props = props self.parent = parent self.html = None + self.multi_dl = False def file_exists(self): """ returns True or False @@ -27,13 +29,33 @@ class RelinkUs(Plugin): return True def proceed(self, url, location): - url = self.parent.url - self.html = self.req.load(url) - container_id = url.split("id=")[-1] + container_id = self.parent.url.split("/")[-1].split("id=")[-1] + url = "http://relink.us/view.php?id="+container_id + self.html = self.req.load(url, cookies=True) temp_links = [] - link_number = len(re.findall(r"test_\d+", self.html)) - for number in range(0, link_number): - new_link = re.search("src='(.*)'>", self.req.load("http://relink.us/f/%s/1/%i" % (container_id, number))).group(1) - temp_links.append(new_link) - print temp_links - self.links = temp_links + + # Download Ad-Frames, otherwise we aren't enabled for download + iframes = re.findall("src=['\"]([^'\"]*)['\"](.*)>", self.html) + for iframe in iframes: + self.req.load("http://relink.us/"+iframe[0], cookies=True) + + link_strings = re.findall(r"onclick=\"getFile\(\'([^)]*)\'\);changeBackgroundColor", self.html) + + for link_string in link_strings: + self.req.lastURL = url + + # Set Download File + framereq = self.req.load("http://relink.us/frame.php?"+link_string, cookies=True) + + new_link = self.req.lastEffectiveURL + + if re.match(r"http://(www\.)?relink.us/",new_link): + # Find iframe + new_link = re.search("src=['\"]([^'\"]*)['\"](.*)>", framereq).group(1) + # Wait some secs for relink.us server... + time.sleep(5) + + print new_link + temp_links.append(new_link) + + self.links = temp_links -- cgit v1.2.3 From a49bae7ba97ae64f61f38c4e64b671a650203910 Mon Sep 17 00:00:00 2001 From: mkaay Date: Mon, 16 Nov 2009 18:32:37 +0100 Subject: indentation fix --- module/plugins/RelinkUs.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/module/plugins/RelinkUs.py b/module/plugins/RelinkUs.py index 840497413..9ca209be3 100644 --- a/module/plugins/RelinkUs.py +++ b/module/plugins/RelinkUs.py @@ -34,28 +34,28 @@ class RelinkUs(Plugin): self.html = self.req.load(url, cookies=True) temp_links = [] - # Download Ad-Frames, otherwise we aren't enabled for download - iframes = re.findall("src=['\"]([^'\"]*)['\"](.*)>", self.html) - for iframe in iframes: - self.req.load("http://relink.us/"+iframe[0], cookies=True) + # Download Ad-Frames, otherwise we aren't enabled for download + iframes = re.findall("src=['\"]([^'\"]*)['\"](.*)>", self.html) + for iframe in iframes: + self.req.load("http://relink.us/"+iframe[0], cookies=True) - link_strings = re.findall(r"onclick=\"getFile\(\'([^)]*)\'\);changeBackgroundColor", self.html) + link_strings = re.findall(r"onclick=\"getFile\(\'([^)]*)\'\);changeBackgroundColor", self.html) - for link_string in link_strings: - self.req.lastURL = url + for link_string in link_strings: + self.req.lastURL = url - # Set Download File - framereq = self.req.load("http://relink.us/frame.php?"+link_string, cookies=True) + # Set Download File + framereq = self.req.load("http://relink.us/frame.php?"+link_string, cookies=True) - new_link = self.req.lastEffectiveURL + new_link = self.req.lastEffectiveURL - if re.match(r"http://(www\.)?relink.us/",new_link): - # Find iframe - new_link = re.search("src=['\"]([^'\"]*)['\"](.*)>", framereq).group(1) - # Wait some secs for relink.us server... - time.sleep(5) + if re.match(r"http://(www\.)?relink.us/",new_link): + # Find iframe + new_link = re.search("src=['\"]([^'\"]*)['\"](.*)>", framereq).group(1) + # Wait some secs for relink.us server... + time.sleep(5) - print new_link - temp_links.append(new_link) + print new_link + temp_links.append(new_link) - self.links = temp_links + self.links = temp_links -- cgit v1.2.3 From 20a3ae56f5eea95a0f9641eabb273e0410fe2309 Mon Sep 17 00:00:00 2001 From: mkaay Date: Mon, 16 Nov 2009 18:38:16 +0100 Subject: indentation fix, 2nd try -.- --- module/plugins/RelinkUs.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/module/plugins/RelinkUs.py b/module/plugins/RelinkUs.py index 9ca209be3..1700beb2b 100644 --- a/module/plugins/RelinkUs.py +++ b/module/plugins/RelinkUs.py @@ -34,28 +34,28 @@ class RelinkUs(Plugin): self.html = self.req.load(url, cookies=True) temp_links = [] - # Download Ad-Frames, otherwise we aren't enabled for download - iframes = re.findall("src=['\"]([^'\"]*)['\"](.*)>", self.html) - for iframe in iframes: - self.req.load("http://relink.us/"+iframe[0], cookies=True) + # Download Ad-Frames, otherwise we aren't enabled for download + iframes = re.findall("src=['\"]([^'\"]*)['\"](.*)>", self.html) + for iframe in iframes: + self.req.load("http://relink.us/"+iframe[0], cookies=True) - link_strings = re.findall(r"onclick=\"getFile\(\'([^)]*)\'\);changeBackgroundColor", self.html) + link_strings = re.findall(r"onclick=\"getFile\(\'([^)]*)\'\);changeBackgroundColor", self.html) - for link_string in link_strings: - self.req.lastURL = url + for link_string in link_strings: + self.req.lastURL = url - # Set Download File - framereq = self.req.load("http://relink.us/frame.php?"+link_string, cookies=True) + # Set Download File + framereq = self.req.load("http://relink.us/frame.php?"+link_string, cookies=True) - new_link = self.req.lastEffectiveURL + new_link = self.req.lastEffectiveURL - if re.match(r"http://(www\.)?relink.us/",new_link): - # Find iframe - new_link = re.search("src=['\"]([^'\"]*)['\"](.*)>", framereq).group(1) - # Wait some secs for relink.us server... - time.sleep(5) + if re.match(r"http://(www\.)?relink.us/",new_link): + # Find iframe + new_link = re.search("src=['\"]([^'\"]*)['\"](.*)>", framereq).group(1) + # Wait some secs for relink.us server... + time.sleep(5) - print new_link - temp_links.append(new_link) + print new_link + temp_links.append(new_link) - self.links = temp_links + self.links = temp_links -- cgit v1.2.3 From 80b31ff0d1f1b4eaf4f3ded0347114b0d0390dc3 Mon Sep 17 00:00:00 2001 From: mkaay Date: Mon, 16 Nov 2009 18:40:28 +0100 Subject: indentation fix, 3nd try.. --- module/plugins/RelinkUs.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/plugins/RelinkUs.py b/module/plugins/RelinkUs.py index 1700beb2b..786733558 100644 --- a/module/plugins/RelinkUs.py +++ b/module/plugins/RelinkUs.py @@ -50,10 +50,10 @@ class RelinkUs(Plugin): new_link = self.req.lastEffectiveURL if re.match(r"http://(www\.)?relink.us/",new_link): - # Find iframe - new_link = re.search("src=['\"]([^'\"]*)['\"](.*)>", framereq).group(1) - # Wait some secs for relink.us server... - time.sleep(5) + # Find iframe + new_link = re.search("src=['\"]([^'\"]*)['\"](.*)>", framereq).group(1) + # Wait some secs for relink.us server... + time.sleep(5) print new_link temp_links.append(new_link) -- cgit v1.2.3 From ed688632fb44f6c71e8053722895502cc4315494 Mon Sep 17 00:00:00 2001 From: spoob Date: Mon, 16 Nov 2009 18:56:44 +0100 Subject: Fixed DLC Plugin for new Plugin System --- module/plugins/DLC.pyc | Bin 3692 -> 2228 bytes module/plugins/UploadedTo.py | 3 +-- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/module/plugins/DLC.pyc b/module/plugins/DLC.pyc index 5d4809178..3adddec00 100644 Binary files a/module/plugins/DLC.pyc and b/module/plugins/DLC.pyc differ diff --git a/module/plugins/UploadedTo.py b/module/plugins/UploadedTo.py index bcb0a7008..4bddbd6f1 100644 --- a/module/plugins/UploadedTo.py +++ b/module/plugins/UploadedTo.py @@ -69,8 +69,7 @@ class UploadedTo(Plugin): tries += 1 if tries > 5: - raise Exception, "Error while preparing DL, HTML dump: %s" % self.html - + raise Exception, "Error while preparing DL" return True def download_api_data(self): -- cgit v1.2.3 From f22b9cebe1f800127658f94b9e4c9b9b2481c59e Mon Sep 17 00:00:00 2001 From: spoob Date: Mon, 16 Nov 2009 20:28:33 +0100 Subject: Fixed DLC Plugin --- module/plugins/DLC.pyc | Bin 2228 -> 2231 bytes pyLoadCore.py | 11 +++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/module/plugins/DLC.pyc b/module/plugins/DLC.pyc index 3adddec00..980dd8ace 100644 Binary files a/module/plugins/DLC.pyc and b/module/plugins/DLC.pyc differ diff --git a/pyLoadCore.py b/pyLoadCore.py index d84353902..94a57aa70 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -147,10 +147,13 @@ class Core(object): for file_handler in glob(self.plugin_folder + sep + '*.py') + glob(self.plugin_folder + sep + 'DLC.pyc'): plugin_pattern = "" plugin_file = basename(file_handler).replace('.pyc', '').replace('.py', '') - for line in open(file_handler, "r").readlines(): - if "props['pattern']" in line: - plugin_pattern = line.split("r\"")[1].split("\"")[0] - break + if plugin_file == "DLC": + plugin_pattern = "(?!http://).*\.dlc" + else: + for line in open(file_handler, "r").readlines(): + if "props['pattern']" in line: + plugin_pattern = line.split("r\"")[1].split("\"")[0] + break if plugin_pattern != "": self.plugins_avaible[plugin_file] = plugin_pattern self.logger.debug(plugin_file + _(" added")) -- cgit v1.2.3 From d862585e35c87498023882f02fc9e4b014becf2a Mon Sep 17 00:00:00 2001 From: sitacuisses Date: Wed, 18 Nov 2009 00:47:28 +0100 Subject: user: sitacuisses branch 'default' added module/plugins/FilesmonsterCom.py --- module/plugins/FilesmonsterCom.py | 94 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 module/plugins/FilesmonsterCom.py diff --git a/module/plugins/FilesmonsterCom.py b/module/plugins/FilesmonsterCom.py new file mode 100644 index 000000000..27c687363 --- /dev/null +++ b/module/plugins/FilesmonsterCom.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Plugin for www.filesmonster.com +# this plugin isn't fully implemented yet,but it does download +# todo: +# detect, if reconnect is necessary +# download-error handling +# postpone download, if speed is below a set limit +# implement premium-access +# optional replace blanks in filename with underscores + +import re +import urllib +import time +from Plugin import Plugin + +class FilesmonsterCom(Plugin): + + def __init__(self, parent): + Plugin.__init__(self, parent) + props = {} + props['name'] = "FilesmonsterCom" + props['type'] = "hoster" + props['pattern'] = r"http://(www.)??filesmonster.com/download.php" + props['version'] = "0.1" + props['description'] = """Filesmonster.com Download Plugin""" + props['author_name'] = ("sitacuisses","spoob") + props['author_mail'] = ("sitacuisses@yahoo.de","spoob@pyload.org") + self.props = props + self.parent = parent + self.html = None + self.want_reconnect = False + self.multi_dl = False + self.htmlwithlink = None + self.url = None + self.filerequest = None + + def download_html(self): + self.url = self.parent.url + self.html = self.req.load(self.url) # get the start page + + def get_file_url(self): + """ returns the absolute downloadable filepath + """ + if self.html == None: + self.download_html() + if not self.want_reconnect: + self.get_download_page() # the complex work is done here + file_url = self.htmlwithlink + return file_url + else: + return False + + def get_file_name(self): + if self.html == None: + self.download_html() + if not self.want_reconnect: + file_name = re.search(r"File\sname:\s(.*?)", self.html).group(1) + return file_name + else: + return self.parent.url + + def file_exists(self): + """ returns True or False + """ + if self.html == None: + self.download_html() + if re.search(r"Such file does not exist or it has been removed for infringement of copyrights.", self.html) != None: + return False + else: + return True + + def get_download_page(self): + herewego = re.findall(r"\s*\n\s*", self.html) + the_download_page = self.req.load("http://filesmonster.com/get/free/", None, herewego) + temporary_filtered = re.search(r"\s*\n(\s*\s*\n)*?\s*", the_download_page).group(0) + all_the_tuples = re.findall(r" Date: Sun, 29 Nov 2009 20:59:53 +0100 Subject: First Version, works but doesn't reconnect branch 'default' added module/plugins/FreakshareNet.py --- module/plugins/FreakshareNet.py | 144 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 module/plugins/FreakshareNet.py diff --git a/module/plugins/FreakshareNet.py b/module/plugins/FreakshareNet.py new file mode 100644 index 000000000..0768b5476 --- /dev/null +++ b/module/plugins/FreakshareNet.py @@ -0,0 +1,144 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +import urllib +import httplib +from module.Plugin import Plugin +from time import time + + +class FreakshareNet(Plugin): + + def __init__(self, parent): + Plugin.__init__(self, parent) + props = {} + props['name'] = "FreakshareNet" + props['type'] = "hoster" + props['pattern'] = r"http://(?:www\.)?freakshare\.net/files/\S*?/" + props['version'] = "0.1" + props['description'] = """Freakshare.com Download Plugin""" + props['author_name'] = ("sitacuisses","spoob","mkaay") + props['author_mail'] = ("sitacuisses@yahoo.de","spoob@pyload.org","mkaay@mkaay.de") + self.props = props + self.parent = parent + self.html = None + self.want_reconnect = False + self.multi_dl = False + self.req_opts = list() + + def prepare(self, thread): + pyfile = self.parent + + self.want_reconnect = False + + self.download_html() + + pyfile.status.exists = self.file_exists() + + if not pyfile.status.exists: + raise Exception, "The file was not found on the server." + return False + + self.get_waiting_time() + + pyfile.status.filename = self.get_file_name() + + pyfile.status.waituntil = self.time_plus_wait + thread.wait(self.parent) + pyfile.status.url = self.get_file_url() + pyfile.status.want_reconnect = self.want_reconnect + + return True + + def download_html(self): + url = self.parent.url + self.html = self.req.load(url, cookies=True) + + def get_file_url(self): + """ returns the absolute downloadable filepath + """ + if self.html == None: + self.download_html() + if not self.want_reconnect: + self.req_opts = self.get_download_options() # get the Post options for the Request + file_url = self.parent.url + return file_url + else: + return False + + def get_file_name(self): + if self.html == None: + self.download_html() + if not self.want_reconnect: + file_name = re.search(r"(.*?)<\/h1>", self.html).group(1) + return file_name + else: + return self.parent.url + + def get_waiting_time(self): + if self.html == None: + self.download_html() + timestring = re.search('\s*var\stime\s=\s(\d*?)\.\d*;', self.html).group(1) + if timestring: + sec = int(timestring) + 1 #add 1 sec as tenths of seconds are cut off + else: + sec = 0 + self.time_plus_wait = time() + sec + + def file_exists(self): + """ returns True or False + """ + if self.html == None: + self.download_html() + if re.search(r"Sorry, this Download doesnt exist anymore", self.html) != None: + return False + else: + return True + + def get_download_options(self): + re_envelope = re.search(r".*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?", self.html).group(0) #get the whole request + to_sort = re.findall(r"", re_envelope) + request_options = list() + for item in to_sort: #Name value pairs are output reversed from regex, so we reorder them + request_options.append((item[1], item[0])) + herewego = self.req.load(self.parent.url, None, request_options, cookies=True) # the actual download-Page + to_sort = None + to_sort = re.findall(r"", herewego) + request_options = list() + for item in to_sort: #Same as above + request_options.append((item[1], item[0])) + return request_options + + def proceed(self, url, location): + """ + request.download doesn't handle the 302 redirect correctly + that's why the data are posted "manually" via httplib + and the redirect-url is read from the header. + Important: The cookies may not be posted to the download-url + otherwise the downloaded file only contains "bad try" + Need to come up with a better idea to handle the redirect, + help is appreciated. + """ + temp_options = urllib.urlencode(self.req_opts) + temp_url = re.match(r"http://(.*?)/.*", url).group(1) # get the server name + temp_extended = re.match(r"http://.*?(/.*)", url).group(1) # get the url relative to serverroot + cookie_list = "" + for temp_cookie in self.req.cookies: #prepare cookies + cookie_list += temp_cookie.name + "=" + temp_cookie.value +";" + temp_headers = [ #create the additional header fields + ["Content-type", "application/x-www-form-urlencoded"], #this is very important + ["User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.10"], + ["Accept-Encoding", "deflate"], + ["Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"], + ["Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"], + ["Connection", "keep-alive"], + ["Keep-Alive", "300"], + ["Referer", self.req.lastURL], + ["Cookie", cookie_list]] + temp_conn = httplib.HTTPConnection(temp_url) + temp_conn.request("POST", temp_extended, temp_options, dict(temp_headers)) + temp_response = temp_conn.getresponse() + new_url = temp_response.getheader("Location") # we need the Location-header + temp_conn.close + self.req.download(new_url, location, None, None, cookies=False) -- cgit v1.2.3 -- cgit v1.2.3 From 5d04894e73a52e69968cb4a4bfd9a581cd2fb86c Mon Sep 17 00:00:00 2001 From: mkaay Date: Mon, 1 Feb 2010 18:54:19 +0100 Subject: new update system for remote clients --- module/download_thread.py | 4 + module/file_list.py | 24 ++++- module/gui/Collector.py | 230 +++++++++++++++++++++------------------------- module/gui/Queue.py | 132 +++++++++++++++++--------- module/gui/connector.py | 19 +++- pyLoadCore.py | 9 +- pyLoadGui.py | 16 +++- 7 files changed, 258 insertions(+), 176 deletions(-) diff --git a/module/download_thread.py b/module/download_thread.py index 4a031a04c..65c7e1e23 100644 --- a/module/download_thread.py +++ b/module/download_thread.py @@ -23,6 +23,7 @@ from os.path import join from time import sleep, time from module.network.Request import AbortDownload +from module.PullEvents import UpdateEvent class Status(object): """ Saves all status information @@ -116,6 +117,7 @@ class Download_Thread(threading.Thread): self.loadedPyFile.status.error = str(e) finally: self.parent.job_finished(self.loadedPyFile) + self.parent.parent.pullManager.addEvent(UpdateEvent("file", self.loadedPyFile.id, "queue")) else: sleep(3) sleep(0.8) @@ -126,6 +128,7 @@ class Download_Thread(threading.Thread): def download(self, pyfile): status = pyfile.status status.type = "starting" + self.parent.parent.pullManager.addEvent(UpdateEvent("file", pyfile.id, "queue")) pyfile.init_download() @@ -136,6 +139,7 @@ class Download_Thread(threading.Thread): status.type = "decrypting" else: status.type = "downloading" + self.parent.parent.pullManager.addEvent(UpdateEvent("file", pyfile.id, "queue")) location = join(pyfile.folder, status.filename) pyfile.plugin.proceed(status.url, location) diff --git a/module/file_list.py b/module/file_list.py index 7c68a7427..b9f70bd27 100644 --- a/module/file_list.py +++ b/module/file_list.py @@ -33,6 +33,8 @@ from operator import attrgetter from os import sep from time import sleep +from module.PullEvents import UpdateEvent, RemoveEvent, InsertEvent + class NoSuchElementException(Exception): pass @@ -148,6 +150,10 @@ class File_List(object): info["size"] = pyfile.status.size() info["active"] = pyfile.active info["plugin"] = pyfile.plugin.props['name'] + try: + info["package"] = pypack.data["id"] + except: + pass return info def continueAborted(self): @@ -194,6 +200,7 @@ class File_List(object): try: n, pyfile = collector._getFileFromID(id) del collector.file_list.data["collector"][n] + collector.file_list.core.pullManager.addEvent(RemoveEvent("file", id, "collector")) except Exception, e: raise Exception, e else: @@ -211,6 +218,7 @@ class File_List(object): collector.file_list.lock.acquire() collector.file_list.data["collector"].append(pyfile) collector.file_list.lock.release() + collector.file_list.core.pullManager.addEvent(InsertEvent("file", pyfile.id, -2, "collector")) return pyfile.id def removeFile(collector, id): @@ -218,6 +226,7 @@ class File_List(object): removes PyLoadFile instance with the given id from collector """ collector.popFile(id) + collector.file_list.core.pullManager.addEvent(RemoveEvent("file", id, "collector")) def replaceFile(collector, newpyfile): """ @@ -227,6 +236,7 @@ class File_List(object): try: n, pyfile = collector._getFileFromID(newpyfile.id) collector.file_list.data["collector"][n] = newpyfile + collector.file_list.core.pullManager.addEvent(UpdateEvent("file", newpyfile.id, "collector")) finally: collector.file_list.lock.release() @@ -277,6 +287,7 @@ class File_List(object): if package_name is not None: pypack.data["package_name"] = package_name packager.file_list.data["packages"].append(pypack) + packager.file_list.core.pullManager.addEvent(InsertEvent("pack", pypack.data["id"], -2, "packages")) return pypack.data["id"] def removePackage(packager, id): @@ -287,6 +298,9 @@ 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() @@ -312,6 +326,8 @@ class File_List(object): if key == "packages": del packager.file_list.data["packages"][n] packager.file_list.data["queue"].append(pypack) + packager.file_list.core.pullManager.addEvent(RemoveEvent("pack", id, "packages")) + packager.file_list.core.pullManager.addEvent(InsertEvent("pack", id, -2, "queue")) finally: packager.file_list.lock.release() @@ -322,6 +338,8 @@ class File_List(object): if key == "queue": del packager.file_list.data["queue"][n] packager.file_list.data["packages"].append(pypack) + packager.file_list.core.pullManager.addEvent(RemoveEvent("pack", id, "queue")) + packager.file_list.core.pullManager.addEvent(InsertEvent("pack", id, -2, "packages")) finally: packager.file_list.lock.release() @@ -334,6 +352,7 @@ class File_List(object): if folder is not None: pypack.data["folder"] = folder packager.file_list.data[key][n] = pypack + packager.file_list.core.pullManager.addEvent(UpdateEvent("pack", id, key)) finally: packager.file_list.lock.release() @@ -352,6 +371,7 @@ class File_List(object): pyfile.package = pypack pypack.files.append(pyfile) packager.file_list.data[key][n] = pypack + packager.file_list.core.pullManager.addEvent(InsertEvent("file", pyfile.id, -2, key)) def resetFileStatus(packager, fileid): packager.file_list.lock.acquire() @@ -359,6 +379,7 @@ class File_List(object): key, n, pyfile, pypack, pid = packager._getFileFromID(fileid) pyfile.init() pyfile.status.type = None + packager.file_list.core.pullManager.addEvent(UpdateEvent("file", fileid, key)) finally: packager.file_list.lock.release() @@ -367,15 +388,16 @@ class File_List(object): try: key, n, pyfile, pypack, pid = packager._getFileFromID(fileid) pyfile.plugin.req.abort = True + packager.file_list.core.pullManager.addEvent(UpdateEvent("file", fileid, key)) finally: packager.file_list.lock.release() - #oooops, duplicate? def removeFileFromPackage(packager, id, pid): key, n, pypack = packager._getPackageFromID(pid) for k, pyfile in enumerate(pypack.files): if id == pyfile.id: del pypack.files[k] + packager.file_list.core.pullManager.addEvent(RemoveEvent("file", pyfile.id, key)) if not pypack.files: packager.removePackage(pid) return True diff --git a/module/gui/Collector.py b/module/gui/Collector.py index 0aad5d1ba..c0754aa42 100644 --- a/module/gui/Collector.py +++ b/module/gui/Collector.py @@ -27,7 +27,6 @@ class PackageCollector(QObject): self.view = view self.connector = connector self.collector = [] - self.interval = 2 self.rootItem = self.view.invisibleRootItem() self.mutex = QMutex() item = self.PackageCollectorPack(self) @@ -36,48 +35,80 @@ class PackageCollector(QObject): item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable) self.rootItem.addChild(item) self.linkCollector = item - self.pauseIDs = [] - self.updater = self.CollectorUpdater(self.interval) - self.connect(self.updater, SIGNAL("update()"), self.update) - class CollectorUpdater(QThread): - def __init__(self, interval): - QThread.__init__(self) - self.interval = interval - self.running = True - - def run(self): - while self.running: - self.emit(SIGNAL("update()")) - self.sleep(self.interval) - - def start(self): - self.updater.start() - - def wait(self): - self.updater.wait() - - def stop(self): - self.updater.running = False - - def update(self): + def fullReload(self): locker = QMutexLocker(self.mutex) + self.clearAll() packs = self.connector.getPackageCollector() - ids = [] - for data in packs: - ids.append(data["id"]) - self.clear(ids) for data in packs: - if data["id"] in self.pauseIDs: - continue - ids.append(data["id"]) - pack = self.getPack(data["id"]) - if not pack: - pack = self.PackageCollectorPack(self) + pack = self.PackageCollectorPack(self) pack.setPackData(data) + files = self.connector.getPackageFiles(data["id"]) + for fid in files: + info = self.connector.getLinkInfo(fid) + child = self.PackageCollectorFile(self, pack) + child.setFileData(info) + pack.addPackChild(fid, child) self.addPack(data["id"], pack) + + def addEvent(self, event): + if event[0] == "reload": + self.fullReload() + elif event[0] == "remove": + self.removeEvent(event) + elif event[0] == "insert": + self.insertEvent(event) + elif event[0] == "update": + self.updateEvent(event) + + def removeEvent(self, event): + if event[2] == "file": + for pack in ItemIterator(self.rootItem): + for k, child in enumerate(pack.getChildren()): + if child.getFileData()["id"] == event[3]: + pack.takeChild(k) + break + else: + for k, pack in enumerate(ItemIterator(self.rootItem)): + if pack.getPackData()["id"] == event[3]: + self.rootItem.takeChild(k) + break + + def insertEvent(self, event): + if event[2] == "file": + info = self.connector.getLinkInfo(event[3]) + for pack in ItemIterator(self.rootItem): + if pack.getPackData()["id"] == info["package"]: + child = self.PackageCollectorFile(self, pack) + child.setFileData(info) + pack.addPackChild(info["id"], child) + break + else: + data = self.connector.getPackageInfo(event[3]) + pack = self.PackageCollectorPack(self) + pack.setPackData(data) + self.addPack(data["id"], pack) + files = self.connector.getPackageFiles(data["id"]) + for fid in files: + info = self.connector.getLinkInfo(fid) + child = self.PackageCollectorFile(self, pack) + child.setFileData(info) + pack.addPackChild(fid, child) + self.addPack(data["id"], pack) + + def updateEvent(self, event): + if event[2] == "file": + info = self.connector.getLinkInfo(event[3]) + for pack in ItemIterator(self.rootItem): + if pack.getPackData()["id"] == info["package"]: + child = pack.getChild(event[3]) + child.setFileData(info) + pack.addPackChild(info["id"], child) + else: + data = self.connector.getPackageInfo(event[3]) + pack = self.getPack(event[3]) + pack.setPackData(data) files = self.connector.getPackageFiles(data["id"]) - pack.clear(files) for fid in files: info = self.connector.getLinkInfo(fid) child = pack.getChild(fid) @@ -85,6 +116,7 @@ class PackageCollector(QObject): child = self.PackageCollectorFile(self, pack) child.setFileData(info) pack.addPackChild(fid, child) + self.addPack(data["id"], pack) def addPack(self, pid, newPack): pos = None @@ -110,38 +142,10 @@ class PackageCollector(QObject): return pack return None - def clear(self, ids): - clear = False - remove = [] + def clearAll(self): for k, pack in enumerate(ItemIterator(self.rootItem)): - if not pack.getPackData()["id"] in ids and not pack.getPackData()["id"] == "fixed": - clear = True - remove.append(k) - if not clear: - return - remove.sort() - remove.reverse() - for k in remove: - self.rootItem.takeChild(k) - for pack in ItemIterator(self.rootItem): - if pack.getPackData()["id"] == "fixed": - return - item = self.PackageCollectorPack(self) - item.setPackData({"id":"fixed"}) - item.setData(0, Qt.DisplayRole, QVariant("Single Links")) - item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable) - self.rootItem.addChild(item) - self.linkCollector = item - - def pauseItemUpdate(self, pid, pause=True): - locker = QMutexLocker(self.mutex) - if pause and not pid in self.pauseIDs: - self.pauseIDs.append(int(pid)) - else: - try: - self.pauseIDs.remove(int(pid)) - except: - pass + if not pack.getPackData()["id"] == "fixed": + self.rootItem.takeChild(k) class PackageCollectorPack(QTreeWidgetItem): def __init__(self, collector): @@ -184,25 +188,6 @@ class PackageCollector(QObject): if item.getFileData()["id"] == cid: return item return None - - def clear(self, ids): - clear = False - remove = [] - children = [] - for k, file in enumerate(self.getChildren()): - if not file.getFileData()["id"] in ids: - remove.append(file.getFileData()["id"]) - if file.getFileData()["id"] in children and not file.getFileData()["id"] in remove: - remove.append(file.getFileData()["id"]) - continue - children.append(file.getFileData()["id"]) - if not remove: - return - remove.sort() - remove.reverse() - parent = self - for k in remove: - parent.takeChild(k) class PackageCollectorFile(QTreeWidgetItem): def __init__(self, collector, pack): @@ -226,44 +211,50 @@ class LinkCollector(QObject): QObject.__init__(self) self.view = view self.connector = connector - self.interval = 2 self.rootItem = root self.mutex = QMutex() - self.updater = self.CollectorUpdater(self.interval) - self.connect(self.updater, SIGNAL("update()"), self.update) - class CollectorUpdater(QThread): - def __init__(self, interval): - QThread.__init__(self) - self.interval = interval - self.running = True - - def run(self): - while self.running: - self.emit(SIGNAL("update()")) - self.sleep(self.interval) - - def start(self): - self.updater.start() - - def wait(self): - self.updater.wait() - - def stop(self): - self.updater.running = False - - def update(self): + def fullReload(self): locker = QMutexLocker(self.mutex) + self.clearAll() ids = self.connector.getLinkCollector() - self.clear(ids) for fid in ids: data = self.connector.getLinkInfo(fid) - file = self.getFile(fid) - if not file: - file = self.LinkCollectorFile(self) + file = self.LinkCollectorFile(self) file.setFileData(data) self.addFile(fid, file) + def addEvent(self, event): + if event[0] == "reload": + self.fullReload() + elif event[0] == "remove": + self.removeEvent(event) + elif event[0] == "insert": + self.insertEvent(event) + elif event[0] == "update": + self.updateEvent(event) + + def removeEvent(self, event): + if event[2] == "file": + for k, file in enumerate(ItemIterator(self.rootItem)): + if file.getFileData()["id"] == event[3]: + self.rootItem.takeChild(k) + break + + def insertEvent(self, event): + if event[2] == "file": + data = self.connector.getLinkInfo(event[3]) + file = self.LinkCollectorFile(self) + file.setFileData(data) + self.addFile(event[3], file) + + def updateEvent(self, event): + if event[2] == "file": + data = self.connector.getLinkInfo(event[3]) + file = getFile(event[3]) + file.setFileData(data) + self.addFile(event[3], file) + def addFile(self, pid, newFile): pos = None try: @@ -289,16 +280,9 @@ class LinkCollector(QObject): return file return None - def clear(self, ids): - clear = False - for file in ItemIterator(self.rootItem): - if not file.getFileData()["id"] in ids: - clear = True - break - if not clear: - return + def clearAll(self): self.rootItem.takeChildren() - + class LinkCollectorFile(QTreeWidgetItem): def __init__(self, collector): QTreeWidgetItem.__init__(self) diff --git a/module/gui/Queue.py b/module/gui/Queue.py index 8681d3bb1..9659137ec 100644 --- a/module/gui/Queue.py +++ b/module/gui/Queue.py @@ -77,28 +77,101 @@ class Queue(QObject): del d["name"] del d["status"] downloading[did] = d - ids = [] - for data in packs: - ids.append(data["id"]) - self.clear(ids) + for pack in ItemIterator(self.rootItem): + for child in pack.getChildren(): + info = child.getFileData() + try: + info["downloading"] = downloading[info["id"]] + except: + info["downloading"] = None + child.setFileData(info) + pack.addPackChild(info["id"], child) + self.addPack(pack.getPackData()["id"], pack) + + def fullReload(self): + locker = QMutexLocker(self.mutex) + self.clearAll() + packs = self.connector.getPackageQueue() for data in packs: - pack = self.getPack(data["id"]) - if not pack: - pack = self.QueuePack(self) + pack = self.QueuePack(self) pack.setPackData(data) files = self.connector.getPackageFiles(data["id"]) - pack.clear(files) + for fid in files: + info = self.connector.getLinkInfo(fid) + child = self.QueueFile(self, pack) + if not info["status_type"]: + info["status_type"] = "queued" + child.setFileData(info) + pack.addPackChild(fid, child) self.addPack(data["id"], pack) + + def addEvent(self, event): + if event[0] == "reload": + self.fullReload() + elif event[0] == "remove": + self.removeEvent(event) + elif event[0] == "insert": + self.insertEvent(event) + elif event[0] == "update": + self.updateEvent(event) + + def removeEvent(self, event): + if event[2] == "file": + for pack in ItemIterator(self.rootItem): + for k, child in enumerate(pack.getChildren()): + if child.getFileData()["id"] == event[3]: + pack.takeChild(k) + break + else: + for k, pack in enumerate(ItemIterator(self.rootItem)): + if pack.getPackData()["id"] == event[3]: + self.rootItem.takeChild(k) + break + + def insertEvent(self, event): + if event[2] == "file": + info = self.connector.getLinkInfo(event[3]) + for pack in ItemIterator(self.rootItem): + if pack.getPackData()["id"] == info["package"]: + child = self.QueueFile(self, pack) + child.setFileData(info) + pack.addPackChild(info["id"], child) + break + else: + data = self.connector.getPackageInfo(event[3]) + pack = self.QueuePack(self) + pack.setPackData(data) + self.addPack(data["id"], pack) + files = self.connector.getPackageFiles(data["id"]) + for fid in files: + info = self.connector.getLinkInfo(fid) + child = self.QueueFile(self, pack) + if not info["status_type"]: + info["status_type"] = "queued" + child.setFileData(info) + pack.addPackChild(fid, child) + self.addPack(data["id"], pack) + + def updateEvent(self, event): + if event[2] == "file": + info = self.connector.getLinkInfo(event[3]) + for pack in ItemIterator(self.rootItem): + if pack.getPackData()["id"] == info["package"]: + child = pack.getChild(event[3]) + if not info["status_type"]: + info["status_type"] = "queued" + child.setFileData(info) + pack.addPackChild(info["id"], child) + else: + data = self.connector.getPackageInfo(event[3]) + pack = self.getPack(event[3]) + pack.setPackData(data) + files = self.connector.getPackageFiles(data["id"]) for fid in files: info = self.connector.getLinkInfo(fid) child = pack.getChild(fid) if not child: child = self.QueueFile(self, pack) - info["downloading"] = None - try: - info["downloading"] = downloading[info["id"]] - except: - pass if not info["status_type"]: info["status_type"] = "queued" child.setFileData(info) @@ -145,19 +218,8 @@ class Queue(QObject): return pack return None - def clear(self, ids): - clear = False - remove = [] - for k, pack in enumerate(ItemIterator(self.rootItem)): - if not pack.getPackData()["id"] in ids: - clear = True - remove.append(k) - if not clear: - return - remove.sort() - remove.reverse() - for k in remove: - self.rootItem.takeChild(k) + def clearAll(self): + self.rootItem.takeChildren() def getWaitingProgress(self, q): locker = QMutexLocker(self.mutex) @@ -282,24 +344,6 @@ class Queue(QObject): if item.getFileData()["id"] == cid: return item return None - - def clear(self, ids): - clear = False - remove = [] - children = [] - for k, file in enumerate(self.getChildren()): - if not file.getFileData()["id"] in ids: - remove.append(file.getFileData()["id"]) - if file.getFileData()["id"] in children and not file.getFileData()["id"] in remove: - remove.append(file.getFileData()["id"]) - continue - children.append(file.getFileData()["id"]) - if not remove: - return - remove.sort() - remove.reverse() - for k in remove: - self.takeChild(k) class QueueFile(QTreeWidgetItem): def __init__(self, queue, pack): diff --git a/module/gui/connector.py b/module/gui/connector.py index 432999161..3146ecf5b 100644 --- a/module/gui/connector.py +++ b/module/gui/connector.py @@ -19,6 +19,7 @@ SERVER_VERSION = "0.3" from time import sleep +from uuid import uuid4 as uuid from PyQt4.QtCore import * from PyQt4.QtGui import * @@ -35,6 +36,7 @@ class connector(QThread): self.running = True self.proxy = None self.addr = None + self.connectionID = None self.errorQueue = [] self.connect(self, SIGNAL("proxy_error"), self._proxyError) @@ -72,6 +74,7 @@ class connector(QThread): self.proxy = ServerProxy(addr, allow_none=True) try: server_version = self.proxy.get_server_version() + self.connectionID = uuid().hex except: return False if not server_version == SERVER_VERSION: @@ -124,7 +127,9 @@ class connector(QThread): """ self.mutex.lock() try: - return self.proxy.get_file_info(id) + info = self.proxy.get_file_info(id) + info["downloading"] = None + return info except Exception, e: self.emit(SIGNAL("proxy_error"), "getLinkInfo", e) finally: @@ -421,4 +426,16 @@ class connector(QThread): self.emit(SIGNAL("proxy_error"), "setCaptchaResult", e) finally: self.mutex.unlock() + + def getEvents(self): + """ + get events + """ + self.mutex.lock() + try: + return self.proxy.get_events(self.connectionID) + except Exception, e: + self.emit(SIGNAL("proxy_error"), "getEvents", e) + finally: + self.mutex.unlock() diff --git a/pyLoadCore.py b/pyLoadCore.py index 7aa38b9b1..dbc9dc1cd 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -59,6 +59,7 @@ from module.network.Request import Request import module.remote.SecureXMLRPCServer as Server from module.thread_list import Thread_List from module.web.ServerThread import WebServer +from module.PullEvents import PullManager class Core(object): """ pyLoad Core """ @@ -138,7 +139,8 @@ class Core(object): self.lastGuiConnected = 0 self.server_methods = ServerMethods(self) - self.file_list = File_List(self) + self.file_list = File_List(self) + self.pullManager = PullManager(self) self.thread_list = Thread_List(self) self.captchaManager = CaptchaManager(self) @@ -571,7 +573,10 @@ class ServerMethods(): return True else: return False - + + def get_events(self, uuid): + return self.core.pullManager.getEvents(uuid) + #def move_urls_up(self, ids): # for id in ids: # self.core.file_list.move(id) diff --git a/pyLoadGui.py b/pyLoadGui.py index 9e04cc003..c3deb9a6e 100755 --- a/pyLoadGui.py +++ b/pyLoadGui.py @@ -87,7 +87,6 @@ class main(QObject): self.mainloop.start() self.clipboard = self.app.clipboard() self.connect(self.clipboard, SIGNAL('dataChanged()'), self.slotClipboardChange) - self.connect(self.mainWindow, SIGNAL("pauseItemUpdate"), self.packageCollector.pauseItemUpdate) self.mainWindow.actions["clipboard"].setChecked(self.checkClipboard) def stopMain(self): @@ -106,8 +105,6 @@ class main(QObject): self.mainloop.wait() self.connector.wait() self.queue.wait() - self.linkCollector.wait() - self.packageCollector.wait() def connectSignals(self): """ @@ -216,7 +213,6 @@ class main(QObject): view.setDragDropOverwriteMode(True) self.connect(view, SIGNAL("droppedToPack"), self.slotAddFileToPackage) self.packageCollector = PackageCollector(view, self.connector) - self.packageCollector.start() def initLinkCollector(self): """ @@ -224,7 +220,6 @@ class main(QObject): * refresh thread """ self.linkCollector = LinkCollector(self.mainWindow.tabs["collector"]["package_view"], self.packageCollector.linkCollector, self.connector) - self.linkCollector.start() def initQueue(self): """ @@ -579,6 +574,16 @@ class main(QObject): def slotCaptchaDone(self, cid, result): self.connector.setCaptchaResult(str(cid), str(result)) + def pullEvents(self): + events = self.connector.getEvents() + for event in events: + if event[1] == "queue": + self.queue.addEvent(event) + elif event[1] == "packages": + self.packageCollector.addEvent(event) + elif event[1] == "collector": + self.linkCollector.addEvent(event) + class Loop(QThread): """ main loop (not application loop) @@ -602,6 +607,7 @@ class main(QObject): self.parent.refreshLog() self.parent.updateAvailable() self.parent.checkCaptcha() + self.parent.pullEvents() def stop(self): self.running = False -- cgit v1.2.3 From d27b972bffd0c38b3131dc46ff7a0f371508dffb Mon Sep 17 00:00:00 2001 From: mkaay Date: Mon, 1 Feb 2010 18:55:01 +0100 Subject: forgot file --- module/PullEvents.py | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 module/PullEvents.py diff --git a/module/PullEvents.py b/module/PullEvents.py new file mode 100644 index 000000000..7b23cf8b8 --- /dev/null +++ b/module/PullEvents.py @@ -0,0 +1,111 @@ +# -*- coding: utf-8 -*- + +""" + 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 . + + @author: mkaay +""" + +from time import time + +class PullManager(): + def __init__(self, core): + self.core = core + self.clients = [] + + def newClient(self, uuid): + self.clients.append(Client(uuid)) + + def clean(self): + for n, client in enumerate(self.clients): + if client.lastActive + 30 < time(): + del self.clients[n] + + def getEvents(self, uuid): + events = [] + validUuid = False + for client in self.clients: + if client.uuid == uuid: + client.lastActive = time() + validUuid = True + while client.newEvents(): + events.append(client.popEvent().toList()) + break + if not validUuid: + self.newClient(uuid) + events = [ReloadAllEvent("queue").toList(), ReloadAllEvent("packages").toList(), ReloadAllEvent("collector").toList()] + return events + + def addEvent(self, event): + for client in self.clients: + client.addEvent(event) + +class Client(): + def __init__(self, uuid): + self.uuid = uuid + self.lastActive = time() + self.events = [] + + def newEvents(self): + return (len(self.events) > 0) + + def popEvent(self): + if not len(self.events): + return None + return self.events.pop(0) + + def addEvent(self, event): + self.events.append(event) + +class UpdateEvent(): + def __init__(self, itype, iid, destination): + assert itype == "pack" or itype == "file" + assert destination == "queue" or destination == "collector" or destination == "packages" + self.type = itype + self.id = iid + self.destination = destination + + def toList(self): + return ["update", self.destination, self.type, self.id] + +class RemoveEvent(): + def __init__(self, itype, iid, destination): + assert itype == "pack" or itype == "file" + assert destination == "queue" or destination == "collector" or destination == "packages" + self.type = itype + self.id = iid + self.destination = destination + + def toList(self): + return ["remove", self.destination, self.type, self.id] + +class InsertEvent(): + def __init__(self, itype, iid, after, destination): + assert itype == "pack" or itype == "file" + assert destination == "queue" or destination == "collector" or destination == "packages" + self.type = itype + self.id = iid + self.after = after + self.destination = destination + + def toList(self): + return ["insert", self.destination, self.type, self.id, self.after] + +class ReloadAllEvent(): + def __init__(self, destination): + assert destination == "queue" or destination == "collector" or destination == "packages" + self.destination = destination + + def toList(self): + return ["reload", self.destination] -- cgit v1.2.3 From 129e50b8db2387f88a169e7d50e64cfb83651d8c Mon Sep 17 00:00:00 2001 From: spoob Date: Tue, 2 Feb 2010 13:27:08 +0100 Subject: Fixed time compare again in default --- pyLoadCore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyLoadCore.py b/pyLoadCore.py index dbc9dc1cd..98f525534 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -312,7 +312,7 @@ class Core(object): if start == end: return True - now = time.localtime()[3:5] + now = list(time.localtime()[3:5]) if start < now and end > now: return True elif start > end and (now > start or now < end): return True elif start < now and end < now and start > end: return True -- cgit v1.2.3 From fa88f83c282efa3f2fd1ad84c1e53975a6c48318 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Tue, 2 Feb 2010 20:04:02 +0100 Subject: systemCheck.py --- systemCheck.py | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 systemCheck.py diff --git a/systemCheck.py b/systemCheck.py new file mode 100644 index 000000000..7227bc674 --- /dev/null +++ b/systemCheck.py @@ -0,0 +1,158 @@ +import os +from os.path import dirname +from os.path import exists +from os.path import join +import subprocess +import sys + +def main(): + print "##### System Information #####" + print "" + print "Platform:", sys.platform + print "Operating System:", os.name + print "Python:", sys.version.replace("\n", "") + print os.uname() + print "" + + try: + import pycurl + print "pycurl:", pycurl.version + except: + print "pycurl:", "missing" + + try: + import Crypto + print "py-crypto:", Crypto.__version__ + except: + print "py-crypto:", "missing" + + + try: + import OpenSSL + print "OpenSSL:", OpenSSL.version.__version__ + except: + print "OpenSSL:", "missing" + + try: + import Image + print "image libary:", Image.VERSION + except: + print "image libary:", "missing" + + try: + import django + print "django:", django.get_version() + except: + print "django:", "missing" + + try: + import PyQt4 + print "pyqt:", "4" + except: + print "pyqt:", "missing" + + print "" + print "" + print "##### System Status #####" + print "" + print "## pyLoadCore ##" + + core_err = [] + + if sys.version_info > (2, 7): + core_err.append("Your python version is to new, Please use Python 2.6") + + if sys.version_info < (2, 5): + core_err.append("Your python version is to old, Please use at least Python 2.5") + + try: + import pycurl + except: + core_err.append("Please install py-curl to use pyLoad.") + + try: + import Image + except: + core_err.append("Please install py-imaging/pil to use Hoster, which uses captchas.") + + + pipe = subprocess.PIPE + try: + p = subprocess.call(["tesseract"], stdout=pipe, stderr=pipe) + except: + core_err.append("Please install tesseract to use Hoster, which uses captchas.") + + try: + p = subprocess.call(["gocr"], stdout=pipe, stderr=pipe) + except: + core_err.append("Install gocr to use some Hoster, which uses captchas.") + + try: + import OpenSSL + except: + core_err.append("Install OpenSSL if you want to create a secure connection to the core.") + + + + if core_err: + print "The system check has detected some errors:" + print "" + for err in core_err: + print err + else: + print "No Problems detected, pyLoadCore should work fine." + + + print "" + print "## pyLoadGui ##" + + gui_err = [] + + try: + import PyQt4 + except: + gui_err.append("GUI won't work without pyqt4 !!") + + + if gui_err: + print "The system check has detected some errors:" + print "" + for err in gui_err: + print err + else: + print "No Problems detected, pyLoadGui should work fine." + + print "" + print "## Webinterface ##" + + web_err = [] + + try: + import django + + if django.VERSION < (1, 1): + web_err.append("Your django version is to old, please upgrade to django 1.1") + elif django.VERSION > (1, 2): + web_err.append("Your django version is to new, please use django 1.1") + + except: + web_err.append("Webinterface won't work without django !!") + + + + if not exists(join(dirname(__file__), "module", "web", "pyload.db")): + web_err.append("You dont have created database yet.") + web_err.append("Please run: python %s syncdb" % join(dirname(__file__), "module", "web", "manage.py")) + + + + if web_err: + print "The system check has detected some errors:" + print "" + for err in web_err: + print err + else: + print "No Problems detected, Webinterface should work fine." + +if __name__ == "__main__": + main() \ No newline at end of file -- cgit v1.2.3 From dc97a68f74dc0966b1df9e8f8231d76ecd9f2673 Mon Sep 17 00:00:00 2001 From: mkaay Date: Tue, 2 Feb 2010 22:15:48 +0100 Subject: some gui fixes, i18n update --- locale/de/de.po | 219 +++++++++++++++++++++------ locale/en/en.po | 219 ++++++++++++++++++++++----- locale/fr/fr.po | 215 +++++++++++++++++++++----- locale/messages.pot | 191 +++++++++++++++++++---- module/download_thread.py | 50 +++--- module/file_list.py | 8 +- module/gui/Collector.py | 15 +- module/gui/Queue.py | 11 +- module/gui/connector.py | 3 +- module/plugins/decrypter/SerienjunkiesOrg.py | 1 + module/thread_list.py | 57 +++---- pyLoadCore.py | 36 ++--- 12 files changed, 795 insertions(+), 230 deletions(-) diff --git a/locale/de/de.po b/locale/de/de.po index 471d543cf..1994499df 100644 --- a/locale/de/de.po +++ b/locale/de/de.po @@ -4,69 +4,202 @@ # msgid "" msgstr "" -"Project-Id-Version: 0.1\n" -"POT-Creation-Date: 2009-06-04 15:33+CEST\n" -"PO-Revision-Date: 2009-06-05 18:27+0100\n" -"Last-Translator: spoob \n" -"Language-Team: pyLoad \n" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-02-02 21:54+CET\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: ENCODING\n" "Generated-By: pygettext.py 1.5\n" -#: Core.py:59 + +#: module/download_thread.py:115 +msgid "Hoster unvailable, wait 60 seconds" +msgstr "" + +#: module/download_thread.py:117 +msgid "Error getting error code: %s" +msgstr "" + +#: module/download_thread.py:163 +msgid "Checksum ok ('%s')" +msgstr "" + +#: module/download_thread.py:165 +msgid "Checksum not matched! ('%s')" +msgstr "" + +#: module/download_thread.py:167 +msgid "Can't get checksum for %s" +msgstr "" + +#: module/download_thread.py:169 +msgid "Checksum not implemented for %s" +msgstr "" + +#: module/file_list.py:87 +msgid "Found %s links in linkcollector" +msgstr "" + +#: module/file_list.py:89 +msgid "Found %s unqueued packages" +msgstr "" + +#: module/file_list.py:91 +msgid "Added %s packages to queue" +msgstr "" + +#: module/thread_list.py:88 +msgid "Get links from: %s" +msgstr "" + +#: module/thread_list.py:90 +msgid "Download starts: %s" +msgstr "" + +#: module/thread_list.py:136 +msgid "Parsed links from %s: %i" +msgstr "" + +#: module/thread_list.py:138 +msgid "No links in %s" +msgstr "" + +#: module/thread_list.py:145 +msgid "Download finished: %s" +msgstr "" + +#: module/thread_list.py:151 +msgid "Download failed: %s | %s" +msgstr "" + +#: module/thread_list.py:156 +msgid "Download aborted: %s" +msgstr "" + +#: module/thread_list.py:206 +msgid "Starting reconnect" +msgstr "" + +#: module/thread_list.py:220 +msgid "Reconnected, new IP: %s" +msgstr "" + +#: pyLoadCore.py:111 +msgid "pycrypto to decode container files" +msgstr "" + +#: pyLoadCore.py:112 +msgid "Python Image Libary (PIL) for captha reading" +msgstr "" + +#: pyLoadCore.py:113 +msgid "pycurl for lower memory footprint while downloading" +msgstr "" + +#: pyLoadCore.py:114 +msgid "Django for webinterface" +msgstr "" + +#: pyLoadCore.py:115 +msgid "tesseract for captcha reading" +msgstr "" + +#: pyLoadCore.py:116 +msgid "gocr for captcha reading" +msgstr "" + +#: pyLoadCore.py:118 msgid "folder for logs" -msgstr "Ordner für Logs" +msgstr "" -#: Core.py:60 +#: pyLoadCore.py:119 msgid "folder for downloads" -msgstr "Ordner für Downloads" +msgstr "" -#: Core.py:61 +#: pyLoadCore.py:120 msgid "file for links" -msgstr "Linkdatei" +msgstr "" -#: Core.py:62 +#: pyLoadCore.py:121 msgid "file for failed links" -msgstr "Datei für felgeschlagene Links" +msgstr "" -#: Core.py:68 +#: pyLoadCore.py:124 +msgid "OpenSSL for secure connection" +msgstr "" + +#: pyLoadCore.py:125 +msgid "ssl certificate" +msgstr "" + +#: pyLoadCore.py:126 +msgid "ssl key" +msgstr "" + +#: pyLoadCore.py:150 msgid "Downloadtime: %s" -msgstr "Downloadzeit: %s" +msgstr "" -#: Core.py:96 -msgid "added" -msgstr "Hinzugefügt" +#: pyLoadCore.py:179 +msgid "restarting pyLoad" +msgstr "" -#: Core.py:97 -msgid "created index of plugins" -msgstr "Plugin Index erstellt" +#: pyLoadCore.py:183 +msgid "pyLoad quits" +msgstr "" -#: Core.py:119 -msgid "new update %s on pyload.org" -msgstr "Neue Version %s auf pyload.org verfügbar!" +#: pyLoadCore.py:194 +msgid "Secure XMLRPC Server Started" +msgstr "" -#: Core.py:121 -msgid "newst version %s in use:" -msgstr "Neueste Version %s in Benutzung" +#: pyLoadCore.py:197 +msgid "Auth XMLRPC Server Started" +msgstr "" -#: Core.py:123 -msgid "beta version %s in use:" -msgstr "Beta Version %s in Benutzung" +#: pyLoadCore.py:203 +msgid "Failed starting XMLRPC server, CLI and GUI will not be available: %s" +msgstr "" -#: Core.py:132 +#: pyLoadCore.py:272 msgid "%s created" -msgstr "%s erstellt" +msgstr "" + +#: pyLoadCore.py:275 +msgid "could not find %s: %s" +msgstr "" + +#: pyLoadCore.py:277 +msgid "could not create %s: %s" +msgstr "" + +#: pyLoadCore.py:305 +msgid "%s added" +msgstr "" -#: Core.py:134 -msgid "could not create %s" -msgstr "Konnte %s nicht erstellen" +#: pyLoadCore.py:306 +msgid "created index of plugins" +msgstr "" + +#: pyLoadCore.py:325 +msgid "shutting down..." +msgstr "" + +#: pyLoadCore.py:341 +msgid "No Updates for pyLoad" +msgstr "" -#: Core.py:194 -msgid "%i seconds" -msgstr "%i Sekunden" +#: pyLoadCore.py:344 +msgid "New pyLoad Version %s available" +msgstr "" -#: Core.py:222 -msgid "Server Mode" -msgstr "Servermodus" +#: pyLoadCore.py:369 +msgid "Auto install Failed" +msgstr "" + +#: pyLoadCore.py:607 +msgid "killed pyLoad from Terminal" +msgstr "" diff --git a/locale/en/en.po b/locale/en/en.po index 87e646735..4d5bc4ee3 100644 --- a/locale/en/en.po +++ b/locale/en/en.po @@ -4,65 +4,206 @@ # msgid "" msgstr "" -"Project-Id-Version: 0.1\n" -"POT-Creation-Date: 2009-06-05 18:26+CEST\n" -"PO-Revision-Date: 2009-06-05 18:28+0100\n" -"Last-Translator: spoob \n" -"Language-Team: pyLoad \n" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-02-02 21:54+CET\n" +"PO-Revision-Date: 2010-02-02 23:05+0200\n" +"Last-Translator: Marius \n" +"Language-Team: LANGUAGE \n" +"Language: de\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 2.0.0\n" "Generated-By: pygettext.py 1.5\n" -#: Core.py:59 +#: module/download_thread.py:115 +msgid "Hoster unvailable, wait 60 seconds" +msgstr "Hoster unvailable, wait 60 seconds" + +#: module/download_thread.py:117 +msgid "Error getting error code: %s" +msgstr "Error getting error code: %s" + +#: module/download_thread.py:163 +msgid "Checksum ok ('%s')" +msgstr "Checksum ok ('%s')" + +#: module/download_thread.py:165 +msgid "Checksum not matched! ('%s')" +msgstr "Checksum not matched! ('%s')" + +#: module/download_thread.py:167 +msgid "Can't get checksum for %s" +msgstr "Can't get checksum for %s" + +#: module/download_thread.py:169 +msgid "Checksum not implemented for %s" +msgstr "Checksum not implemented for %s" + +#: module/file_list.py:87 +msgid "Found %s links in linkcollector" +msgstr "Found %s links in linkcollector" + +#: module/file_list.py:89 +msgid "Found %s unqueued packages" +msgstr "Found %s unqueued packages" + +#: module/file_list.py:91 +msgid "Added %s packages to queue" +msgstr "Added %s packages to queue" + +#: module/thread_list.py:88 +msgid "Get links from: %s" +msgstr "Get links from: %s" + +#: module/thread_list.py:90 +msgid "Download starts: %s" +msgstr "Download starts: %s" + +#: module/thread_list.py:136 +msgid "Parsed links from %s: %i" +msgstr "Parsed links from %s: %i" + +#: module/thread_list.py:138 +msgid "No links in %s" +msgstr "No links in %s" + +#: module/thread_list.py:145 +msgid "Download finished: %s" +msgstr "Download finished: %s" + +#: module/thread_list.py:151 +msgid "Download failed: %s | %s" +msgstr "Download failed: %s | %s" + +#: module/thread_list.py:156 +msgid "Download aborted: %s" +msgstr "Download aborted: %s" + +#: module/thread_list.py:206 +msgid "Starting reconnect" +msgstr "Starting reconnect" + +#: module/thread_list.py:220 +msgid "Reconnected, new IP: %s" +msgstr "Reconnected, new IP: %s" + +#: pyLoadCore.py:111 +msgid "pycrypto to decode container files" +msgstr "pycrypto to decode container files" + +#: pyLoadCore.py:112 +msgid "Python Image Libary (PIL) for captha reading" +msgstr "Python Image Libary (PIL) for captha reading" + +#: pyLoadCore.py:113 +msgid "pycurl for lower memory footprint while downloading" +msgstr "pycurl for lower memory footprint while downloading" + +#: pyLoadCore.py:114 +msgid "Django for webinterface" +msgstr "Django for webinterface" + +#: pyLoadCore.py:115 +msgid "tesseract for captcha reading" +msgstr "tesseract for captcha reading" + +#: pyLoadCore.py:116 +msgid "gocr for captcha reading" +msgstr "gocr for captcha reading" + +#: pyLoadCore.py:118 msgid "folder for logs" -msgstr "" +msgstr "folder for logs" -#: Core.py:60 +#: pyLoadCore.py:119 msgid "folder for downloads" -msgstr "" +msgstr "folder for downloads" -#: Core.py:61 +#: pyLoadCore.py:120 msgid "file for links" -msgstr "" +msgstr "file for links" -#: Core.py:62 +#: pyLoadCore.py:121 msgid "file for failed links" -msgstr "" +msgstr "file for failed links" + +#: pyLoadCore.py:124 +msgid "OpenSSL for secure connection" +msgstr "OpenSSL for secure connection" + +#: pyLoadCore.py:125 +msgid "ssl certificate" +msgstr "ssl certificate" + +#: pyLoadCore.py:126 +msgid "ssl key" +msgstr "ssl key" -#: Core.py:68 +#: pyLoadCore.py:150 msgid "Downloadtime: %s" -msgstr "" +msgstr "Downloadtime: %s" -#: Core.py:96 -msgid " added" -msgstr "" +#: pyLoadCore.py:179 +msgid "restarting pyLoad" +msgstr "restarting pyLoad" -#: Core.py:97 -msgid "created index of plugins" -msgstr "" +#: pyLoadCore.py:183 +msgid "pyLoad quits" +msgstr "pyLoad quits" -#: Core.py:119 -msgid "new update %s on pyload.org" -msgstr "" +#: pyLoadCore.py:194 +msgid "Secure XMLRPC Server Started" +msgstr "Secure XMLRPC Server Started" -#: Core.py:121 -msgid "newst version %s in use:" -msgstr "" +#: pyLoadCore.py:197 +msgid "Auth XMLRPC Server Started" +msgstr "Auth XMLRPC Server Started" -#: Core.py:123 -msgid "beta version %s in use:" -msgstr "" +#~ msgid "Failed starting socket server, CLI and GUI will not be available: %s" +#~ msgstr "" -#: Core.py:132 +#: pyLoadCore.py:272 msgid "%s created" -msgstr "" +msgstr "%s created" -#: Core.py:194 -msgid "%i seconds" -msgstr "" +#: pyLoadCore.py:275 +msgid "could not find %s: %s" +msgstr "could not find %s: %s" -#: Core.py:222 -msgid "Server Mode" -msgstr "" +#: pyLoadCore.py:277 +msgid "could not create %s: %s" +msgstr "could not create %s: %s" + +#: pyLoadCore.py:305 +msgid "%s added" +msgstr "%s added" + +#: pyLoadCore.py:306 +msgid "created index of plugins" +msgstr "created index of plugins" + +#: pyLoadCore.py:325 +msgid "shutting down..." +msgstr "shutting down..." + +#: pyLoadCore.py:341 +msgid "No Updates for pyLoad" +msgstr "No Updates for pyLoad" + +#: pyLoadCore.py:344 +msgid "New pyLoad Version %s available" +msgstr "New pyLoad Version %s available" + +#: pyLoadCore.py:369 +msgid "Auto install Failed" +msgstr "Auto install Failed" + +#: pyLoadCore.py:607 +msgid "killed pyLoad from Terminal" +msgstr "killed pyLoad from Terminal" +#: pyLoadCore.py:203 +msgid "Failed starting XMLRPC server, CLI and GUI will not be available: %s" +msgstr "Failed starting XMLRPC server, CLI and GUI will not be available: %s" diff --git a/locale/fr/fr.po b/locale/fr/fr.po index fbe233952..1994499df 100644 --- a/locale/fr/fr.po +++ b/locale/fr/fr.po @@ -5,64 +5,201 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2009-06-04 15:33+CEST\n" -"PO-Revision-Date: 2009-06-04 23:09+0100\n" -"Last-Translator: spoob \n" +"POT-Creation-Date: 2010-02-02 21:54+CET\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: ENCODING\n" "Generated-By: pygettext.py 1.5\n" -#: Core.py:59 + +#: module/download_thread.py:115 +msgid "Hoster unvailable, wait 60 seconds" +msgstr "" + +#: module/download_thread.py:117 +msgid "Error getting error code: %s" +msgstr "" + +#: module/download_thread.py:163 +msgid "Checksum ok ('%s')" +msgstr "" + +#: module/download_thread.py:165 +msgid "Checksum not matched! ('%s')" +msgstr "" + +#: module/download_thread.py:167 +msgid "Can't get checksum for %s" +msgstr "" + +#: module/download_thread.py:169 +msgid "Checksum not implemented for %s" +msgstr "" + +#: module/file_list.py:87 +msgid "Found %s links in linkcollector" +msgstr "" + +#: module/file_list.py:89 +msgid "Found %s unqueued packages" +msgstr "" + +#: module/file_list.py:91 +msgid "Added %s packages to queue" +msgstr "" + +#: module/thread_list.py:88 +msgid "Get links from: %s" +msgstr "" + +#: module/thread_list.py:90 +msgid "Download starts: %s" +msgstr "" + +#: module/thread_list.py:136 +msgid "Parsed links from %s: %i" +msgstr "" + +#: module/thread_list.py:138 +msgid "No links in %s" +msgstr "" + +#: module/thread_list.py:145 +msgid "Download finished: %s" +msgstr "" + +#: module/thread_list.py:151 +msgid "Download failed: %s | %s" +msgstr "" + +#: module/thread_list.py:156 +msgid "Download aborted: %s" +msgstr "" + +#: module/thread_list.py:206 +msgid "Starting reconnect" +msgstr "" + +#: module/thread_list.py:220 +msgid "Reconnected, new IP: %s" +msgstr "" + +#: pyLoadCore.py:111 +msgid "pycrypto to decode container files" +msgstr "" + +#: pyLoadCore.py:112 +msgid "Python Image Libary (PIL) for captha reading" +msgstr "" + +#: pyLoadCore.py:113 +msgid "pycurl for lower memory footprint while downloading" +msgstr "" + +#: pyLoadCore.py:114 +msgid "Django for webinterface" +msgstr "" + +#: pyLoadCore.py:115 +msgid "tesseract for captcha reading" +msgstr "" + +#: pyLoadCore.py:116 +msgid "gocr for captcha reading" +msgstr "" + +#: pyLoadCore.py:118 msgid "folder for logs" -msgstr "Dossier pour des logs" +msgstr "" -#: Core.py:60 +#: pyLoadCore.py:119 msgid "folder for downloads" -msgstr "Dossier téléchargement" +msgstr "" -#: Core.py:61 +#: pyLoadCore.py:120 msgid "file for links" -msgstr "Fichier du lien hypertexte" +msgstr "" -#: Core.py:68 +#: pyLoadCore.py:121 +msgid "file for failed links" +msgstr "" + +#: pyLoadCore.py:124 +msgid "OpenSSL for secure connection" +msgstr "" + +#: pyLoadCore.py:125 +msgid "ssl certificate" +msgstr "" + +#: pyLoadCore.py:126 +msgid "ssl key" +msgstr "" + +#: pyLoadCore.py:150 msgid "Downloadtime: %s" -msgstr "Temp du téléchargement: %s" +msgstr "" -#: Core.py:96 -msgid " added" -msgstr "Ajouté." +#: pyLoadCore.py:179 +msgid "restarting pyLoad" +msgstr "" -#: Core.py:97 -msgid "created index of plugins" -msgstr "Un indice des Plugins a été créé." +#: pyLoadCore.py:183 +msgid "pyLoad quits" +msgstr "" -#: Core.py:119 -msgid "new update %s on pyload.org" -msgstr "Il y a un mise à jour - pyLoad %s - sur pyload.org" +#: pyLoadCore.py:194 +msgid "Secure XMLRPC Server Started" +msgstr "" -#: Core.py:121 -msgid "newst version %s in use:" -msgstr "Tu utilises la version %s." +#: pyLoadCore.py:197 +msgid "Auth XMLRPC Server Started" +msgstr "" -#: Core.py:123 -msgid "beta version %s in use:" -msgstr "Tu utilises pyLoad %s - une version beta." +#: pyLoadCore.py:203 +msgid "Failed starting XMLRPC server, CLI and GUI will not be available: %s" +msgstr "" -#: Core.py:132 +#: pyLoadCore.py:272 msgid "%s created" -msgstr "%s a été créé." +msgstr "" -#: Core.py:134 -msgid "could not create %s" -msgstr "Il était impossible de créer %s." +#: pyLoadCore.py:275 +msgid "could not find %s: %s" +msgstr "" -#: Core.py:194 -msgid "%i seconds" -msgstr "%s secondes." +#: pyLoadCore.py:277 +msgid "could not create %s: %s" +msgstr "" + +#: pyLoadCore.py:305 +msgid "%s added" +msgstr "" -#: Core.py:222 -msgid "Server Mode" -msgstr "Mode de Serveur." +#: pyLoadCore.py:306 +msgid "created index of plugins" +msgstr "" + +#: pyLoadCore.py:325 +msgid "shutting down..." +msgstr "" + +#: pyLoadCore.py:341 +msgid "No Updates for pyLoad" +msgstr "" + +#: pyLoadCore.py:344 +msgid "New pyLoad Version %s available" +msgstr "" + +#: pyLoadCore.py:369 +msgid "Auto install Failed" +msgstr "" + +#: pyLoadCore.py:607 +msgid "killed pyLoad from Terminal" +msgstr "" diff --git a/locale/messages.pot b/locale/messages.pot index 87e646735..1994499df 100644 --- a/locale/messages.pot +++ b/locale/messages.pot @@ -4,65 +4,202 @@ # msgid "" msgstr "" -"Project-Id-Version: 0.1\n" -"POT-Creation-Date: 2009-06-05 18:26+CEST\n" -"PO-Revision-Date: 2009-06-05 18:28+0100\n" -"Last-Translator: spoob \n" -"Language-Team: pyLoad \n" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-02-02 21:54+CET\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: ENCODING\n" "Generated-By: pygettext.py 1.5\n" -#: Core.py:59 + +#: module/download_thread.py:115 +msgid "Hoster unvailable, wait 60 seconds" +msgstr "" + +#: module/download_thread.py:117 +msgid "Error getting error code: %s" +msgstr "" + +#: module/download_thread.py:163 +msgid "Checksum ok ('%s')" +msgstr "" + +#: module/download_thread.py:165 +msgid "Checksum not matched! ('%s')" +msgstr "" + +#: module/download_thread.py:167 +msgid "Can't get checksum for %s" +msgstr "" + +#: module/download_thread.py:169 +msgid "Checksum not implemented for %s" +msgstr "" + +#: module/file_list.py:87 +msgid "Found %s links in linkcollector" +msgstr "" + +#: module/file_list.py:89 +msgid "Found %s unqueued packages" +msgstr "" + +#: module/file_list.py:91 +msgid "Added %s packages to queue" +msgstr "" + +#: module/thread_list.py:88 +msgid "Get links from: %s" +msgstr "" + +#: module/thread_list.py:90 +msgid "Download starts: %s" +msgstr "" + +#: module/thread_list.py:136 +msgid "Parsed links from %s: %i" +msgstr "" + +#: module/thread_list.py:138 +msgid "No links in %s" +msgstr "" + +#: module/thread_list.py:145 +msgid "Download finished: %s" +msgstr "" + +#: module/thread_list.py:151 +msgid "Download failed: %s | %s" +msgstr "" + +#: module/thread_list.py:156 +msgid "Download aborted: %s" +msgstr "" + +#: module/thread_list.py:206 +msgid "Starting reconnect" +msgstr "" + +#: module/thread_list.py:220 +msgid "Reconnected, new IP: %s" +msgstr "" + +#: pyLoadCore.py:111 +msgid "pycrypto to decode container files" +msgstr "" + +#: pyLoadCore.py:112 +msgid "Python Image Libary (PIL) for captha reading" +msgstr "" + +#: pyLoadCore.py:113 +msgid "pycurl for lower memory footprint while downloading" +msgstr "" + +#: pyLoadCore.py:114 +msgid "Django for webinterface" +msgstr "" + +#: pyLoadCore.py:115 +msgid "tesseract for captcha reading" +msgstr "" + +#: pyLoadCore.py:116 +msgid "gocr for captcha reading" +msgstr "" + +#: pyLoadCore.py:118 msgid "folder for logs" msgstr "" -#: Core.py:60 +#: pyLoadCore.py:119 msgid "folder for downloads" msgstr "" -#: Core.py:61 +#: pyLoadCore.py:120 msgid "file for links" msgstr "" -#: Core.py:62 +#: pyLoadCore.py:121 msgid "file for failed links" msgstr "" -#: Core.py:68 +#: pyLoadCore.py:124 +msgid "OpenSSL for secure connection" +msgstr "" + +#: pyLoadCore.py:125 +msgid "ssl certificate" +msgstr "" + +#: pyLoadCore.py:126 +msgid "ssl key" +msgstr "" + +#: pyLoadCore.py:150 msgid "Downloadtime: %s" msgstr "" -#: Core.py:96 -msgid " added" +#: pyLoadCore.py:179 +msgid "restarting pyLoad" msgstr "" -#: Core.py:97 -msgid "created index of plugins" +#: pyLoadCore.py:183 +msgid "pyLoad quits" msgstr "" -#: Core.py:119 -msgid "new update %s on pyload.org" +#: pyLoadCore.py:194 +msgid "Secure XMLRPC Server Started" msgstr "" -#: Core.py:121 -msgid "newst version %s in use:" +#: pyLoadCore.py:197 +msgid "Auth XMLRPC Server Started" msgstr "" -#: Core.py:123 -msgid "beta version %s in use:" +#: pyLoadCore.py:203 +msgid "Failed starting XMLRPC server, CLI and GUI will not be available: %s" msgstr "" -#: Core.py:132 +#: pyLoadCore.py:272 msgid "%s created" msgstr "" -#: Core.py:194 -msgid "%i seconds" +#: pyLoadCore.py:275 +msgid "could not find %s: %s" +msgstr "" + +#: pyLoadCore.py:277 +msgid "could not create %s: %s" +msgstr "" + +#: pyLoadCore.py:305 +msgid "%s added" +msgstr "" + +#: pyLoadCore.py:306 +msgid "created index of plugins" +msgstr "" + +#: pyLoadCore.py:325 +msgid "shutting down..." +msgstr "" + +#: pyLoadCore.py:341 +msgid "No Updates for pyLoad" +msgstr "" + +#: pyLoadCore.py:344 +msgid "New pyLoad Version %s available" +msgstr "" + +#: pyLoadCore.py:369 +msgid "Auto install Failed" msgstr "" -#: Core.py:222 -msgid "Server Mode" +#: pyLoadCore.py:607 +msgid "killed pyLoad from Terminal" msgstr "" 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 . -# -### + +""" + 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 . + + @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 . -# -### + +""" + 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 . + + @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: (.*).*", 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 diff --git a/pyLoadCore.py b/pyLoadCore.py index dbc9dc1cd..9df831aed 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -108,12 +108,12 @@ class Core(object): translation = gettext.translation("pyLoad", join(self.path, "locale"), languages=[self.config['general']['language']]) translation.install(unicode=True) - self.check_install("Crypto", "pycrypto to decode container files") - self.check_install("Image", "Python Image Libary (PIL) for captha reading") - self.check_install("pycurl", "pycurl for lower memory footprint while downloading") - self.check_install("django", "Django for webinterface") - self.check_install("tesseract", "tesseract for captcha reading", False) - self.check_install("gocr", "gocr for captcha reading", False) + self.check_install("Crypto", _("pycrypto to decode container files")) + self.check_install("Image", _("Python Image Libary (PIL) for captha reading")) + self.check_install("pycurl", _("pycurl for lower memory footprint while downloading")) + self.check_install("django", _("Django for webinterface")) + self.check_install("tesseract", _("tesseract for captcha reading"), False) + self.check_install("gocr", _("gocr for captcha reading"), False) self.check_file(self.config['log']['log_folder'], _("folder for logs"), True) self.check_file(self.config['general']['download_folder'], _("folder for downloads"), True) @@ -121,7 +121,7 @@ class Core(object): self.check_file(self.config['general']['failed_file'], _("file for failed links")) if self.config['ssl']['activated']: - self.check_install("OpenSSL", "OpenSSL for secure connection", True) + self.check_install("OpenSSL", _("OpenSSL for secure connection"), True) self.check_file(self.config['ssl']['cert'], _("ssl certificate"), False, True) self.check_file(self.config['ssl']['key'], _("ssl key"), False, True) @@ -176,11 +176,11 @@ class Core(object): while True: sleep(2) if self.do_restart: - self.logger.info("restarting pyLoad") + self.logger.info(_("restarting pyLoad")) self.restart() if self.do_kill: self.shutdown() - self.logger.info("pyLoad quits") + self.logger.info(_("pyLoad quits")) exit() if self.last_update_check + self.update_check_interval <= time.time(): self.update_available = self.check_update() @@ -191,16 +191,16 @@ class Core(object): usermap = {self.config['remote']['username']: self.config['remote']['password']} if self.config['ssl']['activated']: self.server = Server.SecureXMLRPCServer(server_addr, self.config['ssl']['cert'], self.config['ssl']['key'], usermap) - self.logger.info("Secure XMLRPC Server Started") + self.logger.info(_("Secure XMLRPC Server Started")) else: self.server = Server.AuthXMLRPCServer(server_addr, usermap) - self.logger.info("Auth XMLRPC Server Started") + self.logger.info(_("Auth XMLRPC Server Started")) self.server.register_instance(self.server_methods) thread.start_new_thread(self.server.serve_forever, ()) except Exception, e: - self.logger.error("Failed starting socket server, CLI and GUI will not be available: %s" % str(e)) + self.logger.error(_("Failed starting XMLRPC server CLI and GUI will not be available: %s") % str(e)) if self.config['general']['debug_mode']: import traceback traceback.print_exc() @@ -302,7 +302,7 @@ class Core(object): break if plugin_pattern != "": self.plugins_avaible[plugin_file] = plugin_pattern - self.logger.debug(plugin_file + _(" added")) + self.logger.debug(_("%s added") % plugin_file) self.logger.info(_("created index of plugins")) def compare_time(self, start, end): @@ -322,7 +322,7 @@ class Core(object): return self.downloadSpeedLimit def shutdown(self): - self.logger.info("shutting down...") + self.logger.info(_("shutting down...")) if self.config['webinterface']['activated']: self.webserver.quit() self.webserver.join() @@ -338,10 +338,10 @@ class Core(object): if self.config['updates']['search_updates']: version_check = Request().load("http://get.pyload.org/check/%s/" % (CURRENT_VERSION, )) if version_check == "": - self.logger.info("No Updates for pyLoad") + self.logger.info(_("No Updates for pyLoad")) return False else: - self.logger.info("New pyLoad Version %s available" % version_check) + self.logger.info(_("New pyLoad Version %s available") % version_check) return True else: return False @@ -366,7 +366,7 @@ class Core(object): __import__("module.Unzip", globals(), locals(), "Unzip", -1).Unzip().extract(tmp_zip_name, "Test/") return True except: - self.logger.info("Auto install Failed") + self.logger.info(_("Auto install Failed")) return False else: return False @@ -604,5 +604,5 @@ if __name__ == "__main__": pyload_core.start() except KeyboardInterrupt: pyload_core.shutdown() - pyload_core.logger.info("killed pyLoad from Terminal") + pyload_core.logger.info(_("killed pyLoad from Terminal")) exit() -- cgit v1.2.3 From 58ff65301f3edeb1fcffae36b2fd6df3aa46258b Mon Sep 17 00:00:00 2001 From: mkaay Date: Tue, 2 Feb 2010 22:17:09 +0100 Subject: closes #70, thx kepheus --- module/plugins/container/CCF.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/module/plugins/container/CCF.py b/module/plugins/container/CCF.py index 88b567904..12728d022 100644 --- a/module/plugins/container/CCF.py +++ b/module/plugins/container/CCF.py @@ -2,7 +2,6 @@ # -*- coding: utf-8 -*- import os.path -import random import re import tempfile import urllib2 @@ -36,20 +35,11 @@ class CCF(Plugin): "upload": open(infile, "rb")} tempdlc_content = opener.open('http://service.jdownloader.net/dlcrypt/getDLC.php', params).read() - random.seed() - tempdir = tempfile.gettempdir() - if tempdir[0] == '/': - delim = '/' - else: - delim = '\\' - tempdlc_name = tempdir + delim + str(random.randint(0, 100)) + '-tmp.dlc' - while os.path.exists(tempdlc_name): - tempdlc_name = tempfile.gettempdir() + '/' + str(random.randint(0, 100)) + '-tmp.dlc' - - tempdlc = open(tempdlc_name, "w") + tempdlc = tempfile.NamedTemporaryFile(delete=False, suffix='.dlc') tempdlc.write(re.search(r'(.*)', tempdlc_content, re.DOTALL).group(1)) - tempdlc.close + tempdlc.close() - self.links.append(tempdlc_name) + self.links.append(tempdlc.name) return True + -- cgit v1.2.3