3 # This script pretends to be youtube-dl. It actually does nothing
4 # except print fake output on a delay.
11 dbfile
="$(dirname "$0")/../simulation.db"
13 while [ -- != "$1" ]; do
19 # Persist download state across runs
21 if grep -q -- "$id" "$dbfile" 2>/dev
/null
; then
22 sed -i.tmp
"s/^$id.*/$id $1/" "$dbfile"
25 printf "%s %s\n" "$id" "$1" >> "$dbfile"
29 if grep -q -- "$id" "$dbfile" 2>/dev
/null
; then
30 awk "/^$id/{print \$2}" "$dbfile"
36 printf '[youtube] %s: Downloading webpage\n' "$id"
37 printf '[youtube] %s: Downloading video info webpage\n' "$id"
38 printf '[youtube] %s: Extracting video information\n' "$id"
39 printf '[download] Destination: %s\n' "$id.mp4"
40 for i
in $
(seq $
(get
"$id") $
((nsteps
- 1))); do
41 printf '[download] % 5.1f%% of % 2.2fMiB at % 2.2fMiB/s ETA %02d:%02d\n' \
42 $
((i
* 100 / (nsteps
- 1))) $size $rate \
43 $
(((nsteps
- i
- 1) / 60)) $
(((nsteps
- i
- 1) % 60))