Skip to content
Snippets Groups Projects
Commit 4fb28395 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

members should be accessible by debugger

parent 8c669ece
No related branches found
No related tags found
No related merge requests found
...@@ -42,10 +42,10 @@ class SaveMyPlaylist: ...@@ -42,10 +42,10 @@ class SaveMyPlaylist:
def __init__(self, apiKey, playlistId): def __init__(self, apiKey, playlistId):
print('### SaveMyPlaylist v{} ###'.format('.'.join(str(i) for i in VERSION))) print('### SaveMyPlaylist v{} ###'.format('.'.join(str(i) for i in VERSION)))
print('=============================\n') print('=============================\n')
self.__apiKey = apiKey self._apiKey = apiKey
self.__playlistId = playlistId self._playlistId = playlistId
self.__youtubeApi = googleapiclient.discovery.build(self.API_NAME, self.API_VERSION, developerKey=self.__apiKey) self._youtubeApi = googleapiclient.discovery.build(self.API_NAME, self.API_VERSION, developerKey=self._apiKey)
self.__items = self.__fetch_all_playlist_items() self._items = self.__fetch_all_playlist_items()
def __fetch_all_playlist_items(self): def __fetch_all_playlist_items(self):
items = [] items = []
...@@ -60,15 +60,15 @@ class SaveMyPlaylist: ...@@ -60,15 +60,15 @@ class SaveMyPlaylist:
def __fetch_playlist_items(self, nextPageToken=None): def __fetch_playlist_items(self, nextPageToken=None):
if nextPageToken is None or nextPageToken == 0: if nextPageToken is None or nextPageToken == 0:
request = self.__youtubeApi.playlistItems().list( request = self._youtubeApi.playlistItems().list(
part='snippet', part='snippet',
playlistId=self.__playlistId, playlistId=self._playlistId,
maxResults=50, maxResults=50,
) )
else: else:
request = self.__youtubeApi.playlistItems().list( request = self._youtubeApi.playlistItems().list(
part='snippet', part='snippet',
playlistId=self.__playlistId, playlistId=self._playlistId,
maxResults=50, maxResults=50,
pageToken=nextPageToken pageToken=nextPageToken
) )
...@@ -100,14 +100,14 @@ class SaveMyPlaylist: ...@@ -100,14 +100,14 @@ class SaveMyPlaylist:
print('\n>>> Started Downloading...') print('\n>>> Started Downloading...')
newVideos = [] newVideos = []
for idx, item in enumerate(self.__items): for idx, item in enumerate(self._items):
fileName = '{} - {}.mp4'.format(item[self.TITLE], item[self.CHANNEL]) fileName = '{} - {}.mp4'.format(item[self.TITLE], item[self.CHANNEL])
fileName = self.__escape_file_name(fileName) fileName = self.__escape_file_name(fileName)
if fileName in downloadedVideos: if fileName in downloadedVideos:
print('Skipping {}/{}: "{}" as it already exists'.format(idx + 1, len(self.__items), fileName)) print('Skipping {}/{}: "{}" as it already exists'.format(idx + 1, len(self._items), fileName))
continue continue
print('Downloading {}/{}: "{}"'.format(idx + 1, len(self.__items), fileName)) print('Downloading {}/{}: "{}"'.format(idx + 1, len(self._items), fileName))
newVideos.append(item) newVideos.append(item)
ydl_opts = { ydl_opts = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment