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

View file

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