summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar Jeix <devnull@localhost> 2011-02-11 20:17:20 +0100
committerGravatar Jeix <devnull@localhost> 2011-02-11 20:17:20 +0100
commit4a6cfe415a0d362bf30f22fac16b732195f97232 (patch)
treef90318302830b967b4734fc1e7d82eda6d52a8fc /module/plugins
parentsocket code fixes (diff)
downloadpyload-4a6cfe415a0d362bf30f22fac16b732195f97232.tar.xz
GUI updates, closed #181, updated XDCC, fixed FileSonic
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/hoster/EasyShareCom.py69
-rw-r--r--module/plugins/hoster/FilesonicCom.py7
-rw-r--r--module/plugins/hoster/Xdcc.py46
3 files changed, 109 insertions, 13 deletions
diff --git a/module/plugins/hoster/EasyShareCom.py b/module/plugins/hoster/EasyShareCom.py
new file mode 100644
index 000000000..9d185f4b5
--- /dev/null
+++ b/module/plugins/hoster/EasyShareCom.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Hoster import Hoster
+from module.plugins.ReCaptcha import ReCaptcha
+
+class EasyShareCom(Hoster):
+ __name__ = "EasyShareCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://[\w\d\.]*?easy-share\.com/(\d{6}).*"
+ __version__ = "0.1"
+ __description__ = """easy-share.com One-Klick Hoster"""
+ __author_name__ = ("jeix")
+ __author_mail__ = ("jeix@hasnomail.de")
+
+
+ def setup(self):
+ self.multiDL = False
+ self.html = None
+
+ def process(self, pyfile):
+ self.pyfile = pyfile
+
+ self.html = self.load(self.pyfile.url)
+ self.pyfile.name = self.getFileName()
+
+ self.download( self.getFileUrl() )
+
+
+ def getFileName(self):
+ return re.search(r'requesting:</span>\s*(.*?)<', self.html).group(1)
+
+
+ def getFileUrl(self):
+
+ if "There is another download in progress from your IP" in self.html:
+ self.log.info("%s: IP blocked, retry in 5 minutes." % self.__name__)
+ self.setWait(5 * 60)
+ self.wait()
+ self.retry()
+
+ if "You need a premium membership to download this file" in self.html:
+ self.fail("You need a premium membership to download this file.")
+
+
+ wait = re.search(r"w='(\d+)'", self.html)
+ if wait:
+ wait = int( wait.group(1).strip() )
+ self.log.info("%s: Waiting %d seconds." % (self.__name__, wait))
+ self.setWait(wait)
+ self.wait()
+
+ tempurl = self.pyfile.url
+ if not tempurl.endswith("/"):
+ tempurl += "/"
+ id = re.search(r'http://[\w\d\.]*?easy-share\.com/(\d+)/', tempurl).group(1)
+ self.html = self.load("http://www.easy-share.com/file_contents/captcha/" + id)
+
+ challenge = re.search(r'Recaptcha\.create\("(.*?)"', self.html).group(1)
+ re_captcha = ReCaptcha(self)
+ challenge, result = re_captcha.challenge(challenge)
+
+ link = re.search(r'<form\s+method="post"\s+action="(http://[\w\d\.]*?easy-share.com/file_contents/.*?)">', self.html).group(1)
+ id = re.search(r'file/id/(\d+)/', link)
+ self.download( link, post={"id" : id,
+ "recaptcha_challenge_field" : challenge,
+ "recaptcha_response_field": result} )
+
diff --git a/module/plugins/hoster/FilesonicCom.py b/module/plugins/hoster/FilesonicCom.py
index 5e2c10219..5bd38655a 100644
--- a/module/plugins/hoster/FilesonicCom.py
+++ b/module/plugins/hoster/FilesonicCom.py
@@ -11,7 +11,7 @@ class FilesonicCom(Hoster):
__name__ = "FilesonicCom"
__type__ = "hoster"
__pattern__ = r"http://[\w\.]*?(sharingmatrix|filesonic)\.(com|net)/.*?file/([0-9]+(/.+)?|[a-z0-9]+/[0-9]+(/.+)?)"
- __version__ = "0.1"
+ __version__ = "0.2"
__description__ = """FilesonicCom und Sharingmatrix Download Hoster"""
__author_name__ = ("jeix")
__author_mail__ = ("jeix@hasnomail.de")
@@ -25,11 +25,14 @@ class FilesonicCom(Hoster):
self.url = self.convertURL(self.pyfile.url)
self.html = self.load(self.url, cookies=False)
- name = re.search(r'Filename:\s*</span>\s*<strong>(.*?)<', self.html)
+ name = re.search(r'<title>Download (.*?) for free on Filesonic.com</title>', self.html)
if name:
self.pyfile.name = name.group(1)
else:
self.offline()
+
+ if 'The page you are trying to access was not found.' in self.html:
+ self.offline()
if self.account:
self.download(pyfile.url)
diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py
index bc35cf6ea..4ed718823 100644
--- a/module/plugins/hoster/Xdcc.py
+++ b/module/plugins/hoster/Xdcc.py
@@ -25,13 +25,14 @@ import sys
import time
import socket, struct
from select import select
+from module.utils import save_join
from module.plugins.Hoster import Hoster
class Xdcc(Hoster):
__name__ = "Xdcc"
- __version__ = "0.2"
+ __version__ = "0.3"
__pattern__ = r'xdcc://.*?(/#?.*?)?/.*?/#?\d+/?' # xdcc://irc.Abjects.net/#channel/[XDCC]|Shit/#0004/
__type__ = "hoster"
__config__ = [
@@ -44,11 +45,16 @@ class Xdcc(Hoster):
__author_mail__ = ("jeix@hasnomail.com")
def setup(self):
- self.debug = 0 #0,1,2
+ self.debug = 2 #0,1,2
self.timeout = 10
self.multiDL = False
+
+
def process(self, pyfile):
+ # change request type
+ self.req = pyfile.m.core.requestFactory.getRequest(self.__name__, type="XDCC")
+
self.pyfile = pyfile
for i in range(0,3):
try:
@@ -142,7 +148,7 @@ class Xdcc(Hoster):
readbuffer = temp.pop()
for line in temp:
- if self.debug is 2: print "*> " + line
+ if self.debug is 2: print "*> " + unicode(line, errors='ignore')
line = line.rstrip()
first = line.split()
@@ -182,6 +188,7 @@ class Xdcc(Hoster):
if self.debug is 1:
print "%s: %s" % (msg["origin"], msg["text"])
+ # You already requested that pack
if "You already requested that pack" in msg["text"]:
retry = time.time() + 300
@@ -189,27 +196,44 @@ class Xdcc(Hoster):
self.fail("Wrong channel")
m = re.match('\x01DCC SEND (.*?) (\d+) (\d+)(?: (\d+))?\x01', msg["text"])
- if m is not None:
+ if m != None:
done = True
# get connection data
ip = socket.inet_ntoa(struct.pack('L', socket.ntohl(int(m.group(2)))))
port = int(m.group(3))
- packname = m.group(1)
+ packname = m.group(1)
if len(m.groups()) > 3:
- self.req.dl_size = int(m.group(4))
+ self.req.filesize = int(m.group(4))
self.pyfile.name = packname
+ filename = save_join(location, packname)
self.log.info("XDCC: Downloading %s from %s:%d" % (packname, ip, port))
-
+
self.pyfile.setStatus("downloading")
- newname = self.req.download(ip, port, location, packname)
- self.pyfile.size = self.req.dl_size
+ newname = self.req.download(ip, port, filename, self.pyfile.progress.setValue)
+ if newname and newname != filename:
+ self.log.info("%(name)s saved as %(newname)s" % {"name": self.pyfile.name, "newname": newname})
+ filename = newname
# kill IRC socket
# sock.send("QUIT :byebye\r\n")
sock.close()
- if newname:
- self.pyfile.name = newname
+ if self.core.config["permission"]["change_file"]:
+ chmod(filename, int(self.core.config["permission"]["file"],8))
+
+ if self.core.config["permission"]["change_dl"] and os.name != "nt":
+ try:
+ uid = getpwnam(self.config["permission"]["user"])[2]
+ gid = getgrnam(self.config["permission"]["group"])[2]
+
+ chown(filename, uid, gid)
+ except Exception,e:
+ self.log.warning(_("Setting User and Group failed: %s") % str(e))
+
+ self.lastDownload = filename
+ return self.lastDownload
+
+