mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-11-22 03:19:53 -08:00
update name of repo and config dir to aniwrapper
This commit is contained in:
parent
bb4de525d4
commit
47df581ba6
96
aniwrapper
96
aniwrapper
@ -3,67 +3,101 @@
|
||||
[ -z "$XDG_CONFIG_HOME" ] && XDG_CONFIG_HOME="$HOME/.config"
|
||||
|
||||
CMD=/usr/local/bin/ani-cli
|
||||
DEFAULT="$HOME/Videos/sauce/"
|
||||
DEFAULT_DOWNLOAD="$HOME/Videos/sauce"
|
||||
DEFAULT_PLAYLIST="$HOME/Videos/sauce/playlists/playlist.txt"
|
||||
CFG_DIR="$XDG_CONFIG_HOME/ani-cli"
|
||||
CFG_DIR="$XDG_CONFIG_HOME/aniwrapper"
|
||||
CFG_FILE="meh.rasi"
|
||||
|
||||
# echo "CONFIG DIR: $CFG_DIR"
|
||||
|
||||
# not a wrapper around the ani-cli-rofi
|
||||
# printf "%s\n" "CONFIG DIR: $CFG_DIR"
|
||||
|
||||
options="1. Stream|2. Download|3. Continue|4. Playlist|5. Quit"
|
||||
|
||||
choice=$(echo "${options[@]}" | rofi -dmenu -sep '|' -config "$CFG_DIR/$CFG_FILE" -l 5 -i -p "Aniwrapper")
|
||||
|
||||
[ "$choice" == "5. Quit" ] && (
|
||||
echo 'Quitting...'
|
||||
seppuku() {
|
||||
printf "%s\n" "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
quit() {
|
||||
printf "%s\n" 'Quitting...'
|
||||
exit 0
|
||||
)
|
||||
}
|
||||
|
||||
run() {
|
||||
"$CMD" "$*"
|
||||
}
|
||||
|
||||
[ "$choice" == "5. Quit" ] && quit
|
||||
|
||||
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
|
||||
|
||||
if [[ "$selection" == "1." ]]; then
|
||||
echo "STREAMING..."
|
||||
$CMD
|
||||
# ---------------------------------------------------------------------------
|
||||
# streaming
|
||||
# ---------------------------------------------------------------------------
|
||||
printf "%s\n" "STREAMING..."
|
||||
run
|
||||
elif [[ "$selection" == "2." ]]; then
|
||||
# ---------------------------------------------------------------------------
|
||||
# download
|
||||
# ---------------------------------------------------------------------------
|
||||
dl_dir=$(rofi -dmenu -config "$CFG_DIR/$CFG_FILE" \
|
||||
-l 1 -p "Enter download dir:")
|
||||
# if dl_dir is none set to current directory
|
||||
[ "$dl_dir" == "" ] && dl_dir="$DEFAULT"
|
||||
$CMD -d "$dl_dir"
|
||||
[ "$dl_dir" == "" ] && dl_dir="$DEFAULT_DOWNLOAD"
|
||||
run -d "$dl_dir"
|
||||
elif [[ "$selection" == "3." ]]; then
|
||||
$CMD -H
|
||||
# ---------------------------------------------------------------------------
|
||||
# continue
|
||||
# ---------------------------------------------------------------------------
|
||||
run -H
|
||||
elif [[ "$selection" == "4." ]]; then
|
||||
# ---------------------------------------------------------------------------
|
||||
# playlist mode
|
||||
# ---------------------------------------------------------------------------
|
||||
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
|
||||
)
|
||||
choice=$(printf "%s\n" "${options[@]}" |
|
||||
rofi -dmenu -sep '|' \
|
||||
-config "$CFG_DIR/$CFG_FILE" -l 4 -i -p "Enter choice:")
|
||||
[ "$choice" == "5. Quit" ] && quit
|
||||
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
|
||||
if [[ "$selection" == "1." ]]; then
|
||||
# -----------------------------------------------------------------------
|
||||
# watch playlist
|
||||
# -----------------------------------------------------------------------
|
||||
options="1. From file|2. Streaming|3. 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
|
||||
)
|
||||
choice=$(printf "%s\n" "${options[@]}" |
|
||||
rofi -dmenu -sep '|' \
|
||||
-config "$CFG_DIR/$CFG_FILE" -l 4 -i -p "Enter choice:")
|
||||
[ "$choice" == "5. Quit" ] && quit
|
||||
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
|
||||
if [[ "$selection" == "1." ]]; then
|
||||
# -------------------------------------------------------------------
|
||||
# watch playlist from file (downloaded videos)
|
||||
# -------------------------------------------------------------------
|
||||
# TODO: Change directory to variable set at install
|
||||
PLAYLIST_DIR="$HOME/Videos/sauce"
|
||||
choice=$(ls "$PLAYLIST_DIR" | rofi -dmenu -config "$CFG_DIR/$CFG_FILE" -l 5 -i -p "Choose playlist:")
|
||||
# choice=$(rofi -dmenu -config "$CFG_DIR/$CFG_FILE" -l 1 -i -p "Enter path to playlist")
|
||||
# [ -z "$choice" ] && choice="$HOME/Videos/sauce/"
|
||||
"$CMD" -P "$PLAYLIST_DIR/$choice"
|
||||
choice=$(find "$PLAYLIST_DIR" -type d |
|
||||
rofi -dmenu \
|
||||
-config "$CFG_DIR/$CFG_FILE" -l 5 -i -p "Choose playlist:")
|
||||
[ -z "$choice" ] &&
|
||||
run -P "$PLAYLIST_DIR/$choice"
|
||||
elif [[ "$selection" == "2." ]]; then
|
||||
"$CMD" -p
|
||||
# -------------------------------------------------------------------
|
||||
# watch playlist of 'queued' videos to stream
|
||||
# -------------------------------------------------------------------
|
||||
run -p
|
||||
fi
|
||||
# selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
|
||||
elif [[ "$selection" == "2." ]]; then
|
||||
"$CMD" -a
|
||||
# -----------------------------------------------------------------------
|
||||
# add to playlist
|
||||
# -----------------------------------------------------------------------
|
||||
run -a
|
||||
elif [[ "$selection" == "3." ]]; then
|
||||
"$CMD" -r
|
||||
# -----------------------------------------------------------------------
|
||||
# delete from playlist
|
||||
# -----------------------------------------------------------------------
|
||||
run -r
|
||||
fi
|
||||
fi
|
||||
|
2
db.sh
2
db.sh
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DIR="$XDG_CONFIG_HOME/ani-cli"
|
||||
DIR="$XDG_CONFIG_HOME/aniwrapper"
|
||||
DB='history.sqlite3'
|
||||
|
||||
log() {
|
||||
|
Loading…
Reference in New Issue
Block a user