From 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 15 Jul 2014 16:25:41 +0200 Subject: Fix code indentation, some bad whitespaces and missing authors + use 'not' instead 'is None' + replace __pattern__'s r" with r' + other minor cosmetics --- module/plugins/hoster/VeehdCom.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'module/plugins/hoster/VeehdCom.py') diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py index 22fc4b207..fd804d3f9 100644 --- a/module/plugins/hoster/VeehdCom.py +++ b/module/plugins/hoster/VeehdCom.py @@ -5,12 +5,12 @@ from module.plugins.Hoster import Hoster class VeehdCom(Hoster): - __name__ = 'VeehdCom' - __type__ = '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.23' + __version__ = "0.23" __description__ = """Veehd.com hoster plugin""" __author_name__ = "cat" __author_mail__ = "cat@pyload" @@ -36,7 +36,7 @@ class VeehdCom(Hoster): self.html = self.load(url) def file_exists(self): - if self.html is None: + if not self.html: self.download_html() if 'Veehd' in self.html: @@ -44,7 +44,7 @@ class VeehdCom(Hoster): return True def get_file_name(self): - if self.html is None: + if not self.html: self.download_html() match = re.search(r']*>([^<]+) on Veehd', self.html) @@ -65,7 +65,7 @@ class VeehdCom(Hoster): def get_file_url(self): """ returns the absolute downloadable filepath """ - if self.html is None: + if not self.html: self.download_html() match = re.search(r' Date: Sun, 20 Jul 2014 03:25:14 +0200 Subject: Fix and improve 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 --- module/plugins/hoster/VeehdCom.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'module/plugins/hoster/VeehdCom.py') diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py index fd804d3f9..33fa76d47 100644 --- a/module/plugins/hoster/VeehdCom.py +++ b/module/plugins/hoster/VeehdCom.py @@ -47,10 +47,11 @@ class VeehdCom(Hoster): if not self.html: self.download_html() - match = re.search(r']*>([^<]+) on Veehd', self.html) - if not match: + found = re.search(r']*>([^<]+) on Veehd', self.html) + if found is None: self.fail("video title not found") - name = match.group(1) + + name = found.group(1) # replace unwanted characters in filename if self.getConfig('filename_spaces'): @@ -58,9 +59,7 @@ class VeehdCom(Hoster): else: pattern = '[^0-9A-Za-z\.]+' - name = re.sub(pattern, self.getConfig('replacement_char'), - name) - return name + '.avi' + return re.sub(pattern, self.getConfig('replacement_char'), name) + '.avi' def get_file_url(self): """ returns the absolute downloadable filepath @@ -68,10 +67,9 @@ class VeehdCom(Hoster): if not self.html: self.download_html() - match = re.search(r' Date: Sun, 20 Jul 2014 03:02:09 +0200 Subject: Store all re.search/match object as "m" instead "found" --- module/plugins/hoster/VeehdCom.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'module/plugins/hoster/VeehdCom.py') diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py index 33fa76d47..15cff646f 100644 --- a/module/plugins/hoster/VeehdCom.py +++ b/module/plugins/hoster/VeehdCom.py @@ -47,11 +47,11 @@ class VeehdCom(Hoster): if not self.html: self.download_html() - found = re.search(r']*>([^<]+) on Veehd', self.html) - if found is None: + m = re.search(r']*>([^<]+) on Veehd', self.html) + if m is None: self.fail("video title not found") - name = found.group(1) + name = m.group(1) # replace unwanted characters in filename if self.getConfig('filename_spaces'): @@ -67,9 +67,9 @@ class VeehdCom(Hoster): if not self.html: self.download_html() - found = re.search(r' Date: Fri, 1 Aug 2014 19:35:59 +0200 Subject: Remove trailing whitespaces + remove license headers + import urllib methods directly + sort and fix key attributes + use save_join instead join + sort some import declarations + other minor code cosmetics --- module/plugins/hoster/VeehdCom.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'module/plugins/hoster/VeehdCom.py') diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py index 15cff646f..66c258439 100644 --- a/module/plugins/hoster/VeehdCom.py +++ b/module/plugins/hoster/VeehdCom.py @@ -1,20 +1,24 @@ # -*- coding: utf-8 -*- import re + from module.plugins.Hoster import Hoster class VeehdCom(Hoster): __name__ = "VeehdCom" __type__ = "hoster" + __version__ = "0.23" + __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.23" + __description__ = """Veehd.com hoster plugin""" __author_name__ = "cat" __author_mail__ = "cat@pyload" + def _debug(self, msg): self.logDebug('[%s] %s' % (self.__name__, msg)) -- cgit v1.2.3