fix(amazon): _record_to_status read 'filename' not 'original_filename'
The engine worker stores the encoded filename under the key 'filename' (see worker.py dispatch). _record_to_status was reading 'original_filename', which always returns "" — so every DownloadStatus emitted by get_all_downloads/get_download_status had an empty filename string. The download monitor builds lookup keys as _make_context_key(download.username, download.filename). With filename="" the key was always "amazon::" which never matched the task's "amazon::B0B1234||Artist - Title" key. Monitor never detected Amazon download completions, so tasks sat stuck at Downloading 0% forever even though the files had actually downloaded. Also fixes tests that had the same wrong key.
This commit is contained in:
parent
9fb63ff86d
commit
ebda0b8613
2 changed files with 3 additions and 3 deletions
|
|
@ -431,7 +431,7 @@ class AmazonDownloadClient(DownloadSourcePlugin):
|
|||
def _record_to_status(download_id: str, rec: Dict[str, Any]) -> DownloadStatus:
|
||||
return DownloadStatus(
|
||||
id=download_id,
|
||||
filename=str(rec.get("original_filename", "")),
|
||||
filename=str(rec.get("filename", "")),
|
||||
username="amazon",
|
||||
state=str(rec.get("state", "queued")),
|
||||
progress=float(rec.get("progress", 0.0)),
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ class TestUniquePath:
|
|||
class TestRecordToStatus:
|
||||
def test_fields_mapped(self):
|
||||
rec = {
|
||||
"original_filename": "B1||Artist - Title",
|
||||
"filename": "B1||Artist - Title",
|
||||
"state": "downloading",
|
||||
"progress": 0.5,
|
||||
"size": 10_000_000,
|
||||
|
|
@ -718,7 +718,7 @@ class TestStatusInterface:
|
|||
engine = MagicMock()
|
||||
engine.get_all_records.return_value = {
|
||||
"dl-001": {
|
||||
"original_filename": "B1||A - T",
|
||||
"filename": "B1||A - T",
|
||||
"state": "complete",
|
||||
"progress": 1.0,
|
||||
"size": 5_000_000,
|
||||
|
|
|
|||
Loading…
Reference in a new issue