#!/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
# 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
# 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;
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 ]] && \