From 93dfa954b856760b284f40517f1e60a4a45bdacf Mon Sep 17 00:00:00 2001
From: Wugy <wugy@mally-soft.com>
Date: Sat, 3 Apr 2010 23:31:33 +0200
Subject: Add DuckloadCom Hoster

---
 module/plugins/hoster/DuckloadCom.py | 87 ++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)
 create mode 100644 module/plugins/hoster/DuckloadCom.py

(limited to 'module/plugins/hoster')

diff --git a/module/plugins/hoster/DuckloadCom.py b/module/plugins/hoster/DuckloadCom.py
new file mode 100644
index 000000000..f9ef8ba8e
--- /dev/null
+++ b/module/plugins/hoster/DuckloadCom.py
@@ -0,0 +1,87 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.Plugin import Plugin
+from time import time
+
+class DuckloadCom(Plugin):
+
+    def __init__(self, parent):
+        Plugin.__init__(self, parent)
+        props = {}
+        props['name'] = "DuckloadCom"
+        props['type'] = "hoster"
+        props['pattern'] = r"http://(?:www\.)?duckload\.com/divx/"
+        props['version'] = "0.1"
+        props['description'] = """Duckload.com Download Plugin"""
+        props['author_name'] = ("wugy")
+        props['author_mail'] = ("wugy@qip.ru")
+        self.props = props
+        self.parent = parent
+        self.html = [None, None]
+        self.want_reconnect = False
+        self.multi_dl = False
+    
+    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
+
+        pyfile.status.filename = self.get_file_name()
+            
+        pyfile.status.waituntil = time()
+        pyfile.status.url = self.get_file_url()
+        pyfile.status.want_reconnect = self.want_reconnect
+
+        thread.wait(self.parent)
+
+        return True
+
+    def download_html(self):
+        url = self.parent.url
+        self.html[0] = self.req.load(url, cookies=True)
+        self.html[1] = self.req.load(url, cookies=True, post={"server": "1", "sn": "Stream Starten"})
+
+    def get_file_url(self):
+        """ returns the absolute downloadable filepath
+        """
+        if self.html[1] == None:
+            self.download_html()
+        if not self.want_reconnect:
+            file_url = re.search('type=\"video/divx\"\ src=\"(.*?)\"', self.html[1]).group(1)
+            #print file_url
+            return file_url
+        else:
+            return False
+
+    def get_file_name(self):
+        if self.html[1] == None:
+            self.download_html()
+        if not self.want_reconnect:
+            file_name = re.search('Film\ \"(\S*?)\"\ anschauen', self.html[1]).group(1)
+            return file_name
+        else:
+            return self.parent.url
+
+    def file_exists(self):
+        """ returns True or False
+        """
+        if self.html[0] == None:
+            self.download_html()
+        if re.search(r"Datei wurde nicht gefunden!", self.html) != None:
+            return False
+        else:
+            return True
+
+    def proceed(self, url, location):
+        self.req.download(url, location, cookies=True)
+
-- 
cgit v1.2.3