This commit is contained in:
ArabCoders 2023-11-28 14:03:27 +03:00
parent 6bc50a3bc0
commit 58f1bd24f2
2 changed files with 15 additions and 12 deletions

View file

@ -68,7 +68,7 @@ class DataStore:
return items
def put(self, value: Download) -> None:
def put(self, value: Download) -> Download:
for key in self.dict:
if self.dict[key].info.url == value.info.url:
value.info._id = key
@ -77,6 +77,8 @@ class DataStore:
self.dict[value.info._id] = value
self._updateStoreItem(self.type, value.info)
return self.dict[value.info._id]
def delete(self, key: str) -> None:
if not key in self.dict:
return

View file

@ -125,19 +125,17 @@ class DownloadQueue:
dl.output_template = dl.output_template.replace(
f"%({property})s", str(value))
self.queue.put(
Download(
info=dl,
download_dir=dldirectory,
temp_dir=self.config.temp_path,
output_template_chapter=output_chapter,
default_ytdl_opts=self.config.ytdl_options,
debug=bool(self.config.ytdl_debug)
)
)
itemDownload = self.queue.put(Download(
info=dl,
download_dir=dldirectory,
temp_dir=self.config.temp_path,
output_template_chapter=output_chapter,
default_ytdl_opts=self.config.ytdl_options,
debug=bool(self.config.ytdl_debug)
))
self.event.set()
await self.notifier.added(dl)
await self.notifier.added(itemDownload.info)
return {
'status': 'ok'
@ -148,6 +146,9 @@ class DownloadQueue:
quality=quality,
format=format,
folder=folder,
ytdlp_config=ytdlp_config,
ytdlp_cookies=ytdlp_cookies,
output_template=output_template,
already=already
)