fix: put status downloading to prevent live stream from showing preparing endlessly
This commit is contained in:
parent
cf2ee306d2
commit
c8e2fc5dc9
2 changed files with 6 additions and 4 deletions
|
|
@ -189,7 +189,7 @@ class Download:
|
||||||
dataDict = {k: v for k, v in data.items() if k in self._ytdlp_fields}
|
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"})
|
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:
|
if not filename:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -227,7 +227,7 @@ class Download:
|
||||||
{
|
{
|
||||||
"progress_hooks": [self._progress_hook],
|
"progress_hooks": [self._progress_hook],
|
||||||
"postprocessor_hooks": [self._postprocessor_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)
|
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:
|
if isinstance(self.info_dict, dict) and len(self.info_dict) > 1:
|
||||||
self.logger.debug(f"Downloading '{self.info.url}' using pre-info.")
|
self.logger.debug(f"Downloading '{self.info.url}' using pre-info.")
|
||||||
_dct: dict = self.info_dict.copy()
|
_dct: dict = self.info_dict.copy()
|
||||||
|
|
|
||||||
|
|
@ -152,9 +152,9 @@ class TestDownloadHooks:
|
||||||
d = Download(make_item())
|
d = Download(make_item())
|
||||||
q = DummyQueue()
|
q = DummyQueue()
|
||||||
d.status_queue = q
|
d.status_queue = q
|
||||||
d.post_hooks(None)
|
d._post_hooks(None)
|
||||||
assert len(q.items) == 0
|
assert len(q.items) == 0
|
||||||
d.post_hooks("name.ext")
|
d._post_hooks("name.ext")
|
||||||
assert len(q.items) == 1
|
assert len(q.items) == 1
|
||||||
assert q.items[0]["filename"] == "name.ext"
|
assert q.items[0]["filename"] == "name.ext"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue