Last active
March 22, 2019 19:48
-
-
Save Ruin0x11/c14392936bf91820fe0b to your computer and use it in GitHub Desktop.
play videos/episodes in sequential order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# mpv-seq - Play files in a directory in order, starting from given file | |
# caveat: needs the filename as first argument, then arguments to pass to mpv | |
playlist=/var/tmp/.playlist | |
thisfile="$0" | |
qa="$1" | |
q=$(printf '%s\n' "$qa" | sed 's/[[\.*^$/]/\\&/g') | |
ext="${q##*.}" | |
dir=`pwd` | |
pl=`find "$dir" -iname "*.$ext" \ | |
| sort \ | |
| sed -n "/${q}/,\$ p" \ | |
| tee $playlist` | |
shift | |
mpv "$@" -playlist "$playlist" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment