Add mkplaylist
This commit is contained in:
parent
6484bc21e8
commit
ae15f1effc
7
.config/zsh/completions/_mkplaylist
Normal file
7
.config/zsh/completions/_mkplaylist
Normal file
@ -0,0 +1,7 @@
|
||||
#compdef mkplaylist
|
||||
|
||||
_arguments '-h[short help text]' '1:playlist name (without extension):'
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# End:
|
24
.config/zsh/functions/mkplaylist
Executable file
24
.config/zsh/functions/mkplaylist
Executable file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env zsh
|
||||
# Create a playlist in the current folder, of the media files in the folder and
|
||||
# all subfolfers.
|
||||
|
||||
setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL
|
||||
|
||||
zmodload zsh/zutil
|
||||
local -a o_help=()
|
||||
zparseopts -D -K -- h=o_help
|
||||
if [[ ${#o_help} -ne 0 ]]; then
|
||||
print -l "usage: ${0} [-h] [NAME]" \
|
||||
"Without NAME, the current directory is used."
|
||||
return 0
|
||||
fi
|
||||
if [[ -v 1 ]]; then
|
||||
local name=${1}
|
||||
else
|
||||
local name=${PWD##*/}
|
||||
fi
|
||||
|
||||
find . -type f -name '*.mkv' -or -name '*.mp4' -or -name '*.avi' \
|
||||
-or -name '*.flac' -or -name '*.ogg' -or -name '*.opus' -or -name '*.mp3' \
|
||||
-or -name '*.m4a' -or -name '*.wma' -or -name '*.aac' \
|
||||
| grep -Pv '(ED|OP|PV) ?\d' | sort > ${name}.m3u8
|
Loading…
x
Reference in New Issue
Block a user