From 389e5bd208feb97f4faca9cfd4bc0f037efc32d9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 5 Jul 2014 16:31:44 +0200 Subject: [VeohCom] Auto quality detection --- module/plugins/hoster/VeohCom.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/module/plugins/hoster/VeohCom.py b/module/plugins/hoster/VeohCom.py index c1ebffb81..15d7a98b0 100644 --- a/module/plugins/hoster/VeohCom.py +++ b/module/plugins/hoster/VeohCom.py @@ -23,8 +23,8 @@ class VeohCom(SimpleHoster): __name__ = "VeohCom" __type__ = "hoster" __pattern__ = r'http://(?:www\.)?veoh\.com/(tv/)?(watch|videos)/(?Pv\w+)' - __version__ = "0.1" - __config__ = [("quality", "Low;High", "Quality", "High")] + __version__ = "0.2" + __config__ = [("quality", "Low;High;Auto", "Quality", "Auto")] __description__ = """Veoh.com hoster plugin""" __author_name__ = "Walter Purcaro" __author_mail__ = "vuolter@gmail.com" @@ -41,16 +41,22 @@ class VeohCom(SimpleHoster): self.chunkLimit = -1 def handleFree(self): - q = self.getConfig("quality") - pattern = r'"fullPreviewHash%sPath":"(.+?)"' % q - found = re.search(pattern, self.html) - if found: - self.pyfile.name += ".mp4" - link = found.group(1).replace("\\", "") - self.logDebug("Download link: " + link) - self.download(link) + quality = self.getConfig("quality") + if quality == "Auto": + quality = ("High", "Low") + for q in quality: + pattern = r'"fullPreviewHash%sPath":"(.+?)"' % q + found = re.search(pattern, self.html) + if found: + self.pyfile.name += ".mp4" + link = found.group(1).replace("\\", "") + self.logDebug("Download link: " + link) + self.download(link) + return + else: + self.logInfo("No %s quality video found" % q.upper()) else: - self.fail("No %s quality video found" % q.lower()) + self.fail("No video found!") getInfo = create_getInfo(VeohCom) -- cgit v1.2.3