update name of repo and config dir to aniwrapper

This commit is contained in:
ksyasuda 2021-11-08 00:37:24 -08:00
parent bb4de525d4
commit 47df581ba6
3 changed files with 67 additions and 33 deletions

View File

@ -3,67 +3,101 @@
[ -z "$XDG_CONFIG_HOME" ] && XDG_CONFIG_HOME="$HOME/.config" [ -z "$XDG_CONFIG_HOME" ] && XDG_CONFIG_HOME="$HOME/.config"
CMD=/usr/local/bin/ani-cli CMD=/usr/local/bin/ani-cli
DEFAULT="$HOME/Videos/sauce/" DEFAULT_DOWNLOAD="$HOME/Videos/sauce"
DEFAULT_PLAYLIST="$HOME/Videos/sauce/playlists/playlist.txt" 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" CFG_FILE="meh.rasi"
# echo "CONFIG DIR: $CFG_DIR" # printf "%s\n" "CONFIG DIR: $CFG_DIR"
# not a wrapper around the ani-cli-rofi
options="1. Stream|2. Download|3. Continue|4. Playlist|5. Quit" 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=$(echo "${options[@]}" | rofi -dmenu -sep '|' -config "$CFG_DIR/$CFG_FILE" -l 5 -i -p "Aniwrapper")
[ "$choice" == "5. Quit" ] && ( seppuku() {
echo 'Quitting...' printf "%s\n" "$*"
exit 1
}
quit() {
printf "%s\n" 'Quitting...'
exit 0 exit 0
) }
run() {
"$CMD" "$*"
}
[ "$choice" == "5. Quit" ] && quit
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }') selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
if [[ "$selection" == "1." ]]; then if [[ "$selection" == "1." ]]; then
echo "STREAMING..." # ---------------------------------------------------------------------------
$CMD # streaming
# ---------------------------------------------------------------------------
printf "%s\n" "STREAMING..."
run
elif [[ "$selection" == "2." ]]; then elif [[ "$selection" == "2." ]]; then
# ---------------------------------------------------------------------------
# download
# ---------------------------------------------------------------------------
dl_dir=$(rofi -dmenu -config "$CFG_DIR/$CFG_FILE" \ dl_dir=$(rofi -dmenu -config "$CFG_DIR/$CFG_FILE" \
-l 1 -p "Enter download dir:") -l 1 -p "Enter download dir:")
# if dl_dir is none set to current directory # if dl_dir is none set to current directory
[ "$dl_dir" == "" ] && dl_dir="$DEFAULT" [ "$dl_dir" == "" ] && dl_dir="$DEFAULT_DOWNLOAD"
$CMD -d "$dl_dir" run -d "$dl_dir"
elif [[ "$selection" == "3." ]]; then elif [[ "$selection" == "3." ]]; then
$CMD -H # ---------------------------------------------------------------------------
# continue
# ---------------------------------------------------------------------------
run -H
elif [[ "$selection" == "4." ]]; then elif [[ "$selection" == "4." ]]; then
# ---------------------------------------------------------------------------
# playlist mode
# ---------------------------------------------------------------------------
options="1. Play playlist|2. Add to playlist|3. Delete from playlist|4. Quit" 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=$(printf "%s\n" "${options[@]}" |
[ "$choice" == "4. Quit" ] && ( rofi -dmenu -sep '|' \
echo 'Quitting...' -config "$CFG_DIR/$CFG_FILE" -l 4 -i -p "Enter choice:")
exit 0 [ "$choice" == "5. Quit" ] && quit
)
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }') selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
if [[ "$selection" == "1." ]]; then if [[ "$selection" == "1." ]]; then
# -----------------------------------------------------------------------
# watch playlist
# -----------------------------------------------------------------------
options="1. From file|2. Streaming|3. Quit" 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=$(printf "%s\n" "${options[@]}" |
[ "$choice" == "4. Quit" ] && ( rofi -dmenu -sep '|' \
echo 'Quitting...' -config "$CFG_DIR/$CFG_FILE" -l 4 -i -p "Enter choice:")
exit 0 [ "$choice" == "5. Quit" ] && quit
)
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }') selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
if [[ "$selection" == "1." ]]; then if [[ "$selection" == "1." ]]; then
# -------------------------------------------------------------------
# watch playlist from file (downloaded videos)
# -------------------------------------------------------------------
# TODO: Change directory to variable set at install # TODO: Change directory to variable set at install
PLAYLIST_DIR="$HOME/Videos/sauce" PLAYLIST_DIR="$HOME/Videos/sauce"
choice=$(ls "$PLAYLIST_DIR" | rofi -dmenu -config "$CFG_DIR/$CFG_FILE" -l 5 -i -p "Choose playlist:") choice=$(find "$PLAYLIST_DIR" -type d |
# choice=$(rofi -dmenu -config "$CFG_DIR/$CFG_FILE" -l 1 -i -p "Enter path to playlist") rofi -dmenu \
# [ -z "$choice" ] && choice="$HOME/Videos/sauce/" -config "$CFG_DIR/$CFG_FILE" -l 5 -i -p "Choose playlist:")
"$CMD" -P "$PLAYLIST_DIR/$choice" [ -z "$choice" ] &&
run -P "$PLAYLIST_DIR/$choice"
elif [[ "$selection" == "2." ]]; then elif [[ "$selection" == "2." ]]; then
"$CMD" -p # -------------------------------------------------------------------
# watch playlist of 'queued' videos to stream
# -------------------------------------------------------------------
run -p
fi fi
# selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
elif [[ "$selection" == "2." ]]; then elif [[ "$selection" == "2." ]]; then
"$CMD" -a # -----------------------------------------------------------------------
# add to playlist
# -----------------------------------------------------------------------
run -a
elif [[ "$selection" == "3." ]]; then elif [[ "$selection" == "3." ]]; then
"$CMD" -r # -----------------------------------------------------------------------
# delete from playlist
# -----------------------------------------------------------------------
run -r
fi fi
fi fi

2
db.sh
View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
DIR="$XDG_CONFIG_HOME/ani-cli" DIR="$XDG_CONFIG_HOME/aniwrapper"
DB='history.sqlite3' DB='history.sqlite3'
log() { log() {

View File

@ -15,7 +15,7 @@ if [[ -z "$XDG_CONFIG_HOME" ]]; then
XDG_CONFIG_HOME="$HOME/.config" XDG_CONFIG_HOME="$HOME/.config"
fi fi
DIR="$XDG_CONFIG_HOME/ani-cli" DIR="$XDG_CONFIG_HOME/aniwrapper"
MPV_DIR="$XDG_CONFIG_HOME/mpv" MPV_DIR="$XDG_CONFIG_HOME/mpv"
printf "%s\n" "INSTALL DIR: $DIR" printf "%s\n" "INSTALL DIR: $DIR"