From fd6885ad2d3edfed1786a27e979b6b906247abb0 Mon Sep 17 00:00:00 2001
From: Robert Goldmann <deadlocker@gmx.de>
Date: Sat, 18 Apr 2020 21:04:48 +0200
Subject: [PATCH] append video to newVideos list after downloading successfully

---
 SaveMyPlaylist.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/SaveMyPlaylist.py b/SaveMyPlaylist.py
index 0e3304e..40c64ec 100644
--- a/SaveMyPlaylist.py
+++ b/SaveMyPlaylist.py
@@ -149,7 +149,6 @@ class SaveMyPlaylist:
 
             try:
                 logger.info('Downloading {}/{}: "{}"'.format(idx + 1, len(self._items), fileName))
-                newVideos.append(item)
 
                 ydl_opts = {
                     'format': 'bestvideo[ext=mp4]+bestaudio[ext=m4a]',
@@ -164,6 +163,8 @@ class SaveMyPlaylist:
 
                 with youtube_dl.YoutubeDL(ydl_opts) as ydl:
                     ydl.download(['https://www.youtube.com/watch?v={}'.format(item[self.VIDEO_ID])])
+
+                newVideos.append(item)
             except Exception as e:
                 logger.error(f'Error while downloading video "{fileName}" with ID: "{item[self.VIDEO_ID]}"', exc_info=e)
 
-- 
GitLab