jptgdp: Set up option conflicts, simplify rofi options
This commit is contained in:
parent
83058754bb
commit
0da3eb92b7
14
jptgdp
14
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 <directory> 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
|
||||
|
Loading…
Reference in New Issue
Block a user