summaryrefslogtreecommitdiffstats
path: root/pyload/plugins/crypter/DailymotionBatch.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/plugins/crypter/DailymotionBatch.py')
-rw-r--r--pyload/plugins/crypter/DailymotionBatch.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/pyload/plugins/crypter/DailymotionBatch.py b/pyload/plugins/crypter/DailymotionBatch.py
index 41bec2203..fd43cd49a 100644
--- a/pyload/plugins/crypter/DailymotionBatch.py
+++ b/pyload/plugins/crypter/DailymotionBatch.py
@@ -10,14 +10,17 @@ from pyload.utils import safe_join
class DailymotionBatch(Crypter):
- __name__ = "DailymotionBatch"
- __type__ = "crypter"
+ __name__ = "DailymotionBatch"
+ __type__ = "crypter"
__version__ = "0.01"
__pattern__ = r'https?://(?:www\.)?dailymotion\.com/((playlists/)?(?P<TYPE>playlist|user)/)?(?P<ID>[\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"""
- __authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
+ __license__ = "GPLv3"
+ __authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
def api_response(self, ref, req=None):
@@ -25,6 +28,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"}
@@ -37,6 +41,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}
@@ -52,9 +57,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}
@@ -70,9 +77,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")
@@ -88,7 +97,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)