diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-06-11 13:31:01 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-06-11 13:31:01 +0200 |
commit | ace4ced0f245c98f0ded17bed5cf293dca51c5e0 (patch) | |
tree | e55a5d483bd41435e5a07959f85630e25598e209 | |
parent | merged (diff) | |
download | pyload-ace4ced0f245c98f0ded17bed5cf293dca51c5e0.tar.xz |
~DLC Support~ , closed #10
-rw-r--r-- | .hgignore | 4 | ||||
-rw-r--r-- | Core.py | 6 | ||||
-rw-r--r-- | Plugins/CCF.py | 18 | ||||
-rw-r--r-- | Plugins/DLC.pyc | bin | 0 -> 3692 bytes | |||
-rw-r--r-- | config | 2 | ||||
-rw-r--r-- | module/thread_list.py | 11 |
6 files changed, 23 insertions, 18 deletions
@@ -8,4 +8,6 @@ syntax: glob *.egg-info *.project *.pydevproject -Downloads/*
\ No newline at end of file +Downloads/* +Logs/* +Plugins/DLC.py
\ No newline at end of file @@ -85,10 +85,10 @@ class Core(object): self.config[option] = False if self.config[option].lower() == 'false' else self.config[option] def create_plugin_index(self): - for file_handler in glob(self.config['plugin_folder'] + sep + '*.py'): + for file_handler in glob(self.config['plugin_folder'] + sep + '*.py') + glob(self.config['plugin_folder'] + sep + 'DLC.pyc'): if file_handler != self.config['plugin_folder'] + sep + "Plugin.py": plugin_pattern = "" - plugin_file = basename(file_handler).replace('.py', '') + 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] @@ -143,7 +143,7 @@ class Core(object): def init_logger(self, level): - file_handler = logging.handlers.RotatingFileHandler(self.config['log_folder'] + sep + 'log.txt', maxBytes=102400, backupCount=self.config['log_count']) #100 kib * 5 + file_handler = logging.handlers.RotatingFileHandler(self.config['log_folder'] + sep + 'log.txt', maxBytes=102400, backupCount=int(self.config['log_count'])) #100 kib * 5 console = logging.StreamHandler(stdout) frm = logging.Formatter("%(asctime)s: %(levelname)-8s %(message)s", "%d.%m.%Y %H:%M:%S") diff --git a/Plugins/CCF.py b/Plugins/CCF.py index 9fe3a8546..e583bfbb3 100644 --- a/Plugins/CCF.py +++ b/Plugins/CCF.py @@ -1,14 +1,14 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -import urllib2 -from module.network.MultipartPostHandler import MultipartPostHandler -import tempfile import os.path import random import re +import tempfile +import urllib2 from Plugin import Plugin +from module.network.MultipartPostHandler import MultipartPostHandler class CCF(Plugin): @@ -36,9 +36,9 @@ class CCF(Plugin): infile = url.replace("\n", "") opener = urllib2.build_opener(MultipartPostHandler) - params = { "src" : "ccf", - "filename" : "test.ccf", - "upload" : open(infile, "rb") } + params = {"src": "ccf", + "filename": "test.ccf", + "upload": open(infile, "rb")} tempdlc_content = opener.open('http://service.jdownloader.net/dlcrypt/getDLC.php', params).read() random.seed() @@ -47,11 +47,11 @@ class CCF(Plugin): delim = '/' else: delim = '\\' - tempdlc_name = tempdir+delim+str(random.randint(0, 100))+'-tmp.dlc' + 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_name = tempfile.gettempdir() + '/' + str(random.randint(0, 100)) + '-tmp.dlc' - tempdlc = open(tempdlc_name,"w") + tempdlc = open(tempdlc_name, "w") tempdlc.write(re.search(r'<dlc>(.*)</dlc>', tempdlc_content, re.DOTALL).group(1)) tempdlc.close diff --git a/Plugins/DLC.pyc b/Plugins/DLC.pyc Binary files differnew file mode 100644 index 000000000..5d4809178 --- /dev/null +++ b/Plugins/DLC.pyc @@ -6,12 +6,14 @@ link_file = links.txt failed_file = failed_links.txt use_reconnect = False reconnect_method = ./reconnect.sh +max_downloads = 3 [updates] search_updates = True [log] file_log = True log_folder = Logs log_count = 5 +#each log has 100kb [downloadTime] start = 0:00 end = 24:00 diff --git a/module/thread_list.py b/module/thread_list.py index dc77c6730..9f60ca5f5 100644 --- a/module/thread_list.py +++ b/module/thread_list.py @@ -23,6 +23,7 @@ import re import subprocess import time import urllib2 + from threading import RLock from download_thread import Download_Thread @@ -31,7 +32,7 @@ class Thread_List(object): def __init__(self, parent): self.parent = parent self.threads = [] - self.max_threads = 3 + self.max_threads = self.parent.config['max_downloads'] self.py_load_files = [] # files in queque self.f_relation = [0, 0] self.lock = RLock() @@ -108,12 +109,12 @@ class Thread_List(object): links = "" for link in pyfile.plugin.links: - links += link+"\n" + links += link + "\n" self.parent.extend_links(pyfile.plugin.links) data = links + data # put the links into text file - data = data.replace(pyfile.url+'\n', "") + data = data.replace(pyfile.url + '\n', "") with open(self.parent.config['link_file'], 'w') as f: f.write(data) @@ -124,7 +125,7 @@ class Thread_List(object): if pyfile.status.type == "failed": self.parent.logger.warning("Download failed: " + pyfile.url) with open(self.parent.config['failed_file'], 'a') as f: - f.write(pyfile.url+"\n") + f.write(pyfile.url + "\n") self.lock.release() return True @@ -183,7 +184,7 @@ class Thread_List(object): return False def reconnect(self): - reconn = subprocess.Popen(self.parent.config['reconnectMethod']) + reconn = subprocess.Popen(self.parent.config['reconnect_method']) reconn.wait() ip = re.match(".*Current IP Address: (.*)</body>.*", urllib2.urlopen("http://checkip.dyndns.org/").read()).group(1) #versuchen neue ip aus zu lesen while ip == "": #solange versuch bis neue ip ausgelesen |