mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 11:50:14 +00:00
add limit_queue setting back, make buttons only show up while downlaoding
This commit is contained in:
parent
d0b54f8a88
commit
f53391c1bb
@ -418,6 +418,10 @@ class VideoDownloader:
|
||||
"""setup download queue in redis loop until no more items"""
|
||||
queue = RedisQueue("dl_queue")
|
||||
|
||||
limit_queue = self.config["downloads"]["limit_count"]
|
||||
if limit_queue:
|
||||
queue.trim(limit_queue - 1)
|
||||
|
||||
while True:
|
||||
youtube_id = queue.get_next()
|
||||
if not youtube_id:
|
||||
|
@ -166,6 +166,10 @@ class RedisQueue:
|
||||
"""remove single item from list if it's there"""
|
||||
self.conn.execute_command("LREM", self.key, 0, to_clear)
|
||||
|
||||
def trim(self, size):
|
||||
"""trim the queue based on settings amount"""
|
||||
self.conn.execute_command("LTRIM", self.key, 0, size)
|
||||
|
||||
|
||||
class DurationConverter:
|
||||
"""
|
||||
|
@ -15,12 +15,15 @@ function checkMessage() {
|
||||
req.open('GET', '/downloads/progress', true);
|
||||
req.onload = function() {
|
||||
var dlProgress = req.response;
|
||||
var dlStatus = dlProgress['status'];
|
||||
if (dlProgress['status']) {
|
||||
buildDownloadMessage(dlProgress);
|
||||
handleInterval();
|
||||
if (dlStatus == 'downloading') {
|
||||
buildDownloadIcons();
|
||||
};
|
||||
};
|
||||
};
|
||||
req.send();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user