X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/blobdiff_plain/232791f70bcecbe0f55634fe44dbf9980004a6c5..15af0db8848eaa129fba08d3a37326d37b4de5c3:/user/bkmpv2 diff --git a/user/bkmpv2 b/user/bkmpv2 index 36453db..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.1 +# 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 ]] && \