diff --git a/strm b/strm index d1ed527..e758a1c 100755 --- a/strm +++ b/strm @@ -12,9 +12,11 @@ function print_usage { echo "OPTIONS" echo " -h, --help Show this help message" 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 " -l, --list List files instead of playing" 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 " -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" @@ -45,10 +47,12 @@ fullscreen=false is_remote_call=false list=false media_directories="" +neat=false or=false queries=() remote="" remote_arguments=() +resume_directory="" shuffle=false # Parse arguments @@ -63,6 +67,15 @@ while (( "$#" )); do error "Argument for '$1' is missing" 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) fullscreen=true shift @@ -88,6 +101,11 @@ while (( "$#" )); do error "Argument for '$1' is missing" fi ;; + -n|--neat) + neat=true + remote_arguments+=("$1") + shift + ;; -o|--or) or=true remote_arguments+=("$1") @@ -275,11 +293,14 @@ if [ "$list" == false ]; then # Construct addtitional mpv arguments mpv_arguments=() + if [ "$fullscreen" == true ]; then + mpv_arguments+=("--fullscreen") + fi if [ "$shuffle" == true ]; then mpv_arguments+=("--shuffle") fi - if [ "$fullscreen" == true ]; then - mpv_arguments+=("--fullscreen") + if [ "$neat" == true ]; then + mpv_arguments+=("--no-resume-playback") fi # Play all remote files diff --git a/strm.config b/strm.config index 6a40172..f4ee761 100644 --- a/strm.config +++ b/strm.config @@ -10,4 +10,14 @@ # localhost/home/bob/videos # remote-machine/home/bob/music # bob@another-machine/media/movies,bob@10.0.0.1/home/bob/series -media_directories="" \ No newline at end of file +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="" \ No newline at end of file