From de2371c43c0480e55fe50e7c0903ea0778b9cf54 Mon Sep 17 00:00:00 2001 From: simon Date: Sun, 17 Oct 2021 11:28:05 +0700 Subject: [PATCH] handle running empty dl queue, #55 --- tubearchivist/home/src/download.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tubearchivist/home/src/download.py b/tubearchivist/home/src/download.py index 9d3196b..bebc938 100644 --- a/tubearchivist/home/src/download.py +++ b/tubearchivist/home/src/download.py @@ -455,6 +455,18 @@ class VideoDownloader: """add pending videos to download queue""" all_pending, _ = PendingList().get_all_pending() to_add = [i["youtube_id"] for i in all_pending] + if not to_add: + # there is nothing pending + print("download queue is empty") + mess_dict = { + "status": "downloading", + "level": "error", + "title": "Download queue is empty", + "message": "", + } + RedisArchivist().set_message("progress:download", mess_dict) + return + queue = RedisQueue("dl_queue") queue.add_list(to_add)