From a11658eb7aeadfae5962b76692bbfa8d7d16640f Mon Sep 17 00:00:00 2001
From: Robert Goldmann <deadlocker@gmx.de>
Date: Thu, 17 Oct 2019 14:40:43 +0200
Subject: [PATCH] pretty printing and redirect errors to stderr

---
 SaveMyPlaylist.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/SaveMyPlaylist.py b/SaveMyPlaylist.py
index 6ea4c22..c827b9d 100644
--- a/SaveMyPlaylist.py
+++ b/SaveMyPlaylist.py
@@ -1,12 +1,16 @@
 from __future__ import unicode_literals
 
 import os
+import sys
 
 import googleapiclient.discovery
 import googleapiclient.errors
 import youtube_dl
 
 
+VERSION = (2, 0, 0)
+
+
 class MyLogger(object):
     def debug(self, msg):
         pass
@@ -15,7 +19,7 @@ class MyLogger(object):
         pass
 
     def error(self, msg):
-        print(msg)
+        print(msg, file=sys.stderr)
 
 
 def my_hook(d):
@@ -35,6 +39,8 @@ class SaveMyPlaylist:
     ILLEGAL_CHARS = ['NUL', '\',''//', ':', '*', '"', '<', '>', '|']
 
     def __init__(self, apiKey, playlistId):
+        print('### SaveMyPlaylist v{} ###'.format('.'.join(str(i) for i in VERSION)))
+        print('=============================\n')
         self.__apiKey = apiKey
         self.__playlistId = playlistId
         self.__youtubeApi = googleapiclient.discovery.build(self.API_NAME, self.API_VERSION, developerKey=self.__apiKey)
@@ -130,6 +136,7 @@ if __name__ == '__main__':
     API_KEY = 'AIzaSyD1cQOPzYDRe5pylXEFsQw6u-MaBSOX09Y'
     PLAYLIST_ID = 'PL7F-5FkCMt0HRvF40L2704WhjJZf9G6SB'
     DESTINATION_FOLDER = 'C:/Users/ROGO2/Desktop/123'
+    SKIP_DOWNLOAD = True
 
     saveMyPlaylist = SaveMyPlaylist(API_KEY, PLAYLIST_ID)
-    saveMyPlaylist.download_items(DESTINATION_FOLDER, True)
+    saveMyPlaylist.download_items(DESTINATION_FOLDER, SKIP_DOWNLOAD)
-- 
GitLab