Fix duplicate being added to the db.
This commit is contained in:
parent
215b9e2fdd
commit
6bc50a3bc0
2 changed files with 8 additions and 2 deletions
|
|
@ -69,8 +69,12 @@ class DataStore:
|
|||
return items
|
||||
|
||||
def put(self, value: Download) -> None:
|
||||
_id: str = value.info._id
|
||||
self.dict[_id] = value
|
||||
for key in self.dict:
|
||||
if self.dict[key].info.url == value.info.url:
|
||||
value.info._id = key
|
||||
return
|
||||
|
||||
self.dict[value.info._id] = value
|
||||
self._updateStoreItem(self.type, value.info)
|
||||
|
||||
def delete(self, key: str) -> None:
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import asyncio
|
|||
from email.utils import formatdate
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
import yt_dlp
|
||||
from sqlite3 import Connection
|
||||
from src.Config import Config
|
||||
|
|
@ -104,6 +105,7 @@ class DownloadQueue:
|
|||
ytdlp_cookies=ytdlp_cookies,
|
||||
ytdlp_config=ytdlp_config,
|
||||
output_template=output_template if output_template else self.config.output_template,
|
||||
datetime=formatdate(time.time()),
|
||||
error=error,
|
||||
is_live=entry['is_live'] if 'is_live' in entry else None,
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue