This commit is contained in:
Denis Lehmann 2021-06-11 09:31:42 +02:00
parent 7dc68bac5b
commit ce2dd9b8b3
2 changed files with 34 additions and 3 deletions

25
strm
View file

@ -12,9 +12,11 @@ function print_usage {
echo "OPTIONS" echo "OPTIONS"
echo " -h, --help Show this help message" echo " -h, --help Show this help message"
echo " -c, --config CONFIG_FILE Path to config file (default: ~/.config/strm/strm.config)" echo " -c, --config CONFIG_FILE Path to config file (default: ~/.config/strm/strm.config)"
echo " -d, --resume-directory DIRECTORY Resume files directory (default: ~/.cache/strm)"
echo " -f, --fullscreen Play video files in fullscreen" echo " -f, --fullscreen Play video files in fullscreen"
echo " -l, --list List files instead of playing" echo " -l, --list List files instead of playing"
echo " -m, --media-directories MEDIA_DIRECTORIES Use given media directories, config is ignored" echo " -m, --media-directories MEDIA_DIRECTORIES Use given media directories, config is ignored"
echo " -n, --neat Don't resume playback"
echo " -o, --or Use a logical OR for queries (default: AND)" echo " -o, --or Use a logical OR for queries (default: AND)"
echo " -r, --remote SSH_CONNECTION_STRING Execute strm with other given arguments on remote machine (-f is set by default)" echo " -r, --remote SSH_CONNECTION_STRING Execute strm with other given arguments on remote machine (-f is set by default)"
echo " -s, --shuffle Play files in random order" echo " -s, --shuffle Play files in random order"
@ -45,10 +47,12 @@ fullscreen=false
is_remote_call=false is_remote_call=false
list=false list=false
media_directories="" media_directories=""
neat=false
or=false or=false
queries=() queries=()
remote="" remote=""
remote_arguments=() remote_arguments=()
resume_directory=""
shuffle=false shuffle=false
# Parse arguments # Parse arguments
@ -63,6 +67,15 @@ while (( "$#" )); do
error "Argument for '$1' is missing" error "Argument for '$1' is missing"
fi fi
;; ;;
-d|--resume-directory)
if [ -n "$2" ] && [ "${2:0:1}" != "-" ]; then
resume_directory=="$2"
remote_arguments+=("$1" "$2")
shift 2
else
error "Argument for '$1' is missing"
fi
;;
-f|--fullscreen) -f|--fullscreen)
fullscreen=true fullscreen=true
shift shift
@ -88,6 +101,11 @@ while (( "$#" )); do
error "Argument for '$1' is missing" error "Argument for '$1' is missing"
fi fi
;; ;;
-n|--neat)
neat=true
remote_arguments+=("$1")
shift
;;
-o|--or) -o|--or)
or=true or=true
remote_arguments+=("$1") remote_arguments+=("$1")
@ -275,11 +293,14 @@ if [ "$list" == false ]; then
# Construct addtitional mpv arguments # Construct addtitional mpv arguments
mpv_arguments=() mpv_arguments=()
if [ "$fullscreen" == true ]; then
mpv_arguments+=("--fullscreen")
fi
if [ "$shuffle" == true ]; then if [ "$shuffle" == true ]; then
mpv_arguments+=("--shuffle") mpv_arguments+=("--shuffle")
fi fi
if [ "$fullscreen" == true ]; then if [ "$neat" == true ]; then
mpv_arguments+=("--fullscreen") mpv_arguments+=("--no-resume-playback")
fi fi
# Play all remote files # Play all remote files

View file

@ -11,3 +11,13 @@
# remote-machine/home/bob/music # remote-machine/home/bob/music
# bob@another-machine/media/movies,bob@10.0.0.1/home/bob/series # bob@another-machine/media/movies,bob@10.0.0.1/home/bob/series
media_directories="" media_directories=""
# Resume directory in which playback positions are stored on exit.
# Can also be located on a remote machine which is accessible via SSH.
#
# Default: ~/.cache/strm
#
# Examples:
# ~/.strm
# remote-machine:/path/on/remote
resume_directory=""