summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar spoob <spoob@gmx.de> 2010-01-15 15:03:00 +0100
committerGravatar spoob <spoob@gmx.de> 2010-01-15 15:03:00 +0100
commit2edf36eb45d427262e9f83af90b8b4fc2f69aab8 (patch)
tree5cadf5d76f3784512973244194b19fbade2c1a4b
parentmerge + fix (diff)
downloadpyload-2edf36eb45d427262e9f83af90b8b4fc2f69aab8.tar.xz
Better Argument Parsing in Core, littel fixes
-rwxr-xr-xmodule/network/Request.py4
-rw-r--r--module/plugins/decrypter/HoerbuchIn.py4
-rw-r--r--module/plugins/decrypter/SerienjunkiesOrg.py22
-rw-r--r--module/plugins/decrypter/YoutubeChannel.py2
-rw-r--r--module/plugins/hoster/MyvideoDe.py9
-rwxr-xr-xpyLoadCore.py30
6 files changed, 33 insertions, 38 deletions
diff --git a/module/network/Request.py b/module/network/Request.py
index 9155185fd..dfe29e62d 100755
--- a/module/network/Request.py
+++ b/module/network/Request.py
@@ -125,6 +125,8 @@ class Request:
def load(self, url, get={}, post={}, ref=True, cookies=False, just_header=False):
+ url = str(url)
+
if post:
post = urllib.urlencode(post)
else:
@@ -244,6 +246,8 @@ class Request:
def download(self, url, file_name, get={}, post={}, ref=True, cookies=False):
+ url = str(url)
+
if post:
post = urllib.urlencode(post)
else:
diff --git a/module/plugins/decrypter/HoerbuchIn.py b/module/plugins/decrypter/HoerbuchIn.py
index ae7ae9774..2c3fd4123 100644
--- a/module/plugins/decrypter/HoerbuchIn.py
+++ b/module/plugins/decrypter/HoerbuchIn.py
@@ -12,8 +12,8 @@ class HoerbuchIn(Plugin):
props = {}
props['name'] = "HoerbuchIn"
props['type'] = "container"
- props['pattern'] = r"http://(www\.)?hoerbuch\.in/blog\.php\?id="
- props['version'] = "0.3"
+ props['pattern'] = r"http://(www\.)?hoerbuch\.in/(blog\.php\?id=|download_(.*)\.html)"
+ props['version'] = "0.4"
props['description'] = """Hoerbuch.in Container Plugin"""
props['author_name'] = ("spoob")
props['author_mail'] = ("spoob@pyload.org")
diff --git a/module/plugins/decrypter/SerienjunkiesOrg.py b/module/plugins/decrypter/SerienjunkiesOrg.py
index 7302f904e..7d45fd705 100644
--- a/module/plugins/decrypter/SerienjunkiesOrg.py
+++ b/module/plugins/decrypter/SerienjunkiesOrg.py
@@ -4,23 +4,7 @@ import re
from module.Plugin import Plugin
from module.BeautifulSoup import BeautifulSoup
-
-from htmlentitydefs import name2codepoint as n2cp
-def substitute_entity(match):
- ent = match.group(2)
- if match.group(1) == "#":
- return unichr(int(ent))
- else:
- cp = n2cp.get(ent)
- if cp:
- return unichr(cp)
- else:
- return match.group()
-
-def decode_htmlentities(string):
- entity_re = re.compile("&(#?)(\d{1,5}|\w{1,8});")
- return entity_re.subn(substitute_entity, string)[0]
-
+from module.unescape import unescape
class SerienjunkiesOrg(Plugin):
def __init__(self, parent):
@@ -100,10 +84,10 @@ class SerienjunkiesOrg(Plugin):
var = p.findAll("strong")
opts = {"Dauer": "", "Uploader": "", "Sprache": "", "Format": "", u"Größe": ""}
for v in var:
- n = decode_htmlentities(v.string)
+ n = unescape(v.string)
val = v.nextSibling
val = val.encode("utf-8")
- val = decode_htmlentities(val)
+ val = unescape(val)
val = val.replace("|", "").strip()
n = n.strip()
n = re.sub(r"^([:]?)(.*?)([:]?)$", r'\2', n)
diff --git a/module/plugins/decrypter/YoutubeChannel.py b/module/plugins/decrypter/YoutubeChannel.py
index a5751ed7c..ba2ca1472 100644
--- a/module/plugins/decrypter/YoutubeChannel.py
+++ b/module/plugins/decrypter/YoutubeChannel.py
@@ -44,7 +44,7 @@ class YoutubeChannel(Plugin):
if max_results > 50:
max_results = 50
url = "http://gdata.youtube.com/feeds/api/users/%s/%s?max-results=%i&start-index=%i" % (self.user, group, max_results, start_index)
- rep = self.req.load(str(url))
+ rep = self.req.load(url)
new_links = re.findall(r"href\='(http:\/\/www.youtube.com\/watch\?v\=[^']+)", rep)
if new_links != []:
temp_links.extend(new_links)
diff --git a/module/plugins/hoster/MyvideoDe.py b/module/plugins/hoster/MyvideoDe.py
index f7c087091..0fe315547 100644
--- a/module/plugins/hoster/MyvideoDe.py
+++ b/module/plugins/hoster/MyvideoDe.py
@@ -1,11 +1,9 @@
-#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from module.Plugin import Plugin
class MyvideoDe(Plugin):
-
def __init__(self, parent):
Plugin.__init__(self, parent)
props = {}
@@ -25,22 +23,17 @@ class MyvideoDe(Plugin):
self.html = self.req.load(self.url)
def get_file_url(self):
- if self.html == None:
- self.download_html()
videoId = re.search(r"addVariable\('_videoid','(.*)'\);p.addParam\('quality'", self.html).group(1)
videoServer = re.search("rel='image_src' href='(.*)thumbs/.*' />", self.html).group(1)
file_url = videoServer + videoId + ".flv"
return file_url
def get_file_name(self):
- if self.html == None:
- self.download_html()
file_name_pattern = r"<h1 class='globalHd'>(.*)</h1>"
return re.search(file_name_pattern, self.html).group(1).replace("/", "") + '.flv'
def file_exists(self):
- if self.html == None:
- self.download_html()
+ self.download_html()
self.req.load(str(self.url), cookies=False, just_header=True)
if self.req.lastEffectiveURL == "http://www.myvideo.de/":
return False
diff --git a/pyLoadCore.py b/pyLoadCore.py
index cd928315a..4b2e63a2c 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -31,6 +31,7 @@ import logging.handlers
from os import execv
from os import makedirs
from os import sep
+from os import remove
from os.path import basename
from os.path import dirname
from os.path import exists
@@ -47,6 +48,7 @@ import thread
import time
from time import sleep
from xmlrpclib import Binary
+from getopt import getopt
from module.CaptchaManager import CaptchaManager
from module.HookManager import HookManager
@@ -60,12 +62,22 @@ from module.web.ServerThread import WebServer
class Core(object):
""" pyLoad Core """
def __init__(self):
+ self.arg_links = []
if len(argv) > 1:
- if argv[1] == "-v" or argv[1] == "--version":
- print "pyLoad", CURRENT_VERSION
- else:
- print "Unknown Command"
- exit()
+ try:
+ options, arguments = getopt(argv[1:], 'vcl:')
+ for option, argument in options:
+ if option == "-v":
+ print "pyLoad", CURRENT_VERSION
+ exit()
+ elif option == "-c":
+ remove(join("module", "links.pkl"))
+ print "Removed Linkliste"
+ elif option == "-l":
+ self.arg_links.append(argument)
+ print "Added %s" % argument
+ except:
+ print 'Unknown Argument(s) "%s"' % " ".join(argv[1:])
def toggle_pause(self):
if self.thread_list.pause:
@@ -137,7 +149,6 @@ class Core(object):
self.init_server()
self.init_webserver()
-
linkFile = self.config['general']['link_file']
packs = self.server_methods.get_queue()
found = False
@@ -151,8 +162,12 @@ class Core(object):
pid = found
lid = self.file_list.collector.addLink(linkFile)
self.file_list.packager.addFileToPackage(pid, self.file_list.collector.popFile(lid))
+ if self.arg_links:
+ for link in self.arg_links:
+ lid = self.file_list.collector.addLink(link)
+ self.file_list.packager.addFileToPackage(pid, self.file_list.collector.popFile(lid))
+
self.file_list.packager.pushPackage2Queue(pid)
-
self.file_list.continueAborted()
while True:
@@ -589,4 +604,3 @@ if __name__ == "__main__":
pyload_core.shutdown()
pyload_core.logger.info("killed pyLoad from Terminal")
exit()
-