summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/PluginManager.py2
-rw-r--r--module/config/default.conf8
-rw-r--r--module/plugins/Plugin.py8
-rw-r--r--module/plugins/hooks/UnRar.py4
-rw-r--r--module/plugins/hoster/NetloadIn.py20
-rw-r--r--module/plugins/hoster/ShareCx.py27
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py31
-rw-r--r--module/pyunrar.py4
-rwxr-xr-xpyLoadCli.py2
9 files changed, 74 insertions, 32 deletions
diff --git a/module/PluginManager.py b/module/PluginManager.py
index f452e2b39..8bb5a5ec6 100644
--- a/module/PluginManager.py
+++ b/module/PluginManager.py
@@ -132,7 +132,7 @@ class PluginManager():
config = [ [y.strip() for y in x.replace("'","").replace('"',"").replace(")","").split(",")] for x in config[0].split("(") if x.strip()]
if folder == "hooks":
- config.append( ["load", "bool", "Load on startup", True] )
+ config.append( ["load", "bool", "Load on startup", True if name not in ("XMPPInterface", "MultiHome") else False] )
for item in config:
self.core.config.addPluginConfig([name]+item)
diff --git a/module/config/default.conf b/module/config/default.conf
index b1c0c648e..e9c7782e6 100644
--- a/module/config/default.conf
+++ b/module/config/default.conf
@@ -21,17 +21,15 @@ log - "Log":
str log_folder : "Folder" = Logs
int log_count : "Count" = 5
general - "General":
- en;de;fr;nl;pl language : "Language" = de
+ en;de;fr;nl;pl language : "Language" = en
str download_folder : "Download Folder" = Downloads
int max_downloads : "Max Parallel Downloads" = 3
- str link_file : "File For Links" = links.txt
- str failed_file : "File For Failed Links" = failed_links.txt
bool debug_mode : "Debug Mode" = False
int max_download_time : "Max Download Time" = 5
int download_speed_limit : "Download Speed Limit" = 0
- bool checksum : "Use Checksum" = True
+ bool checksum : "Use Checksum" = False
int min_free_space : "Min Free Space (MB)" = 200
- bool folder_per_package : "Create folder for each package" = False
+ bool folder_per_package : "Create folder for each package" = True
ip download_interface : "Outgoing IP address for downloads" = None
updates - "Updates":
bool search_updates : "Search" = True
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py
index 04a5adb91..02a15dfbc 100644
--- a/module/plugins/Plugin.py
+++ b/module/plugins/Plugin.py
@@ -34,6 +34,14 @@ from os import makedirs
from tempfile import NamedTemporaryFile
from mimetypes import guess_type
+from itertools import islice
+
+def chunks(iterable, size):
+ it = iter(iterable)
+ item = list(islice(it, size))
+ while item:
+ yield item
+ item = list(islice(it, size))
def dec(func):
def new(*args):
diff --git a/module/plugins/hooks/UnRar.py b/module/plugins/hooks/UnRar.py
index 82c99a575..30cda62af 100644
--- a/module/plugins/hooks/UnRar.py
+++ b/module/plugins/hooks/UnRar.py
@@ -30,7 +30,7 @@ class UnRar(Hook):
__name__ = "UnRar"
__version__ = "0.1"
__description__ = """unrar"""
- __config__ = [ ("activated", "bool", "Activated", True),
+ __config__ = [ ("activated", "bool", "Activated", False),
("fullpath", "bool", "extract full path", True),
("overwrite", "bool", "overwrite files", True),
("passwordfile", "str", "unrar passoword file", "unrar_passwords.txt"),
@@ -109,7 +109,7 @@ class UnRar(Hook):
u.crackPassword(passwords=self.passwords, statusFunction=s, overwrite=True, destination=folder)
except WrongPasswordError:
continue
- except CommandError as e:
+ except CommandError , e:
if re.search("Cannot find volume", e.stderr):
continue
try:
diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py
index 9e117fa14..6f0cb9461 100644
--- a/module/plugins/hoster/NetloadIn.py
+++ b/module/plugins/hoster/NetloadIn.py
@@ -4,8 +4,12 @@
import re
from time import sleep
+
from module.plugins.Hoster import Hoster
from module.network.Request import getURL
+from module.plugins.Plugin import chunks
+
+
def getInfo(urls):
## returns list of tupels (name, size (in bytes), status (see FileDatabase), url)
@@ -14,14 +18,10 @@ def getInfo(urls):
apiurl = "http://api.netload.in/info.php?auth=Zf9SnQh9WiReEsb18akjvQGqT0I830e8&bz=1&md5=1&file_id="
id_regex = re.compile("http://.*netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)")
urls_per_query = 80
-
- iterations = len(urls)/urls_per_query
- if len(urls)%urls_per_query > 0:
- iterations = iterations +1
-
- for i in range(iterations):
+
+ for chunk in chunks(urls, urls_per_query):
ids = ""
- for url in urls[i*urls_per_query:(i+1)*urls_per_query]:
+ for url in chunk:
match = id_regex.search(url)
if match:
ids = ids + match.group(1) +";"
@@ -37,19 +37,17 @@ def getInfo(urls):
result = []
- counter = 0
- for r in api.split():
+ for i, r in enumerate(api.split()):
try:
tmp = r.split(";")
try:
size = int(tmp[2])
except:
size = 0
- result.append( (tmp[1], size, 2 if tmp[3] == "online" else 1, urls[(i*80)+counter]) )
+ result.append( (tmp[1], size, 2 if tmp[3] == "online" else 1, chunk[i] ) )
except:
print "Netload prefetch: Error while processing response: "
print r
- counter = counter +1
yield result
diff --git a/module/plugins/hoster/ShareCx.py b/module/plugins/hoster/ShareCx.py
index feee30cd3..e64459754 100644
--- a/module/plugins/hoster/ShareCx.py
+++ b/module/plugins/hoster/ShareCx.py
@@ -3,8 +3,35 @@
import re
from module.plugins.Hoster import Hoster
+from module.plugins.Plugin import chunks
+from module.network.Request import getURL
#from module.BeautifulSoup import BeautifulSoup
+def getInfo(urls):
+ api_url = "http://www.share.cx/uapi?do=check&links="
+
+ for chunk in chunks(urls, 90):
+ get = ""
+ for url in chunk:
+ get += ";"+url
+
+ api = getURL(api_url+get[1:])
+ result = []
+
+ for i, link in enumerate(api.split()):
+ url,name,size = link.split(";")
+ if name and size:
+ status = 2
+ else:
+ status = 1
+
+ if not name: name = chunk[i]
+ if not size: size = 0
+
+ result.append( (name, size, status, chunk[i]) )
+
+ yield result
+
class ShareCx(Hoster):
__name__ = "ShareCx"
__type__ = "hoster"
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index 8646fcc88..42a2bc560 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -13,19 +13,30 @@ from time import sleep
from module.plugins.Hoster import Hoster
from module.network.Request import getURL
+from module.plugins.Plugin import chunks
+
def getInfo(urls):
api_url_base = "http://www.share-online.biz/linkcheck/linkcheck.php"
- api_param_file = {"links": "\n".join(x.replace("http://www.share-online.biz/dl/","") for x in urls)} #api only supports old style links
- src = getURL(api_url_base, post=api_param_file)
- result = []
- for i, res in enumerate(src.split("\n")):
- if not res:
- continue
- fields = res.split(";")
- status = 2 if fields[1] == "OK" else 3
- result.append((fields[2], int(fields[3]), status, urls[i]))
- yield result
+
+ for chunk in chunks(urls, 90):
+ api_param_file = {"links": "\n".join(x.replace("http://www.share-online.biz/dl/","") for x in chunk)} #api only supports old style links
+ src = getURL(api_url_base, post=api_param_file)
+ result = []
+ for i, res in enumerate(src.split("\n")):
+ if not res:
+ continue
+ fields = res.split(";")
+
+ if fields[1] == "OK":
+ status = 2
+ elif fields[1] in ("DELETED", "NOT FOUND"):
+ status = 1
+ else:
+ status = 3
+
+ result.append((fields[2], int(fields[3]), status, chunk[i]))
+ yield result
class ShareonlineBiz(Hoster):
__name__ = "ShareonlineBiz"
diff --git a/module/pyunrar.py b/module/pyunrar.py
index 4db3c3a19..6bb240965 100644
--- a/module/pyunrar.py
+++ b/module/pyunrar.py
@@ -270,7 +270,7 @@ class Unrar():
if overwrite:
try:
remove(abspath(join(destination, sf[0])))
- except OSError as e:
+ except OSError, e:
if not e.errno == 2:
raise e
f = sf[0]
@@ -278,7 +278,7 @@ class Unrar():
if fullPath:
try:
makedirs(dirname(join(abspath(destination), sf[0])))
- except OSError as e:
+ except OSError, e:
if not e.errno == 17:
raise e
d = join(destination, dirname(f))
diff --git a/pyLoadCli.py b/pyLoadCli.py
index 426cf6370..4e97489c8 100755
--- a/pyLoadCli.py
+++ b/pyLoadCli.py
@@ -37,7 +37,7 @@ from module.ConfigParser import ConfigParser
import codecs
-sys.stdout = codecs.getwriter("unicode")(sys.stdout, errors = "replace")
+sys.stdout = codecs.getwriter("utf8")(sys.stdout, errors = "replace")
if sys.stdout.encoding.lower().startswith("utf"):
conv = unicode