From fcc666fbfd80f84407a123343fc66a3516a6124c Mon Sep 17 00:00:00 2001 From: shockrah Date: Mon, 5 Oct 2020 13:19:14 -0700 Subject: [PATCH] getopts for more control like volume pausing and playing --- music | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/music b/music index f0b4670..f3391ce 100755 --- a/music +++ b/music @@ -1,10 +1,31 @@ #!/bin/sh -choice=`find "$HOME"/Music/ -maxdepth 1 -type d | dmenu -i -l 25 -p "Pick an Album"` +# TODO: what +if [ ! $1 = "" ]; then + echo Args: $@ + # start X pause volume_set + while getopts ":s:pv:" options; do + case $options in + # start directory playlist + s) + if [ $2 = "" ];then + echo Usage: music -s "Some Directory - Album" > /dev/stderr + else + ls -1 "$2"/*.mp3 | xargs --delimiter='\n' mocp --playit + fi + ;; + p) mocp --pause;; + v) mocp --volume "$2";; + esac + done -echo Playing: $choice - -if [ ! -z "$choice" ];then - ls -1 "$choice"/*.mp3 | xargs --delimiter='\n' mocp --playit +else + choice=`find "$HOME"/Music/ -maxdepth 1 -type d | dmenu -i -l 25 -p "Pick an Album"` + if [ ! -z "$choice" ];then + echo Playing: $choice + ls -1 "$choice"/*.mp3 | xargs --delimiter='\n' mocp --playit + fi fi + +