mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-10-28 04:44:11 -07:00
Merge branch 'master' of github.com:ksyasuda/aniwrapper
This commit is contained in:
commit
7ee540601e
14
ani-cli
14
ani-cli
@ -278,8 +278,10 @@ get_search_query() {
|
|||||||
-config "$CFG_DIR/${ROFI_CFG}")
|
-config "$CFG_DIR/${ROFI_CFG}")
|
||||||
|
|
||||||
# Strip the list entry number from string
|
# 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"
|
log "Query: $query"
|
||||||
|
# [ "$VERBOSE" -eq 1 ] && printf "%s\n" "Query: $query"
|
||||||
else
|
else
|
||||||
query=$*
|
query=$*
|
||||||
fi
|
fi
|
||||||
@ -593,7 +595,7 @@ if [[ "$list_history" -eq 1 ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
case $scrape in
|
case $scrape in
|
||||||
query)
|
query)
|
||||||
|
|
||||||
get_search_query "$*"
|
get_search_query "$*"
|
||||||
search_results=$(search_anime "$query")
|
search_results=$(search_anime "$query")
|
||||||
@ -602,7 +604,7 @@ case $scrape in
|
|||||||
[ $? -ne 0 ] && die "No anime selection found"
|
[ $? -ne 0 ] && die "No anime selection found"
|
||||||
episode_selection
|
episode_selection
|
||||||
;;
|
;;
|
||||||
history)
|
history)
|
||||||
stmt="SELECT DISTINCT anime_name FROM watch_history ORDER BY watch_date DESC"
|
stmt="SELECT DISTINCT anime_name FROM watch_history ORDER BY watch_date DESC"
|
||||||
search_results=$(printf "%s\n" "$stmt" | sqlite3 -noheader "$HISTORY_DB")
|
search_results=$(printf "%s\n" "$stmt" | sqlite3 -noheader "$HISTORY_DB")
|
||||||
[ -z "$search_results" ] && die "History is empty"
|
[ -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")
|
# search_results=$(sed -n -E 's/\t[0-9]*//p' "$logfile")
|
||||||
# ep_choice_start=$(sed -n -E "s/${selection_id}\t//p" "$logfile")
|
# ep_choice_start=$(sed -n -E "s/${selection_id}\t//p" "$logfile")
|
||||||
;;
|
;;
|
||||||
playlist)
|
playlist)
|
||||||
lines=$(cat "$playlist_file" | wc -l)
|
lines=$(cat "$playlist_file" | wc -l)
|
||||||
[ "$VERBOSE" -eq 1 ] && printf "%s%d\n" "Num lines in playlist: " "$lines"
|
[ "$VERBOSE" -eq 1 ] && printf "%s%d\n" "Num lines in playlist: " "$lines"
|
||||||
if [[ "$lines" -eq 0 ]]; then
|
if [[ "$lines" -eq 0 ]]; then
|
||||||
@ -646,7 +648,7 @@ case $scrape in
|
|||||||
[ "$VERBOSE" -eq 1 ] && printf "Episodes: %s\n" "${episodes[@]}"
|
[ "$VERBOSE" -eq 1 ] && printf "Episodes: %s\n" "${episodes[@]}"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
add)
|
add)
|
||||||
get_search_query "$*"
|
get_search_query "$*"
|
||||||
search_results=$(search_anime "$query")
|
search_results=$(search_anime "$query")
|
||||||
[ -z "$search_results" ] && die "No search results found"
|
[ -z "$search_results" ] && die "No search results found"
|
||||||
@ -654,7 +656,7 @@ case $scrape in
|
|||||||
[ $? -ne 0 ] && die "No anime selection found"
|
[ $? -ne 0 ] && die "No anime selection found"
|
||||||
episode_selection
|
episode_selection
|
||||||
;;
|
;;
|
||||||
sync)
|
sync)
|
||||||
printf "%s" "Enter username for remote user: "
|
printf "%s" "Enter username for remote user: "
|
||||||
read -r username
|
read -r username
|
||||||
printf "%s" "Enter host for remote user: "
|
printf "%s" "Enter host for remote user: "
|
||||||
|
16
aniwrapper
16
aniwrapper
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[ -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/bin/ani-cli
|
||||||
DEFAULT_DOWNLOAD="$HOME/Videos/sauce"
|
DEFAULT_DOWNLOAD="$HOME/Videos/sauce"
|
||||||
CFG_DIR="$XDG_CONFIG_HOME/aniwrapper"
|
CFG_DIR="$XDG_CONFIG_HOME/aniwrapper"
|
||||||
DEFAULT_PLAYLIST="$CFG_DIR/playlists/playlist.txt"
|
DEFAULT_PLAYLIST="$CFG_DIR/playlists/playlist.txt"
|
||||||
@ -61,14 +61,14 @@ log() {
|
|||||||
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
|
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
|
||||||
|
|
||||||
case "$selection" in
|
case "$selection" in
|
||||||
1.)
|
1.)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# streaming
|
# streaming
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
log "Streaming mode"
|
log "Streaming mode"
|
||||||
run
|
run
|
||||||
;;
|
;;
|
||||||
2.)
|
2.)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# download
|
# download
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@ -79,7 +79,7 @@ case "$selection" in
|
|||||||
[ "$dl_dir" == "" ] && dl_dir="$DEFAULT_DOWNLOAD"
|
[ "$dl_dir" == "" ] && dl_dir="$DEFAULT_DOWNLOAD"
|
||||||
run -d "$dl_dir"
|
run -d "$dl_dir"
|
||||||
;;
|
;;
|
||||||
3.)
|
3.)
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# continue
|
# continue
|
||||||
@ -87,7 +87,7 @@ case "$selection" in
|
|||||||
log "Continue watching"
|
log "Continue watching"
|
||||||
run -H
|
run -H
|
||||||
;;
|
;;
|
||||||
4.)
|
4.)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# playlist mode
|
# playlist mode
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@ -202,7 +202,7 @@ case "$selection" in
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
5.)
|
5.)
|
||||||
log "Sync history database"
|
log "Sync history database"
|
||||||
# username=$(rofi -dmenu -config "$CFG_DIR/$CFG_FILE" \
|
# username=$(rofi -dmenu -config "$CFG_DIR/$CFG_FILE" \
|
||||||
# -l 1 -p "Enter the username of the remote user:")
|
# -l 1 -p "Enter the username of the remote user:")
|
||||||
@ -238,14 +238,14 @@ case "$selection" in
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
6.)
|
6.)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# get out
|
# get out
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
printf "%s\n" "Quitting..."
|
printf "%s\n" "Quitting..."
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
log "Invalid choice..."
|
log "Invalid choice..."
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user