Mark track as stopping when skipping segments

This commit is contained in:
rlaphoenix 2023-02-28 18:14:03 +00:00
parent b482f86bb3
commit f4ad7a2e6c
2 changed files with 38 additions and 36 deletions

View File

@ -524,9 +524,6 @@ class DASH:
download_size = download.result() download_size = download.result()
except KeyboardInterrupt: except KeyboardInterrupt:
stop_event.set() stop_event.set()
if not has_stopped:
has_stopped = True
progress(downloaded="[orange]STOPPING")
except Exception as e: except Exception as e:
stop_event.set() stop_event.set()
if has_stopped: if has_stopped:
@ -537,10 +534,14 @@ class DASH:
progress(downloaded="[red]FAILING") progress(downloaded="[red]FAILING")
traceback.print_exception(e) traceback.print_exception(e)
log.error(f"Segment Download worker threw an unhandled exception: {e!r}") log.error(f"Segment Download worker threw an unhandled exception: {e!r}")
else:
if stop_event.is_set():
# skipped
continue continue
if stop_event.is_set():
if not has_stopped:
has_stopped = True
progress(downloaded="[orange]STOPPING")
continue
progress(advance=1) progress(advance=1)
now = time.time() now = time.time()

View File

@ -364,9 +364,6 @@ class HLS:
download_size = download.result() download_size = download.result()
except KeyboardInterrupt: except KeyboardInterrupt:
stop_event.set() stop_event.set()
if not has_stopped:
has_stopped = True
progress(downloaded="[orange]STOPPING")
except Exception as e: except Exception as e:
stop_event.set() stop_event.set()
if has_stopped: if has_stopped:
@ -377,10 +374,14 @@ class HLS:
progress(downloaded="[red]FAILING") progress(downloaded="[red]FAILING")
traceback.print_exception(e) traceback.print_exception(e)
log.error(f"Segment Download worker threw an unhandled exception: {e!r}") log.error(f"Segment Download worker threw an unhandled exception: {e!r}")
else:
if stop_event.is_set():
# skipped
continue continue
if stop_event.is_set():
if not has_stopped:
has_stopped = True
progress(downloaded="[orange]STOPPING")
continue
progress(advance=1) progress(advance=1)
now = time.time() now = time.time()