mirror of
https://github.com/IlanCosman/tide.git
synced 2024-08-16 11:40:22 +03:00
add asciicast_ezgif_durations
This commit is contained in:
parent
199b3df16c
commit
5be8097592
17
tools/asciicast_ezgif_durations.fish
Normal file
17
tools/asciicast_ezgif_durations.fish
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
function asciicast_ezgif_durations -a file
|
||||||
|
set -l times (string match -rg "^\[([\d.]*)" <$file)
|
||||||
|
|
||||||
|
set -l durations # Durations in hundredths of seconds
|
||||||
|
|
||||||
|
set -l prev_time $times[1]
|
||||||
|
for time in $times[2..]
|
||||||
|
set -a durations (math --scale=0 "($time - $prev_time) * 100")
|
||||||
|
set prev_time $time
|
||||||
|
end
|
||||||
|
|
||||||
|
set -l file_text (cat $file)
|
||||||
|
for duration in $durations
|
||||||
|
string replace -r "^\[[\d.]*" $duration $file_text[1]
|
||||||
|
set -e file_text[1]
|
||||||
|
end >$file
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user