Last active
October 13, 2021 01:06
-
-
Save sutnistj/29449bf6d1aa8db567ab5902796139f6 to your computer and use it in GitHub Desktop.
A script allows easy using multivideos and -subs at once (can be updated)
This file contains 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 | |
# Variables | |
path='' # general path aka gp | |
videos='' # gp + folder for videos | |
subs='' # gp + folder for subs | |
# Regexs | |
## here for anime monster | |
video='Monster - Chapter.*\.mkv$' | |
sub='monster_' | |
num=' [0-9]{2} ' | |
escape='s/\([[()\] -]\)/\\&/g' | |
p=$(echo $path | sed "$escape") | |
# Command | |
while read line; do | |
ep=$(echo "$line" | grep -Po "$num" | tr -d " ") | |
if [[ $ep -ge "$1" ]]; then | |
v=$(echo "$videos$line" | sed "$escape") | |
s=$(echo "$subs$sub$ep.srt" | sed "$escape") | |
script+=("--{" "$p$v" "--sub-file=$p$s" "--}") | |
fi | |
done < <(ls "$videos" | grep -P "$video") | |
## fullscreen and audio in jp | |
mpv --alang=jpn --fs "${script[@]}" |
This file contains 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 | |
# my-mpv | |
# A script allows easy using multivideos and -subs at once | |
##### Default varitions | |
script= | |
videos= | |
subs= | |
##### Functions | |
help() | |
{ | |
echo "--videos [-vs] \"path-to-files\"" | |
echo "--subs [-ss] \"path-to-files\"" | |
echo "--help" | |
echo | |
echo "Example: -vs \"*.mp4\" -ss \"./Subs/*.srt\"" | |
} | |
##### Main | |
# Vidsutnistj arqumentiv | |
if [[ $# -eq 0 ]] ; then | |
help | |
exit | |
fi | |
# Ohljad parametriv | |
while [ "$1" != "" ]; do | |
case $1 in | |
-vs | --videos ) | |
videos=$2 | |
shift | |
;; | |
-ss | --subs ) | |
subs=$2 | |
shift | |
;; | |
--help ) | |
help | |
exit | |
;; | |
* ) | |
script="${script} $1" | |
;; | |
esac | |
shift | |
done | |
# Sklej | |
for i in $(eval echo ${videos}); do | |
script="${script} --{ $i --sub-file=${subs/\*/${i%.*}} --}" | |
done | |
# Zapusk | |
mpv ${script} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment