X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/blobdiff_plain/e41f7d0594245a0c00cb82f44cee251e11300314..51f3f8450b12a1f628a8c957ac30934540c5c826:/user/bkmpv2 diff --git a/user/bkmpv2 b/user/bkmpv2 index e4128f0..7e51cc1 100755 --- a/user/bkmpv2 +++ b/user/bkmpv2 @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Desc: Wrapper for mpv that accepts directory or file paths via posargs or stdin lines # Usage: bkmpv2 [DIR] -# Version: 0.2.0 +# Version: 0.2.2 # Depends: GNU Parallel, GNU Bash v5.1.16, mpv v0.34.1, bc v1.07.1 # Ref/Attrib: [1] Tange, Ole. GNU Parallel with Bash Array. 2019-03-24. https://unix.stackexchange.com/a/508365/411854 # Example: find $HOME/Music -type d | bkmpv2 @@ -10,8 +10,8 @@ # Note: Does not follow symlinks # Find settings -firegex=".+\(aac\|aif\|aiff\|flac\|m4a\|mp3\|mp4\|ogg\|opus\|wav\)$"; # POSIX regex for find. Update according to `find . -type f | grep -Eo "\.([[:alnum:]])+$" | sort -u` -file_regex=".+(aac|aif|aiff|flac|m4a|mp3|mp4|ogg|opus|wav)$"; # extended regex for Bash. +firegex=".+\(aac\|aif\|aiff\|flac\|m4a\|mp3\|mp4\|ogg\|opus\|wav\|webm\)$"; # POSIX regex for find. Update according to `find . -type f | grep -Eo "\.([[:alnum:]])+$" | sort -u` +file_regex=".+(aac|aif|aiff|flac|m4a|mp3|mp4|ogg|opus|wav|webm)$"; # extended regex for Bash. fsize="10k"; # default: minimum "10k" fdepth_posarg="10"; # find depth for positional arguments fdepth_stdin="1"; # find depth for stdin @@ -301,12 +301,14 @@ main() { # Check if dir and not dotfile if [[ -d "$line" ]] && [[ ! "$line_bn" =~ $re_dotfile ]]; then dirs_stdin+=("$line"); + yell "DEBUG:Is a dir:${line}"; # debug continue; fi; # Check if file if [[ -f "$line" ]]; then files_stdin+=("$line"); + yell "DEBUG:Is a file:${line}"; # debug continue; fi; @@ -316,7 +318,9 @@ main() { yell "STATUS:$SECONDS:Read stdin and psargs."; # Apply the $file_regex to $files_stdin array + declare -p files_stdin; check_files; + declare -p files_stdin; # Catch all arrays empty if [[ "${#dirs_stdin[@]}" -le 0 ]] && \ @@ -392,7 +396,6 @@ main() { cmd_args+=("--audio-display=no"); # disable video for audio files cmd_args+=("--vid=no"); # donʼt show video track cmd_args+=("--image-display-duration=0"); # don't show album art - cmd_args+=("--af=scaletempo=stride=15:overlap=1:search=15"); # improve scrubbing cmd_args+=("--playlist=$list_paths_files_tmp"); # read playlist declare -p cmd_args; # debug ## Execute command