diff options
author | Stefano <l.stickell@yahoo.it> | 2013-03-07 16:41:25 +0100 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2013-03-07 16:41:25 +0100 |
commit | 8368a9a74d998b314f3864dcc8ce25c513d85cf9 (patch) | |
tree | 8995fd6c29742671a470667d59e8e6d167ed448b /module/plugins/hoster/VeehdCom.py | |
parent | Merge pull request #32 from stickell/patch-1 (diff) | |
download | pyload-8368a9a74d998b314f3864dcc8ce25c513d85cf9.tar.xz |
Various fixes in 24 plugins
Diffstat (limited to 'module/plugins/hoster/VeehdCom.py')
-rw-r--r-- | module/plugins/hoster/VeehdCom.py | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py index 06e59c7fa..23048b831 100644 --- a/module/plugins/hoster/VeehdCom.py +++ b/module/plugins/hoster/VeehdCom.py @@ -4,77 +4,77 @@ import re from module.plugins.Hoster import Hoster class VeehdCom(Hoster): - __name__ = 'VeehdCom' - __type__ = 'hoster' - __pattern__ = r'http://veehd\.com/video/\d+_\S+' - __config__ = [ - ('filename_spaces', 'bool', "Allow spaces in filename", 'False'), - ('replacement_char', 'str', "Filename replacement character", '_'), - ] - __version__ = '0.1' - __description__ = """Veehd.com Download Hoster""" - __author_name__ = ('cat') - __author_mail__ = ('cat@pyload') - - def _debug(self, msg): - self.log.debug('[%s] %s' % (self.__name__, msg)) - - def setup(self): - self.html = None - self.multiDL = True - self.req.canContinue = True + __name__ = 'VeehdCom' + __type__ = 'hoster' + __pattern__ = r'http://veehd\.com/video/\d+_\S+' + __config__ = [ + ('filename_spaces', 'bool', "Allow spaces in filename", 'False'), + ('replacement_char', 'str', "Filename replacement character", '_'), + ] + __version__ = '0.2' + __description__ = """Veehd.com Download Hoster""" + __author_name__ = ('cat') + __author_mail__ = ('cat@pyload') + + def _debug(self, msg): + self.log.debug('[%s] %s' % (self.__name__, msg)) + + def setup(self): + self.html = None + self.multiDL = True + self.req.canContinue = True - def process(self, pyfile): - self.download_html() - if not self.file_exists(): - self.offline() - - pyfile.name = self.get_file_name() - self.download(self.get_file_url()) - - def download_html(self): - url = self.pyfile.url - self._debug("Requesting page: %s" % (repr(url),)) - self.html = self.load(url) - - def file_exists(self): - if self.html is None: - self.download_html() - - if '<title>Veehd</title>' in self.html: - return False - return True - - def get_file_name(self): - if self.html is None: - self.download_html() - - match = re.search(r'<title[^>]*>([^<]+) on Veehd</title>', self.html) - if not match: - self.fail("video title not found") - name = match.group(1) - - # replace unwanted characters in filename - if self.getConf('filename_spaces'): - pattern = '[^0-9A-Za-z\.\ ]+' - else: - pattern = '[^0-9A-Za-z\.]+' - - name = re.sub('[^0-9A-Za-z\.]+', self.getConf('replacement_char'), - name) - return name + '.avi' + def process(self, pyfile): + self.download_html() + if not self.file_exists(): + self.offline() + + pyfile.name = self.get_file_name() + self.download(self.get_file_url()) + + def download_html(self): + url = self.pyfile.url + self._debug("Requesting page: %s" % (repr(url),)) + self.html = self.load(url) + + def file_exists(self): + if self.html is None: + self.download_html() + + if '<title>Veehd</title>' in self.html: + return False + return True + + def get_file_name(self): + if self.html is None: + self.download_html() + + match = re.search(r'<title[^>]*>([^<]+) on Veehd</title>', self.html) + if not match: + self.fail("video title not found") + name = match.group(1) + + # replace unwanted characters in filename + if self.getConf('filename_spaces'): + pattern = '[^0-9A-Za-z\.\ ]+' + else: + pattern = '[^0-9A-Za-z\.]+' + + name = re.sub(pattern, self.getConf('replacement_char'), + name) + return name + '.avi' - def get_file_url(self): - """ returns the absolute downloadable filepath - """ - if self.html is None: - self.download_html() + def get_file_url(self): + """ returns the absolute downloadable filepath + """ + if self.html is None: + self.download_html() - match = re.search(r'<embed type="video/divx" ' - r'src="(http://([^/]*\.)?veehd\.com/dl/[^"]+)"', - self.html) - if not match: - self.fail("embedded video url not found") - file_url = match.group(1) + match = re.search(r'<embed type="video/divx" ' + r'src="(http://([^/]*\.)?veehd\.com/dl/[^"]+)"', + self.html) + if not match: + self.fail("embedded video url not found") + file_url = match.group(1) - return file_url + return file_url |