fix duplication issue with download_now

This commit is contained in:
simon 2021-09-24 16:58:48 +07:00
parent fb1913f912
commit 91a57cc780

View File

@ -146,6 +146,7 @@ class RedisQueue:
def add_priority(self, to_add): def add_priority(self, to_add):
"""add single video to front of queue""" """add single video to front of queue"""
self.clear_item(to_add)
self.conn.execute_command("LPUSH", self.key, to_add) self.conn.execute_command("LPUSH", self.key, to_add)
def get_next(self): def get_next(self):
@ -161,6 +162,10 @@ class RedisQueue:
"""delete list from redis""" """delete list from redis"""
self.conn.execute_command("DEL", self.key) self.conn.execute_command("DEL", self.key)
def clear_item(self, to_clear):
"""remove single item from list if it's there"""
self.conn.execute_command("LREM", self.key, 0, to_clear)
class DurationConverter: class DurationConverter:
""" """