From d5e9326e2fda94722e9fc8f815cf494aab903959 Mon Sep 17 00:00:00 2001 From: Iris Lightshard Date: Mon, 16 Dec 2024 20:37:42 -0700 Subject: [PATCH] reem: script to split files based on a track/chapter list --- reem.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 reem.sh diff --git a/reem.sh b/reem.sh new file mode 100755 index 0000000..914d421 --- /dev/null +++ b/reem.sh @@ -0,0 +1,27 @@ +#!/bin/sh +lines=$(cat $1 | wc -l) +l=0 + +mkdir $1_out + +while [ $l -lt $lines ]; do + current=$(cat $1 | sed -n "$(($l+1))p") + next=$(cat $1 | sed -n "$(($l+2))p") + l=$(($l+1)) + current_ts=$(echo $current | awk '{print $1}') + if [ $(echo ${current_ts} | wc -c) -lt 6 ]; then + current_ts="00:${current_ts}" + fi + next_ts=$(echo $next | awk '{print $1}') + if [ ! -z "$next_ts" ] && [ $(echo ${next_ts} | wc -c) -lt 6 ]; then + next_ts="00:${next_ts}" + fi + track=$(echo $current |awk '{for (i=2; i