blob: 8bc0ac844146a076d44aa38345714e19ec0ba9d5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
|