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/crypter/DailymotionBatch.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'module/plugins/crypter/DailymotionBatch.py') diff --git a/module/plugins/crypter/DailymotionBatch.py b/module/plugins/crypter/DailymotionBatch.py index 5c0dd9cec..e13f267f4 100644 --- a/module/plugins/crypter/DailymotionBatch.py +++ b/module/plugins/crypter/DailymotionBatch.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: Walter Purcaro """ from urlparse import urljoin -- cgit v1.2.3 From 7b8c458cca7d21a029620f98e453f746fce69cd1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 16:10:01 +0200 Subject: Prefer single quote for dict key name --- module/plugins/crypter/DailymotionBatch.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'module/plugins/crypter/DailymotionBatch.py') diff --git a/module/plugins/crypter/DailymotionBatch.py b/module/plugins/crypter/DailymotionBatch.py index e13f267f4..d9309af90 100644 --- a/module/plugins/crypter/DailymotionBatch.py +++ b/module/plugins/crypter/DailymotionBatch.py @@ -45,8 +45,8 @@ class DailymotionBatch(Crypter): if "error" in playlist: return - name = playlist["name"] - owner = playlist["owner.screenname"] + name = playlist['name'] + owner = playlist['owner.screenname'] return name, owner def _getPlaylists(self, user_id, page=1): @@ -57,10 +57,10 @@ class DailymotionBatch(Crypter): if "error" in user: return - for playlist in user["list"]: - yield playlist["id"] + for playlist in user['list']: + yield playlist['id'] - if user["has_more"]: + if user['has_more']: for item in self._getPlaylists(user_id, page + 1): yield item @@ -75,10 +75,10 @@ class DailymotionBatch(Crypter): if "error" in playlist: return - for video in playlist["list"]: - yield video["url"] + for video in playlist['list']: + yield video['url'] - if playlist["has_more"]: + if playlist['has_more']: for item in self._getVideos(id, page + 1): yield item -- cgit v1.2.3 From 8e47b0de30a25d0fd5dfb518bfe4e1e7beff93fd Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 15 Jul 2014 16:27:44 +0200 Subject: Key attributes cleanup for account, container and crypter plugins --- module/plugins/crypter/DailymotionBatch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'module/plugins/crypter/DailymotionBatch.py') diff --git a/module/plugins/crypter/DailymotionBatch.py b/module/plugins/crypter/DailymotionBatch.py index d9309af90..c86c966d8 100644 --- a/module/plugins/crypter/DailymotionBatch.py +++ b/module/plugins/crypter/DailymotionBatch.py @@ -25,13 +25,16 @@ from module.utils import save_join class DailymotionBatch(Crypter): __name__ = "DailymotionBatch" + __version__ = "0.01" __type__ = "crypter" + __pattern__ = r'https?://(?:www\.)?dailymotion\.com/((playlists/)?(?Pplaylist|user)/)?(?P[\w^_]+)(?(TYPE)|#)' - __version__ = "0.01" + __description__ = """Dailymotion.com channel & playlist decrypter""" __author_name__ = "Walter Purcaro" __author_mail__ = "vuolter@gmail.com" + def api_response(self, ref, req=None): url = urljoin("https://api.dailymotion.com/", ref) page = self.load(url, get=req) -- 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/crypter/DailymotionBatch.py | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'module/plugins/crypter/DailymotionBatch.py') diff --git a/module/plugins/crypter/DailymotionBatch.py b/module/plugins/crypter/DailymotionBatch.py index c86c966d8..e43d4e1fd 100644 --- a/module/plugins/crypter/DailymotionBatch.py +++ b/module/plugins/crypter/DailymotionBatch.py @@ -1,22 +1,8 @@ # -*- 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 urlparse import urljoin -import re from module.common.json_layer import json_loads from module.plugins.Crypter import Crypter @@ -25,8 +11,8 @@ from module.utils import save_join class DailymotionBatch(Crypter): __name__ = "DailymotionBatch" - __version__ = "0.01" __type__ = "crypter" + __version__ = "0.01" __pattern__ = r'https?://(?:www\.)?dailymotion\.com/((playlists/)?(?Pplaylist|user)/)?(?P[\w^_]+)(?(TYPE)|#)' -- cgit v1.2.3 From b0868ae6446078bacf1635dde5e4ab316b4a94cb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Oct 2014 18:57:59 +0200 Subject: New __authors__ key replaces __author_name__ and __author_mail__ + Whitespaces and EOF fixup --- module/plugins/crypter/DailymotionBatch.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/crypter/DailymotionBatch.py') diff --git a/module/plugins/crypter/DailymotionBatch.py b/module/plugins/crypter/DailymotionBatch.py index e43d4e1fd..cc97910af 100644 --- a/module/plugins/crypter/DailymotionBatch.py +++ b/module/plugins/crypter/DailymotionBatch.py @@ -17,8 +17,7 @@ class DailymotionBatch(Crypter): __pattern__ = r'https?://(?:www\.)?dailymotion\.com/((playlists/)?(?Pplaylist|user)/)?(?P[\w^_]+)(?(TYPE)|#)' __description__ = """Dailymotion.com channel & playlist decrypter""" - __author_name__ = "Walter Purcaro" - __author_mail__ = "vuolter@gmail.com" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] def api_response(self, ref, req=None): -- cgit v1.2.3 From ae7a7e66981456e5bbe2b54006d79b6f907be7a4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Oct 2014 20:18:13 +0200 Subject: Add __license__ key attribute to plugins --- module/plugins/crypter/DailymotionBatch.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/crypter/DailymotionBatch.py') diff --git a/module/plugins/crypter/DailymotionBatch.py b/module/plugins/crypter/DailymotionBatch.py index cc97910af..a0ed0e80f 100644 --- a/module/plugins/crypter/DailymotionBatch.py +++ b/module/plugins/crypter/DailymotionBatch.py @@ -17,6 +17,7 @@ class DailymotionBatch(Crypter): __pattern__ = r'https?://(?:www\.)?dailymotion\.com/((playlists/)?(?Pplaylist|user)/)?(?P[\w^_]+)(?(TYPE)|#)' __description__ = """Dailymotion.com channel & playlist decrypter""" + __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] -- cgit v1.2.3 From 0eb6e7ec4a1144dcca824d8add049787d3da1762 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 22 Oct 2014 19:44:59 +0200 Subject: Two space before function declaration --- module/plugins/crypter/DailymotionBatch.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'module/plugins/crypter/DailymotionBatch.py') diff --git a/module/plugins/crypter/DailymotionBatch.py b/module/plugins/crypter/DailymotionBatch.py index a0ed0e80f..5d2f53b38 100644 --- a/module/plugins/crypter/DailymotionBatch.py +++ b/module/plugins/crypter/DailymotionBatch.py @@ -26,6 +26,7 @@ class DailymotionBatch(Crypter): page = self.load(url, get=req) return json_loads(page) + def getPlaylistInfo(self, id): ref = "playlist/" + id req = {"fields": "name,owner.screenname"} @@ -38,6 +39,7 @@ class DailymotionBatch(Crypter): owner = playlist['owner.screenname'] return name, owner + def _getPlaylists(self, user_id, page=1): ref = "user/%s/playlists" % user_id req = {"fields": "id", "page": page, "limit": 100} @@ -53,9 +55,11 @@ class DailymotionBatch(Crypter): for item in self._getPlaylists(user_id, page + 1): yield item + def getPlaylists(self, user_id): return [(id,) + self.getPlaylistInfo(id) for id in self._getPlaylists(user_id)] + def _getVideos(self, id, page=1): ref = "playlist/%s/videos" % id req = {"fields": "url", "page": page, "limit": 100} @@ -71,9 +75,11 @@ class DailymotionBatch(Crypter): for item in self._getVideos(id, page + 1): yield item + def getVideos(self, playlist_id): return list(self._getVideos(playlist_id))[::-1] + def decrypt(self, pyfile): m = re.match(self.__pattern__, pyfile.url) m_id = m.group("ID") -- cgit v1.2.3 From 9f2ebe486a3e155fb6a60e07cccb77ab6a772eb2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 26 Oct 2014 02:31:54 +0200 Subject: Extend translation support in plugins + a lot of code cosmetics and typo fixes --- module/plugins/crypter/DailymotionBatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/crypter/DailymotionBatch.py') diff --git a/module/plugins/crypter/DailymotionBatch.py b/module/plugins/crypter/DailymotionBatch.py index 5d2f53b38..3b9b82a0c 100644 --- a/module/plugins/crypter/DailymotionBatch.py +++ b/module/plugins/crypter/DailymotionBatch.py @@ -95,7 +95,7 @@ class DailymotionBatch(Crypter): self.logDebug("%s playlist\s found on channel \"%s\"" % (len(playlists), m_id)) if not playlists: - self.fail("No playlist available") + self.fail(_("No playlist available")) for p_id, p_name, p_owner in playlists: p_videos = self.getVideos(p_id) -- cgit v1.2.3 From 885f8ed782e64d9e73367905e642a84d0a8999f1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Oct 2014 04:01:38 +0100 Subject: Update __config__ --- module/plugins/crypter/DailymotionBatch.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'module/plugins/crypter/DailymotionBatch.py') diff --git a/module/plugins/crypter/DailymotionBatch.py b/module/plugins/crypter/DailymotionBatch.py index 3b9b82a0c..928746745 100644 --- a/module/plugins/crypter/DailymotionBatch.py +++ b/module/plugins/crypter/DailymotionBatch.py @@ -15,6 +15,8 @@ class DailymotionBatch(Crypter): __version__ = "0.01" __pattern__ = r'https?://(?:www\.)?dailymotion\.com/((playlists/)?(?Pplaylist|user)/)?(?P[\w^_]+)(?(TYPE)|#)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Dailymotion.com channel & playlist decrypter""" __license__ = "GPLv3" -- cgit v1.2.3 From 34984dae733c3f3d47b41a0acfba3724d53c65a1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Oct 2014 16:52:10 +0100 Subject: Code cosmetics: plugin class attributes --- module/plugins/crypter/DailymotionBatch.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/crypter/DailymotionBatch.py') diff --git a/module/plugins/crypter/DailymotionBatch.py b/module/plugins/crypter/DailymotionBatch.py index 928746745..28e01c084 100644 --- a/module/plugins/crypter/DailymotionBatch.py +++ b/module/plugins/crypter/DailymotionBatch.py @@ -10,8 +10,8 @@ from module.utils import save_join class DailymotionBatch(Crypter): - __name__ = "DailymotionBatch" - __type__ = "crypter" + __name__ = "DailymotionBatch" + __type__ = "crypter" __version__ = "0.01" __pattern__ = r'https?://(?:www\.)?dailymotion\.com/((playlists/)?(?Pplaylist|user)/)?(?P[\w^_]+)(?(TYPE)|#)' @@ -19,8 +19,8 @@ class DailymotionBatch(Crypter): ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Dailymotion.com channel & playlist decrypter""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] def api_response(self, ref, req=None): -- cgit v1.2.3 From 854efeb463bd98cb8e22f1f78f5ce97e6c0ab49f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 22 Dec 2014 16:45:04 +0100 Subject: Spare code cosmetics --- module/plugins/crypter/DailymotionBatch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/crypter/DailymotionBatch.py') diff --git a/module/plugins/crypter/DailymotionBatch.py b/module/plugins/crypter/DailymotionBatch.py index 28e01c084..8d4cb64df 100644 --- a/module/plugins/crypter/DailymotionBatch.py +++ b/module/plugins/crypter/DailymotionBatch.py @@ -84,8 +84,8 @@ class DailymotionBatch(Crypter): def decrypt(self, pyfile): m = re.match(self.__pattern__, pyfile.url) - m_id = m.group("ID") - m_type = m.group("TYPE") + m_id = m.group('ID') + m_type = m.group('TYPE') if m_type == "playlist": self.logDebug("Url recognized as Playlist") -- cgit v1.2.3