diff options
Diffstat (limited to 'misc/bin')
-rwxr-xr-x | misc/bin/mpvmix.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/misc/bin/mpvmix.sh b/misc/bin/mpvmix.sh new file mode 100755 index 0000000..8bc0ac8 --- /dev/null +++ b/misc/bin/mpvmix.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Randomly play media segments from a list of files with start and end +# time line format: +# 1:00//1:05//~/file.mp4 + +f="$1" +n=$(cat "$f" | wc -l) +while true; do + while read -r line; do + echo "$line" + regex='([0-9:]+)//([0-9:]+)//(.+)' + [[ "$line" =~ $regex ]] || continue + start=${BASH_REMATCH[1]} + end=${BASH_REMATCH[2]} + media=${BASH_REMATCH[3]} + media="${media/#~/${HOME}}" + # echo "start: $start; end: $end; file: $media" + mpv --start=$start --end=$end "$media" + done <<<$(shuf -n $n "$f") + sleep 1 +done |