mirror of
https://github.com/tubearchivist/tubearchivist
synced 2024-11-02 09:41:07 +00:00
better message for running and indexing queue
This commit is contained in:
parent
9cd23c3666
commit
baacd3ee39
@ -175,6 +175,14 @@ class VideoDownloader:
|
|||||||
if not success:
|
if not success:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
mess_dict = {
|
||||||
|
"status": self.MSG,
|
||||||
|
"level": "info",
|
||||||
|
"title": "Indexing....",
|
||||||
|
"message": "Add video metadata to index.",
|
||||||
|
}
|
||||||
|
RedisArchivist().set_message(self.MSG, mess_dict, expire=60)
|
||||||
|
|
||||||
vid_dict = index_new_video(
|
vid_dict = index_new_video(
|
||||||
youtube_id, video_overwrites=self.video_overwrites
|
youtube_id, video_overwrites=self.video_overwrites
|
||||||
)
|
)
|
||||||
@ -187,12 +195,17 @@ class VideoDownloader:
|
|||||||
}
|
}
|
||||||
RedisArchivist().set_message(self.MSG, mess_dict)
|
RedisArchivist().set_message(self.MSG, mess_dict)
|
||||||
|
|
||||||
|
if queue.has_item():
|
||||||
|
message = "Continue with next video."
|
||||||
|
else:
|
||||||
|
message = "Download queue is finished."
|
||||||
|
|
||||||
self.move_to_archive(vid_dict)
|
self.move_to_archive(vid_dict)
|
||||||
mess_dict = {
|
mess_dict = {
|
||||||
"status": self.MSG,
|
"status": self.MSG,
|
||||||
"level": "info",
|
"level": "info",
|
||||||
"title": "Completed",
|
"title": "Completed",
|
||||||
"message": "",
|
"message": message,
|
||||||
}
|
}
|
||||||
RedisArchivist().set_message(self.MSG, mess_dict, expire=10)
|
RedisArchivist().set_message(self.MSG, mess_dict, expire=10)
|
||||||
self._delete_from_pending(youtube_id)
|
self._delete_from_pending(youtube_id)
|
||||||
|
@ -143,3 +143,8 @@ class RedisQueue(RedisBase):
|
|||||||
def trim(self, size):
|
def trim(self, size):
|
||||||
"""trim the queue based on settings amount"""
|
"""trim the queue based on settings amount"""
|
||||||
self.conn.execute_command("LTRIM", self.key, 0, size)
|
self.conn.execute_command("LTRIM", self.key, 0, size)
|
||||||
|
|
||||||
|
def has_item(self):
|
||||||
|
"""check if queue as at least one pending item"""
|
||||||
|
result = self.conn.execute_command("LRANGE", self.key, 0, 0)
|
||||||
|
return bool(result)
|
||||||
|
Loading…
Reference in New Issue
Block a user