From 0da3eb92b72d272c58abd6205dae69dc62301299 Mon Sep 17 00:00:00 2001 From: Salt Date: Fri, 14 Jun 2019 06:16:43 -0500 Subject: [PATCH] jptgdp: Set up option conflicts, simplify rofi options --- jptgdp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/jptgdp b/jptgdp index 067f643..268298f 100755 --- a/jptgdp +++ b/jptgdp @@ -68,7 +68,9 @@ files are cached in your Music folder under "JPTGDP Songs" for offline use. -c Clears the cache (which can become quite large) -d Download only; don't queue anything up - -p Play the playlist after it is enqueued + Conflicts with -p + -p Play the playlist after it is enqueued. + Conflicts with -d -s Shuffle the playlist -r Start up rofi, if installed, and present a listing of @@ -82,8 +84,8 @@ EOF } rofimenu() { validatedeps rofi || error "$_return is not currently installed" 1 - [ -d "$_optrofidir" ] || error "Could not open directory \"$_optrofidir\"" 2 - files=$(find "$_optrofidir" -type f -name \*.gdp) + [ -d "$_optrofi" ] || error "Could not open directory \"$_optrofidir\"" 2 + files=$(find "$_optrofi" -type f -name \*.gdp) if [ -n "$files" ]; then # Strip file suffixes for a cleaner menu playlists="" @@ -98,7 +100,7 @@ rofimenu() { fi choice="$(rofi -dmenu -p "$_name" <<< "$playlists")" [ -z "$choice" ] && error "User aborted at selection" 62 - playlist "$_optrofidir"/"$choice".gdp + playlist "$_optrofi"/"$choice".gdp return 0 } playlist() { @@ -165,8 +167,7 @@ main() { _optautoplay=1 ;; r) - _optrofi=1 - _optrofidir="$OPTARG" + _optrofi="$OPTARG" ;; s) _optshuffle=1 @@ -183,6 +184,7 @@ main() { ;; esac done + [ -n "$_optdownloadonly" ] && [ -n "$_optautoplay" ] && error "Flags -d and -p conflict" 2 if [ -n "$_optrofi" ]; then rofimenu; exit $?; fi if [ -n "$_optfile" ]; then playlist "$_optfile"; exit $?; fi error "Nothing to do" 0