fix: put status downloading to prevent live stream from showing preparing endlessly

This commit is contained in:
arabcoders 2026-01-08 19:08:39 +03:00
parent cf2ee306d2
commit c8e2fc5dc9
2 changed files with 6 additions and 4 deletions

View file

@ -189,7 +189,7 @@ class Download:
dataDict = {k: v for k, v in data.items() if k in self._ytdlp_fields}
self.status_queue.put({"id": self.id, "action": "postprocessing", **dataDict, "status": "postprocessing"})
def post_hooks(self, filename: str | None = None) -> None:
def _post_hooks(self, filename: str | None = None) -> None:
if not filename:
return
@ -227,7 +227,7 @@ class Download:
{
"progress_hooks": [self._progress_hook],
"postprocessor_hooks": [self._postprocessor_hook],
"post_hooks": [self.post_hooks],
"post_hooks": [self._post_hooks],
}
)
@ -330,6 +330,8 @@ class Download:
signal.signal(signal.SIGUSR1, mark_cancelled)
self.status_queue.put({"id": self.id, "status": "downloading"})
if isinstance(self.info_dict, dict) and len(self.info_dict) > 1:
self.logger.debug(f"Downloading '{self.info.url}' using pre-info.")
_dct: dict = self.info_dict.copy()

View file

@ -152,9 +152,9 @@ class TestDownloadHooks:
d = Download(make_item())
q = DummyQueue()
d.status_queue = q
d.post_hooks(None)
d._post_hooks(None)
assert len(q.items) == 0
d.post_hooks("name.ext")
d._post_hooks("name.ext")
assert len(q.items) == 1
assert q.items[0]["filename"] == "name.ext"