add basic playlist functionality for 'queuing'

This commit is contained in:
ksyasuda
2021-11-04 18:37:16 -07:00
parent 40202b7c65
commit a5033db481
3 changed files with 166 additions and 51 deletions

View File

@@ -4,6 +4,7 @@
CMD=/usr/local/bin/ani-cli
DEFAULT="$HOME/Videos/sauce/"
DEFAULT_PLAYLIST="$HOME/Videos/sauce/playlists/playlist.txt"
CFG_DIR="$XDG_CONFIG_HOME/ani-cli"
CFG_FILE="meh.rasi"
@@ -11,11 +12,11 @@ CFG_FILE="meh.rasi"
# not a wrapper around the ani-cli-rofi
options="1. Stream|2. Download|3. Continue|4. Quit"
options="1. Stream|2. Download|3. Continue|4. Queue|5. Quit"
choice=$(echo "${options[@]}" | rofi -dmenu -sep '|' -config "$CFG_DIR/$CFG_FILE" -l 4 -i -p "Enter choice:")
[ "$choice" == "4. Quit" ] && (
[ "$choice" == "5. Quit" ] && (
echo 'Quitting...'
exit 0
)
@@ -27,10 +28,25 @@ if [[ "$selection" == "1." ]]; then
$CMD
elif [[ "$selection" == "2." ]]; then
dl_dir=$(rofi -dmenu -config "$CFG_DIR/$CFG_FILE" \
-l 1 -p "Enter downlaod dir:")
-l 1 -p "Enter download dir:")
# if dl_dir is none set to current directory
[ "$dl_dir" == "" ] && dl_dir="$DEFAULT"
$CMD -d "$dl_dir"
elif [[ "$selection" == "3." ]]; then
$CMD -H
elif [[ "$selection" == "4." ]]; then
options="1. Play playlist|2. Add to playlist|3. Delete from playlist|4. Quit"
choice=$(echo "${options[@]}" | rofi -dmenu -sep '|' -config "$CFG_DIR/$CFG_FILE" -l 4 -i -p "Enter choice:")
[ "$choice" == "4. Quit" ] && (
echo 'Quitting...'
exit 0
)
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
if [[ "$selection" == "1." ]]; then
"$CMD" -p
elif [[ "$selection" == "2." ]]; then
"$CMD" -a
elif [[ "$selection" == "3." ]]; then
"$CMD" -r
fi
fi