Formater des vtt pour en faire des lignes plus ou moins longues - retour accueil
git clone git://bebou.netlib.re/fmtvtt
Log | Files | Refs |
commit 0e878797acb24dc439c2591b86423f9f54963858 parent c57dbe4d2c11f5341948c9e6853a785482ec48ed Auteurice: Arthur Pons <arthur.pons@unistra.fr> Date: Wed, 18 Dec 2024 12:06:53 +0100 On modifie les vtt maintenant Parce que mon besoin c'est de les mettre dans le web (et ça fonctionne aussi dans mpv alors que l'inverse non) Diffstat:
A | .gitignore | | | 2 | ++ |
D | fmtsrt | | | 20 | -------------------- |
A | fmtvtt.sh | | | 19 | +++++++++++++++++++ |
A | makefile | | | 4 | ++++ |
4 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/.gitignore b/.gitignore @@ -0,0 +1,2 @@ +fmtvtt +.*.sw? diff --git a/fmtsrt b/fmtsrt @@ -1,20 +0,0 @@ -awk ' -BEGIN {offset=0} -function addnextline() { - getline;getline;getline - end=$3 - getline - line=line" "$0 -} -/^[0-9]+$/ { n=$0+offset; next } -/^[0-9:,]+ --> [0-9:,]+$/ { start=$1; end=$3; next } -/^$/ { print; next } -{ - line=$0;cut=0;newline="" - l=length(line) - while(l<60) { addnextline(); l=length(line) } - print n - print start" --> "end - print line -} -' diff --git a/fmtvtt.sh b/fmtvtt.sh @@ -0,0 +1,19 @@ +awk ' +function addnextline() { + getline;getline + end=$3 + getline + line=line" "$0 +} +/^[0-9]+$/ { n=$0; next } +/^[0-9:.]+ --> [0-9:.]+$/ { start=$1; end=$3; next } +/^WEBVTT$/ { print; next } +/^$/ { next } +{ + line=$0;l=length(line) + while(l<60) { addnextline(); l=length(line) } + print n + print start" --> "end + print line +} +' diff --git a/makefile b/makefile @@ -0,0 +1,4 @@ +all: fmtvtt + +install: + cp fmtvtt /usr/local/bin