From b8f7aa3298947312df072478d9f92ac4b2990b53 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 27 Nov 2021 12:07:27 +0700 Subject: [PATCH] cleaner handeling of findPlaylists --- tubearchivist/home/tasks.py | 6 ++++++ tubearchivist/static/script.js | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tubearchivist/home/tasks.py b/tubearchivist/home/tasks.py index dcca887..7ced590 100644 --- a/tubearchivist/home/tasks.py +++ b/tubearchivist/home/tasks.py @@ -228,6 +228,10 @@ def index_channel_playlists(channel_id): channel_handler = YoutubeChannel(channel_id) all_playlists = channel_handler.get_all_playlists() + if not all_playlists: + print(f"no playlists found for channel {channel_id}") + return + all_indexed = PendingList().get_all_indexed() all_youtube_ids = [i["youtube_id"] for i in all_indexed] @@ -255,3 +259,5 @@ def index_channel_playlists(channel_id): handler = ThumbManager() missing_playlists = handler.get_missing_playlists() handler.download_playlist(missing_playlists) + + return diff --git a/tubearchivist/static/script.js b/tubearchivist/static/script.js index 00bc5cd..5dc7e4b 100644 --- a/tubearchivist/static/script.js +++ b/tubearchivist/static/script.js @@ -224,9 +224,7 @@ function findPlaylists(button) { // clear button var message = document.createElement('p'); message.innerText = 'Scraping for playlists in progress'; - var toReplace = document.getElementById('find-playlists-button'); - toReplace.innerHTML = ''; - toReplace.appendChild(message); + document.getElementById("find-playlists-button").replaceWith(message); } // delete from file system