summaryrefslogtreecommitdiffstats
path: root/module/plugins/crypter/YoutubeComFolder.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-07 01:23:55 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-07 01:23:55 +0200
commitb1759bc440cd6013837697eb8de540914f693ffd (patch)
treed170caf63d7f65e44d23ea2d91a65759a1665928 /module/plugins/crypter/YoutubeComFolder.py
parent[Plugin] Fix decoding in load method (diff)
downloadpyload-b1759bc440cd6013837697eb8de540914f693ffd.tar.xz
No camelCase style anymore
Diffstat (limited to 'module/plugins/crypter/YoutubeComFolder.py')
-rw-r--r--module/plugins/crypter/YoutubeComFolder.py46
1 files changed, 23 insertions, 23 deletions
diff --git a/module/plugins/crypter/YoutubeComFolder.py b/module/plugins/crypter/YoutubeComFolder.py
index fed832b7d..4b11e1244 100644
--- a/module/plugins/crypter/YoutubeComFolder.py
+++ b/module/plugins/crypter/YoutubeComFolder.py
@@ -11,7 +11,7 @@ from module.utils import save_join as fs_join
class YoutubeComFolder(Crypter):
__name__ = "YoutubeComFolder"
__type__ = "crypter"
- __version__ = "1.02"
+ __version__ = "1.03"
__pattern__ = r'https?://(?:www\.|m\.)?youtube\.com/(?P<TYPE>user|playlist|view_play_list)(/|.*?[?&](?:list|p)=)(?P<ID>[\w-]+)'
__config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True ),
@@ -35,7 +35,7 @@ class YoutubeComFolder(Crypter):
return json_loads(html)
- def getChannel(self, user):
+ def get_channel(self, user):
channels = self.api_response("channels", {"part": "id,snippet,contentDetails", "forUsername": user, "maxResults": "50"})
if channels['items']:
channel = channels['items'][0]
@@ -45,7 +45,7 @@ class YoutubeComFolder(Crypter):
"user": user} #: One lone channel for user?
- def getPlaylist(self, p_id):
+ def get_playlist(self, p_id):
playlists = self.api_response("playlists", {"part": "snippet", "id": p_id})
if playlists['items']:
playlist = playlists['items'][0]
@@ -55,7 +55,7 @@ class YoutubeComFolder(Crypter):
"channelTitle": playlist['snippet']['channelTitle']}
- def _getPlaylists(self, id, token=None):
+ def _get_playlists(self, id, token=None):
req = {"part": "id", "maxResults": "50", "channelId": id}
if token:
req.update({"pageToken": token})
@@ -66,15 +66,15 @@ class YoutubeComFolder(Crypter):
yield playlist['id']
if "nextPageToken" in playlists:
- for item in self._getPlaylists(id, playlists['nextPageToken']):
+ for item in self._get_playlists(id, playlists['nextPageToken']):
yield item
- def getPlaylists(self, ch_id):
- return map(self.getPlaylist, self._getPlaylists(ch_id))
+ def get_playlists(self, ch_id):
+ return map(self.get_playlist, self._get_playlists(ch_id))
- def _getVideosId(self, id, token=None):
+ def _get_videos_id(self, id, token=None):
req = {"part": "contentDetails", "maxResults": "50", "playlistId": id}
if token:
req.update({"pageToken": token})
@@ -85,12 +85,12 @@ class YoutubeComFolder(Crypter):
yield item['contentDetails']['videoId']
if "nextPageToken" in playlist:
- for item in self._getVideosId(id, playlist['nextPageToken']):
+ for item in self._get_videos_id(id, playlist['nextPageToken']):
yield item
- def getVideosId(self, p_id):
- return list(self._getVideosId(p_id))
+ def get_videos_id(self, p_id):
+ return list(self._get_videos_id(p_id))
def decrypt(self, pyfile):
@@ -99,29 +99,29 @@ class YoutubeComFolder(Crypter):
m_type = m.group('TYPE')
if m_type == "user":
- self.logDebug("Url recognized as Channel")
+ self.log_debug("Url recognized as Channel")
user = m_id
- channel = self.getChannel(user)
+ channel = self.get_channel(user)
if channel:
- playlists = self.getPlaylists(channel['id'])
- self.logDebug("%s playlist\s found on channel \"%s\"" % (len(playlists), channel['title']))
+ playlists = self.get_playlists(channel['id'])
+ self.log_debug("%s playlist\s found on channel \"%s\"" % (len(playlists), channel['title']))
- relatedplaylist = {p_name: self.getPlaylist(p_id) for p_name, p_id in channel['relatedPlaylists'].iteritems()}
- self.logDebug("Channel's related playlists found = %s" % relatedplaylist.keys())
+ relatedplaylist = {p_name: self.get_playlist(p_id) for p_name, p_id in channel['relatedPlaylists'].iteritems()}
+ self.log_debug("Channel's related playlists found = %s" % relatedplaylist.keys())
relatedplaylist['uploads']['title'] = "Unplaylisted videos"
relatedplaylist['uploads']['checkDups'] = True #: checkDups flag
for p_name, p_data in relatedplaylist.iteritems():
- if self.getConfig(p_name):
+ if self.get_config(p_name):
p_data['title'] += " of " + user
playlists.append(p_data)
else:
playlists = []
else:
- self.logDebug("Url recognized as Playlist")
- playlists = [self.getPlaylist(m_id)]
+ self.log_debug("Url recognized as Playlist")
+ playlists = [self.get_playlist(m_id)]
if not playlists:
self.fail(_("No playlist available"))
@@ -130,15 +130,15 @@ class YoutubeComFolder(Crypter):
urlize = lambda x: "https://www.youtube.com/watch?v=" + x
for p in playlists:
p_name = p['title']
- p_videos = self.getVideosId(p['id'])
+ p_videos = self.get_videos_id(p['id'])
p_folder = fs_join(self.core.config.get("general", "download_folder"), p['channelTitle'], p_name)
- self.logDebug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name))
+ self.log_debug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name))
if not p_videos:
continue
elif "checkDups" in p:
p_urls = [urlize(v_id) for v_id in p_videos if v_id not in addedvideos]
- self.logDebug("%s video\s available on playlist \"%s\" after duplicates cleanup" % (len(p_urls), p_name))
+ self.log_debug("%s video\s available on playlist \"%s\" after duplicates cleanup" % (len(p_urls), p_name))
else:
p_urls = map(urlize, p_videos)