Fixed missing segment error for aria2c downloader
This commit is contained in:
@@ -220,6 +220,7 @@ def download(
|
|||||||
|
|
||||||
for dl in stopped_downloads:
|
for dl in stopped_downloads:
|
||||||
if dl["status"] == "error":
|
if dl["status"] == "error":
|
||||||
|
error_code = int(dl.get("errorCode", 0))
|
||||||
used_uri = next(
|
used_uri = next(
|
||||||
uri["uri"]
|
uri["uri"]
|
||||||
for file in dl["files"]
|
for file in dl["files"]
|
||||||
@@ -227,6 +228,11 @@ def download(
|
|||||||
for uri in file["uris"]
|
for uri in file["uris"]
|
||||||
if uri["status"] == "used"
|
if uri["status"] == "used"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if error_code == 404:
|
||||||
|
yield dict(downloaded=f"[yellow]Skipped missing segment: {used_uri}")
|
||||||
|
continue # don’t raise, safely ignore
|
||||||
|
|
||||||
error = f"Download Error (#{dl['gid']}): {dl['errorMessage']} ({dl['errorCode']}), {used_uri}"
|
error = f"Download Error (#{dl['gid']}): {dl['errorMessage']} ({dl['errorCode']}), {used_uri}"
|
||||||
error_pretty = "\n ".join(textwrap.wrap(
|
error_pretty = "\n ".join(textwrap.wrap(
|
||||||
error,
|
error,
|
||||||
|
|||||||
Reference in New Issue
Block a user