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)
|
-c Clears the cache (which can become quite large)
|
||||||
-d Download only; don't queue anything up
|
-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
|
-s Shuffle the playlist
|
||||||
|
|
||||||
-r <directory> Start up rofi, if installed, and present a listing of
|
-r <directory> Start up rofi, if installed, and present a listing of
|
||||||
@ -82,8 +84,8 @@ EOF
|
|||||||
}
|
}
|
||||||
rofimenu() {
|
rofimenu() {
|
||||||
validatedeps rofi || error "$_return is not currently installed" 1
|
validatedeps rofi || error "$_return is not currently installed" 1
|
||||||
[ -d "$_optrofidir" ] || error "Could not open directory \"$_optrofidir\"" 2
|
[ -d "$_optrofi" ] || error "Could not open directory \"$_optrofidir\"" 2
|
||||||
files=$(find "$_optrofidir" -type f -name \*.gdp)
|
files=$(find "$_optrofi" -type f -name \*.gdp)
|
||||||
if [ -n "$files" ]; then
|
if [ -n "$files" ]; then
|
||||||
# Strip file suffixes for a cleaner menu
|
# Strip file suffixes for a cleaner menu
|
||||||
playlists=""
|
playlists=""
|
||||||
@ -98,7 +100,7 @@ rofimenu() {
|
|||||||
fi
|
fi
|
||||||
choice="$(rofi -dmenu -p "$_name" <<< "$playlists")"
|
choice="$(rofi -dmenu -p "$_name" <<< "$playlists")"
|
||||||
[ -z "$choice" ] && error "User aborted at selection" 62
|
[ -z "$choice" ] && error "User aborted at selection" 62
|
||||||
playlist "$_optrofidir"/"$choice".gdp
|
playlist "$_optrofi"/"$choice".gdp
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
playlist() {
|
playlist() {
|
||||||
@ -165,8 +167,7 @@ main() {
|
|||||||
_optautoplay=1
|
_optautoplay=1
|
||||||
;;
|
;;
|
||||||
r)
|
r)
|
||||||
_optrofi=1
|
_optrofi="$OPTARG"
|
||||||
_optrofidir="$OPTARG"
|
|
||||||
;;
|
;;
|
||||||
s)
|
s)
|
||||||
_optshuffle=1
|
_optshuffle=1
|
||||||
@ -183,6 +184,7 @@ main() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
[ -n "$_optdownloadonly" ] && [ -n "$_optautoplay" ] && error "Flags -d and -p conflict" 2
|
||||||
if [ -n "$_optrofi" ]; then rofimenu; exit $?; fi
|
if [ -n "$_optrofi" ]; then rofimenu; exit $?; fi
|
||||||
if [ -n "$_optfile" ]; then playlist "$_optfile"; exit $?; fi
|
if [ -n "$_optfile" ]; then playlist "$_optfile"; exit $?; fi
|
||||||
error "Nothing to do" 0
|
error "Nothing to do" 0
|
||||||
|
Loading…
Reference in New Issue
Block a user