Merge branch 'master' of github.com:ksyasuda/aniwrapper

This commit is contained in:
ksyasuda 2021-11-18 15:55:41 -08:00
commit 7ee540601e
2 changed files with 329 additions and 327 deletions

14
ani-cli
View File

@ -278,8 +278,10 @@ get_search_query() {
-config "$CFG_DIR/${ROFI_CFG}")
# Strip the list entry number from string
query="$(awk '{print $NF}' <<<${query//[1-9]+\. /})"
# query="$(awk '{print $NF}' <<<${query//[1-9]+\. /})"
query="${query//[1-9]*\. /}"
log "Query: $query"
# [ "$VERBOSE" -eq 1 ] && printf "%s\n" "Query: $query"
else
query=$*
fi
@ -593,7 +595,7 @@ if [[ "$list_history" -eq 1 ]]; then
fi
case $scrape in
query)
query)
get_search_query "$*"
search_results=$(search_anime "$query")
@ -602,7 +604,7 @@ case $scrape in
[ $? -ne 0 ] && die "No anime selection found"
episode_selection
;;
history)
history)
stmt="SELECT DISTINCT anime_name FROM watch_history ORDER BY watch_date DESC"
search_results=$(printf "%s\n" "$stmt" | sqlite3 -noheader "$HISTORY_DB")
[ -z "$search_results" ] && die "History is empty"
@ -620,7 +622,7 @@ case $scrape in
# search_results=$(sed -n -E 's/\t[0-9]*//p' "$logfile")
# ep_choice_start=$(sed -n -E "s/${selection_id}\t//p" "$logfile")
;;
playlist)
playlist)
lines=$(cat "$playlist_file" | wc -l)
[ "$VERBOSE" -eq 1 ] && printf "%s%d\n" "Num lines in playlist: " "$lines"
if [[ "$lines" -eq 0 ]]; then
@ -646,7 +648,7 @@ case $scrape in
[ "$VERBOSE" -eq 1 ] && printf "Episodes: %s\n" "${episodes[@]}"
fi
;;
add)
add)
get_search_query "$*"
search_results=$(search_anime "$query")
[ -z "$search_results" ] && die "No search results found"
@ -654,7 +656,7 @@ case $scrape in
[ $? -ne 0 ] && die "No anime selection found"
episode_selection
;;
sync)
sync)
printf "%s" "Enter username for remote user: "
read -r username
printf "%s" "Enter host for remote user: "

View File

@ -2,7 +2,7 @@
[ -z "$XDG_CONFIG_HOME" ] && XDG_CONFIG_HOME="$HOME/.config"
CMD=/usr/local/bin/ani-cli
CMD=/usr/bin/ani-cli
DEFAULT_DOWNLOAD="$HOME/Videos/sauce"
CFG_DIR="$XDG_CONFIG_HOME/aniwrapper"
DEFAULT_PLAYLIST="$CFG_DIR/playlists/playlist.txt"
@ -61,14 +61,14 @@ log() {
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
case "$selection" in
1.)
1.)
# ---------------------------------------------------------------------------
# streaming
# ---------------------------------------------------------------------------
log "Streaming mode"
run
;;
2.)
2.)
# ---------------------------------------------------------------------------
# download
# ---------------------------------------------------------------------------
@ -79,7 +79,7 @@ case "$selection" in
[ "$dl_dir" == "" ] && dl_dir="$DEFAULT_DOWNLOAD"
run -d "$dl_dir"
;;
3.)
3.)
# ---------------------------------------------------------------------------
# continue
@ -87,7 +87,7 @@ case "$selection" in
log "Continue watching"
run -H
;;
4.)
4.)
# ---------------------------------------------------------------------------
# playlist mode
# ---------------------------------------------------------------------------
@ -202,7 +202,7 @@ case "$selection" in
fi
fi
;;
5.)
5.)
log "Sync history database"
# username=$(rofi -dmenu -config "$CFG_DIR/$CFG_FILE" \
# -l 1 -p "Enter the username of the remote user:")
@ -238,14 +238,14 @@ case "$selection" in
exit 0
fi
;;
6.)
6.)
# ---------------------------------------------------------------------------
# get out
# ---------------------------------------------------------------------------
printf "%s\n" "Quitting..."
exit 0
;;
*)
*)
log "Invalid choice..."
exit 1
;;