Skip to content

Commit c8e2fc5

Browse files
committed
fix: put status downloading to prevent live stream from showing preparing endlessly
1 parent cf2ee30 commit c8e2fc5

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

app/library/Download.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def _postprocessor_hook(self, data: dict) -> None:
189189
dataDict = {k: v for k, v in data.items() if k in self._ytdlp_fields}
190190
self.status_queue.put({"id": self.id, "action": "postprocessing", **dataDict, "status": "postprocessing"})
191191

192-
def post_hooks(self, filename: str | None = None) -> None:
192+
def _post_hooks(self, filename: str | None = None) -> None:
193193
if not filename:
194194
return
195195

@@ -227,7 +227,7 @@ def _download(self) -> None:
227227
{
228228
"progress_hooks": [self._progress_hook],
229229
"postprocessor_hooks": [self._postprocessor_hook],
230-
"post_hooks": [self.post_hooks],
230+
"post_hooks": [self._post_hooks],
231231
}
232232
)
233233

@@ -330,6 +330,8 @@ def mark_cancelled(*_) -> None:
330330

331331
signal.signal(signal.SIGUSR1, mark_cancelled)
332332

333+
self.status_queue.put({"id": self.id, "status": "downloading"})
334+
333335
if isinstance(self.info_dict, dict) and len(self.info_dict) > 1:
334336
self.logger.debug(f"Downloading '{self.info.url}' using pre-info.")
335337
_dct: dict = self.info_dict.copy()

app/tests/test_download.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ def test_post_hooks_pushes_filename(self) -> None:
152152
d = Download(make_item())
153153
q = DummyQueue()
154154
d.status_queue = q
155-
d.post_hooks(None)
155+
d._post_hooks(None)
156156
assert len(q.items) == 0
157-
d.post_hooks("name.ext")
157+
d._post_hooks("name.ext")
158158
assert len(q.items) == 1
159159
assert q.items[0]["filename"] == "name.ext"
160160

0 commit comments

Comments
 (0)