mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-29 12:35:13 +00:00
feat(tracks): resume segment decryption and rolling merge through the segment store
This commit is contained in:
@@ -119,7 +119,10 @@ stopped instead of restarting from byte zero.
|
||||
unshackle keeps the segments of a failed track in a `resume` directory inside the temp
|
||||
directory, and the next download of the same track takes them back from there. It removes a
|
||||
kept entry after 7 days, and `unshackle env clear temp` removes them all. A process that is
|
||||
killed, or a job cancelled over the REST API, keeps nothing.
|
||||
killed, and a job that the REST API cancels, keep their completed segments too. The next run
|
||||
moves them into the `resume` directory, and the next download of the track takes them from
|
||||
there. A merge during the download records its progress only when the download fails, so after
|
||||
a kill the next download keeps only the segments that the merge had not appended yet.
|
||||
|
||||
unshackle reuses only whole, fully downloaded segments. It always discards partially written
|
||||
segments, and no partial-byte (`Range`) resume across runs takes place. Reuse is possible only
|
||||
@@ -137,8 +140,18 @@ ranges must all match the previous download, or the download silently restarts c
|
||||
during its merge step. A failure before that point, such as a failed init segment
|
||||
fetch, keeps the downloaded segments.
|
||||
- A track downloaded with [`merge_segments`](#merge_segments) or
|
||||
[`decrypt_segments`](drm.md#decrypt_segments) never resumes. Both options consume
|
||||
or rewrite the segment files during the download.
|
||||
[`decrypt_segments`](drm.md#decrypt_segments) resumes too. A merge during the download
|
||||
keeps its output file up to the last segment it appended, and the next download cuts the
|
||||
file back to that point and appends from there. A segment that
|
||||
[`decrypt_segments`](drm.md#decrypt_segments) decrypted stays decrypted. The next
|
||||
download reuses it only with the same content key, and downloads it again when the
|
||||
content key changed.
|
||||
- A multi-period DASH track whose periods restart their timeline does not resume with
|
||||
`merge_segments`: the merge moves the decode times of each period, and the next
|
||||
download cannot continue that from the middle.
|
||||
- A service that puts a session token in the path of its segment URLs, or in the URL
|
||||
of an HLS variant playlist, gives the track new URLs on each run. Its downloads always
|
||||
restart.
|
||||
|
||||
For a one-off resume without changing config, pass `dl --continue-downloads` on the
|
||||
command line (the flag can only enable resume, never disable it).
|
||||
@@ -161,7 +174,7 @@ the next segment it needs and appends every segment that is ready in order, then
|
||||
segment file. With [`decrypt_segments`](drm.md#decrypt_segments) also on, each segment is
|
||||
appended after its decryption completes, never before.
|
||||
|
||||
This option is off by default because it disables resume. In a measurement of a 3 GiB track in
|
||||
This option is off by default. In a measurement of a 3 GiB track in
|
||||
1500 segments with 16 workers, on an SSD and a loopback server, the merge during the download took
|
||||
0.9 s more than the merge after it on Linux and 1.1 s less on Windows. With each connection limited
|
||||
to 8 MiB/s, it took 2.2 s less on Linux and 8.0 s less on Windows. On a hard disk, the append to one
|
||||
@@ -173,11 +186,8 @@ only when every segment shares one init segment and one `EXT-X-KEY`, with no
|
||||
`EXT-X-DISCONTINUITY`, and the DRM is Widevine, PlayReady, or none. AES-128 tracks, tracks
|
||||
with content key rotation or discontinuities, and subtitle tracks keep the merge after the download.
|
||||
|
||||
!!! note "No resume"
|
||||
|
||||
A track that merges segment by segment always downloads from the start.
|
||||
[`continue_downloads`](#continue_downloads) cannot reuse its segments, because unshackle
|
||||
deletes each segment after it appends it.
|
||||
With [`continue_downloads`](#continue_downloads) on, a failed track keeps its output file and
|
||||
the number of segments in it, and the next download continues from there.
|
||||
|
||||
```yaml
|
||||
merge_segments: true
|
||||
|
||||
Reference in New Issue
Block a user