From 93592862b520a862c01f80c019e5c4bc43746c19 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 5 Jul 2014 16:54:20 +0200 Subject: [SimpleHoster] Better inline docs + changed "FILE_OFFLINE_PATTERN" to "OFFLINE_PATTERN" --- module/plugins/hoster/StreamCz.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/StreamCz.py') diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index bbef31a67..227324097 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -28,7 +28,7 @@ def getInfo(urls): for url in urls: html = getURL(url) - if re.search(StreamCz.FILE_OFFLINE_PATTERN, html): + if re.search(StreamCz.OFFLINE_PATTERN, html): # File offline result.append((url, 0, 1, url)) else: @@ -45,7 +45,7 @@ class StreamCz(Hoster): __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" - FILE_OFFLINE_PATTERN = r'

Str.nku nebylo mo.n. nal.zt \(404\)

' + OFFLINE_PATTERN = r'

Str.nku nebylo mo.n. nal.zt \(404\)

' FILE_NAME_PATTERN = r'' CDN_PATTERN = r'\d+)(?:&cdnLQ=(?P\d*))?(?:&cdnHQ=(?P\d*))?(?:&cdnHD=(?P\d*))?&' @@ -57,7 +57,7 @@ class StreamCz(Hoster): self.html = self.load(pyfile.url, decode=True) - if re.search(self.FILE_OFFLINE_PATTERN, self.html): + if re.search(self.OFFLINE_PATTERN, self.html): self.offline() found = re.search(self.CDN_PATTERN, self.html) -- cgit v1.2.3 From 48c0c42fd6faffc56432d5f037cd575979f180cc Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 02:23:37 +0200 Subject: Removed all @author flags + key attributes cleanup for internal & hooks plugins --- module/plugins/hoster/StreamCz.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'module/plugins/hoster/StreamCz.py') diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index 227324097..9e5b6233f 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -13,8 +13,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . - - @author: zoidberg """ import re -- cgit v1.2.3 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/StreamCz.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/StreamCz.py') diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index 9e5b6233f..1b2439d98 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -59,7 +59,7 @@ class StreamCz(Hoster): self.offline() found = re.search(self.CDN_PATTERN, self.html) - if found is None: + if not found: self.fail("Parse error (CDN)") cdn = found.groupdict() self.logDebug(cdn) @@ -71,7 +71,7 @@ class StreamCz(Hoster): self.fail("Stream URL not found") found = re.search(self.FILE_NAME_PATTERN, self.html) - if found is None: + if not found: self.fail("Parse error (NAME)") pyfile.name = "%s-%s.%s.mp4" % (found.group(2), found.group(1), cdnkey[-2:]) -- cgit v1.2.3 From 05d258d98dd8c2faf0b769840fa1e3c4acccdce8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:25:14 +0200 Subject: Fix and improve 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 --- module/plugins/hoster/StreamCz.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/StreamCz.py') diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index 1b2439d98..9e5b6233f 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -59,7 +59,7 @@ class StreamCz(Hoster): self.offline() found = re.search(self.CDN_PATTERN, self.html) - if not found: + if found is None: self.fail("Parse error (CDN)") cdn = found.groupdict() self.logDebug(cdn) @@ -71,7 +71,7 @@ class StreamCz(Hoster): self.fail("Stream URL not found") found = re.search(self.FILE_NAME_PATTERN, self.html) - if not found: + if found is None: self.fail("Parse error (NAME)") pyfile.name = "%s-%s.%s.mp4" % (found.group(2), found.group(1), cdnkey[-2:]) -- cgit v1.2.3 From b3b82f960e553dbabbaf4f1d276b560e2cfffab0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 19 Jul 2014 14:48:40 +0200 Subject: [StreamCz] Parse https --- module/plugins/hoster/StreamCz.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/StreamCz.py') diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index 9e5b6233f..7614c0cc3 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -16,6 +16,7 @@ """ import re + from module.plugins.Hoster import Hoster from module.network.RequestFactory import getURL @@ -36,17 +37,21 @@ def getInfo(urls): class StreamCz(Hoster): __name__ = "StreamCz" + __version__ = "0.2" __type__ = "hoster" - __pattern__ = r'http://(?:www\.)?stream.cz/[^/]+/\d+.*' - __version__ = "0.1" + + __pattern__ = r'https?://(?:www\.)?stream\.cz/[^/]+/\d+.*' + __description__ = """Stream.cz hoster plugin""" __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" - OFFLINE_PATTERN = r'

Str.nku nebylo mo.n. nal.zt \(404\)

' FILE_NAME_PATTERN = r'' + OFFLINE_PATTERN = r'

Str.nku nebylo mo.n. nal.zt \(404\)

' + CDN_PATTERN = r'\d+)(?:&cdnLQ=(?P\d*))?(?:&cdnHQ=(?P\d*))?(?:&cdnHD=(?P\d*))?&' + def setup(self): self.multiDL = True self.resumeDownload = True -- cgit v1.2.3 From 9395182da7afed55a29bde1c7cbefe4204e783f0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:02:09 +0200 Subject: Store all re.search/match object as "m" instead "found" --- module/plugins/hoster/StreamCz.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'module/plugins/hoster/StreamCz.py') diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index 7614c0cc3..e68130389 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -63,10 +63,10 @@ class StreamCz(Hoster): if re.search(self.OFFLINE_PATTERN, self.html): self.offline() - found = re.search(self.CDN_PATTERN, self.html) - if found is None: + m = re.search(self.CDN_PATTERN, self.html) + if m is None: self.fail("Parse error (CDN)") - cdn = found.groupdict() + cdn = m.groupdict() self.logDebug(cdn) for cdnkey in ("cdnHD", "cdnHQ", "cdnLQ"): if cdnkey in cdn and cdn[cdnkey] > '': @@ -75,10 +75,10 @@ class StreamCz(Hoster): else: self.fail("Stream URL not found") - found = re.search(self.FILE_NAME_PATTERN, self.html) - if found is None: + m = re.search(self.FILE_NAME_PATTERN, self.html) + if m is None: self.fail("Parse error (NAME)") - pyfile.name = "%s-%s.%s.mp4" % (found.group(2), found.group(1), cdnkey[-2:]) + pyfile.name = "%s-%s.%s.mp4" % (m.group(2), m.group(1), cdnkey[-2:]) download_url = "http://cdn-dispatcher.stream.cz/?id=" + cdnid self.logInfo("STREAM (%s): %s" % (cdnkey[-2:], download_url)) -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro 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/StreamCz.py | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'module/plugins/hoster/StreamCz.py') diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index e68130389..526e61eea 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -1,24 +1,9 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . -""" - import re -from module.plugins.Hoster import Hoster from module.network.RequestFactory import getURL +from module.plugins.Hoster import Hoster def getInfo(urls): @@ -37,8 +22,8 @@ def getInfo(urls): class StreamCz(Hoster): __name__ = "StreamCz" - __version__ = "0.2" __type__ = "hoster" + __version__ = "0.2" __pattern__ = r'https?://(?:www\.)?stream\.cz/[^/]+/\d+.*' -- cgit v1.2.3