diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/.config/mpv/mpv.conf | 2 | ||||
-rwxr-xr-x | misc/bin/mpvmix.sh | 22 |
2 files changed, 24 insertions, 0 deletions
diff --git a/misc/.config/mpv/mpv.conf b/misc/.config/mpv/mpv.conf index 3b49398..b6b1beb 100644 --- a/misc/.config/mpv/mpv.conf +++ b/misc/.config/mpv/mpv.conf @@ -7,6 +7,8 @@ script-opts=ytdl_hook-ytdl_path=/usr/bin/yt-dlp ytdl-format="bestvideo[height<=?720]+bestaudio/best" osc=no stop-screensaver = "yes" +# play audio with ui +# profile=pseudo-gui [emacsconf-talks] # Positioning 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 |