mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-04 19:30:13 +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"""
|
"""setup download queue in redis loop until no more items"""
|
||||||
queue = RedisQueue("dl_queue")
|
queue = RedisQueue("dl_queue")
|
||||||
|
|
||||||
|
limit_queue = self.config["downloads"]["limit_count"]
|
||||||
|
if limit_queue:
|
||||||
|
queue.trim(limit_queue - 1)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
youtube_id = queue.get_next()
|
youtube_id = queue.get_next()
|
||||||
if not youtube_id:
|
if not youtube_id:
|
||||||
|
@ -166,6 +166,10 @@ class RedisQueue:
|
|||||||
"""remove single item from list if it's there"""
|
"""remove single item from list if it's there"""
|
||||||
self.conn.execute_command("LREM", self.key, 0, to_clear)
|
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:
|
class DurationConverter:
|
||||||
"""
|
"""
|
||||||
|
@ -15,12 +15,15 @@ function checkMessage() {
|
|||||||
req.open('GET', '/downloads/progress', true);
|
req.open('GET', '/downloads/progress', true);
|
||||||
req.onload = function() {
|
req.onload = function() {
|
||||||
var dlProgress = req.response;
|
var dlProgress = req.response;
|
||||||
|
var dlStatus = dlProgress['status'];
|
||||||
if (dlProgress['status']) {
|
if (dlProgress['status']) {
|
||||||
buildDownloadMessage(dlProgress);
|
buildDownloadMessage(dlProgress);
|
||||||
handleInterval();
|
handleInterval();
|
||||||
|
if (dlStatus == 'downloading') {
|
||||||
buildDownloadIcons();
|
buildDownloadIcons();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
req.send();
|
req.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user