mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-10-28 04:44:11 -07:00
update readme and turn off verbose mode
This commit is contained in:
parent
4b7fccec1c
commit
ea63ad4ac8
55
README.md
55
README.md
@ -4,7 +4,7 @@
|
||||
|
||||
[Setup](#setup) | [Usage](#usage) | [Screenshots](#screenshots)
|
||||
|
||||
![Aniwrapper screenshot](./screenshots/aniwrapper_home.png)
|
||||
![Aniwrapper screenshot](./assets/screenshots/aniwrapper_home.png)
|
||||
|
||||
</div>
|
||||
|
||||
@ -20,11 +20,14 @@
|
||||
- [Installing](#installing)
|
||||
- [Usage](#usage)
|
||||
- [aniwrapper](#aniwrapper)
|
||||
- [Option 1: Streaming (Default)](#option-1-streaming-default)
|
||||
- [ani-cli Script](#ani-cli-script)
|
||||
- [Screenshots](#screenshots)
|
||||
|
||||
<!-- markdown-toc end -->
|
||||
|
||||
---
|
||||
|
||||
# Introduction
|
||||
|
||||
This is a fork of [Dink4n's ani-cli](https://github.com/Dink4n/ani-cli),
|
||||
@ -92,6 +95,24 @@ The setup process consists of:
|
||||
|
||||
Running `sudo make install` copies the `ani-cli` as well as the `aniwrapper` scripts to `/usr/local/bin/`
|
||||
|
||||
## `aniwrapper` Menus
|
||||
|
||||
There are several menus used to drive the program forward
|
||||
|
||||
### Search Anime
|
||||
|
||||
The first menu consists of a search box and a list of anime titles corresponding to past valid searches. Choose an option from the menu, or enter in a unique search query to search for a new anime. The result from this will be used to query against `gogoanime` and return similar named anime
|
||||
|
||||
### Anime Selection
|
||||
|
||||
The next menu is where you select the anime to watch from a narrowed down list. Elements that have a blue border and text color indicate which anime have been watched before
|
||||
|
||||
- _In the future, I'd like to make it so if you select an option from the list of previously searched anime, then it will skip this and go on to episode selection_
|
||||
|
||||
### Episode Selection
|
||||
|
||||
In the episode selection menu, you can select an individual episode from the list, provide a single episode, or provide a range of episodes as two space separated integers `start_episode end_episode`. Like in the previous menu, any element with a blue border and text-color indicates that episode has been watched before
|
||||
|
||||
# Usage
|
||||
|
||||
## aniwrapper
|
||||
@ -99,6 +120,34 @@ Running `sudo make install` copies the `ani-cli` as well as the `aniwrapper` scr
|
||||
# Launch aniwrapper menu
|
||||
aniwrapper
|
||||
|
||||
### Option 1: Streaming
|
||||
|
||||
<div align="center">
|
||||
|
||||
![streaming gif select from menu](./assets/gifs/streaming.gif)
|
||||
Streaming a previously watched anime
|
||||
[click here](./assets/gifs/streaming_new.gif) for an example showing streaming a new anime
|
||||
|
||||
</div>
|
||||
|
||||
Streaming is the default option for the `aniwrapper` script and will prompt you with each of the menus specified in the _[aniwrapper Menus](#aniwrapper-menus)_ section
|
||||
|
||||
### Option 2: Download
|
||||
|
||||
The default download location is `$HOME/Videos/sauce` and will be chosen as the download directory unless otherwise specified
|
||||
|
||||
After specifying the download directory (or leaving it blank for the default), you will be presented with the menus from the _[aniwrapper Menus](#aniwrapper-menus)_ section for selecting the anime and episode(s) to download
|
||||
|
||||
### Option 3: Continue
|
||||
|
||||
**CURRENTLY BROKEN. WORKING ON FIX**
|
||||
|
||||
The continue option queries the `sqlite3` history databse and pulls the list of distinct anime names from the `watch_history` table. Select an option from the list and the most recently watched episode of the selected anime will play
|
||||
|
||||
### Option 4: Playlist
|
||||
|
||||
_description coming soon_
|
||||
|
||||
## ani-cli Script
|
||||
|
||||
# watch anime
|
||||
@ -133,9 +182,9 @@ This would open/download episodes 1 2 3 4 5 6
|
||||
<div align="center">
|
||||
|
||||
Aniwrapper Main Menu
|
||||
![aniwrapper frontpage](./screenshots/aniwrapper_home.png)
|
||||
![aniwrapper frontpage](./assets/screenshots/aniwrapper_home.png)
|
||||
Aniwrapper Streaming Menu
|
||||
![aniwrapper streaming options](./screenshots/aniwrapper_stream.png)
|
||||
![aniwrapper streaming options](./assets/screenshots/aniwrapper_stream.png)
|
||||
More to come soon... maybe
|
||||
|
||||
</div>
|
||||
|
246
ani-cli
246
ani-cli
@ -5,6 +5,8 @@ if [[ -z "$XDG_CONFIG_HOME" ]]; then
|
||||
XDG_CONFIG_HOME="$HOME/.config"
|
||||
fi
|
||||
|
||||
VERBOSE=0
|
||||
|
||||
BASE_URL="https://gogoanime.cm"
|
||||
CFG_DIR="$XDG_CONFIG_HOME/aniwrapper"
|
||||
ROFI_CFG="meh.rasi"
|
||||
@ -26,8 +28,6 @@ c_magenta="\033[1;35m"
|
||||
c_cyan="\033[1;36m"
|
||||
c_reset="\033[0m"
|
||||
|
||||
VERBOSE=1
|
||||
|
||||
help_text() {
|
||||
while IFS= read line; do
|
||||
printf "%s\n" "$line"
|
||||
@ -107,7 +107,8 @@ check_anime_name() {
|
||||
# Check to make sure passed in name is not empty
|
||||
[ "$VERBOSE" -eq 1 ] && printf "%s\n" "VAR: $1"
|
||||
if [[ "$1" == "" ]] || [[ "$1" == " " ]] || [[ "$1" == "\n" ]]; then
|
||||
printf "%s\n" "Passed in name is null"
|
||||
[ "$VERBOSE" -eq 1 ] &&
|
||||
printf "%s\n" "Passed in name is nothing"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
@ -156,16 +157,19 @@ insert_history() {
|
||||
# check the anime_name/id
|
||||
check_anime_name "$1"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
printf "%s\n" "ERROR: Anime name is none... exiting"
|
||||
[ "$VERBOSE" -eq 1 ] &&
|
||||
printf "%s\n" "ERROR: Anime name is none... exiting"
|
||||
return 1
|
||||
fi
|
||||
datetime=$(date +'%Y-%m-%d %H:%M:%S')
|
||||
check_db "$@"
|
||||
if [[ $? -gt 0 ]]; then
|
||||
if [[ "$2" == "search" ]]; then
|
||||
printf "%s\n" "Already in search db... Updating search_date"
|
||||
[ "$VERBOSE" -eq 1 ] &&
|
||||
printf "%s\n" "Already in search db... Updating search_date"
|
||||
else
|
||||
printf "%s\n" "Already in search db... Updating watch_date"
|
||||
[ "$VERBOSE" -eq 1 ] &&
|
||||
printf "%s\n" "Already in search db... Updating watch_date"
|
||||
fi
|
||||
update_date "$@"
|
||||
else
|
||||
@ -257,7 +261,7 @@ anime_selection() {
|
||||
fi
|
||||
done
|
||||
|
||||
printf "%s\n" "SEARCHED: $searched"
|
||||
[ "$VERBOSE" -eq 1 ] && printf "%s\n" "SEARCHED: $searched"
|
||||
|
||||
# get the anime from indexed list
|
||||
user_input=$(printf "${menu[@]}" |
|
||||
@ -312,9 +316,9 @@ anime_selection() {
|
||||
|
||||
episode_selection() {
|
||||
# select episode number for anime
|
||||
[ $is_download -eq 1 ] &&
|
||||
[ "$is_download" -eq 1 ] &&
|
||||
printf "Range of episodes can be specified: start_number end_number\n"
|
||||
printf "%s\n" "Anime ID: $anime_id"
|
||||
[ "$VERBOSE" -eq 1 ] && printf "%s\n" "Anime ID: $anime_id"
|
||||
stmt="SELECT DISTINCT episode_number \
|
||||
FROM watch_history \
|
||||
WHERE anime_name = '$anime_id';"
|
||||
@ -395,17 +399,17 @@ open_episode() {
|
||||
video_url=$(get_links "$dpage_url")
|
||||
|
||||
case $video_url in
|
||||
*streamtape*)
|
||||
# If direct download not available then scrape streamtape.com
|
||||
BROWSER=${BROWSER:-firefox}
|
||||
printf "scraping streamtape.com\n"
|
||||
video_url=$(curl -s "$video_url" | sed -n -E '
|
||||
*streamtape*)
|
||||
# If direct download not available then scrape streamtape.com
|
||||
BROWSER=${BROWSER:-firefox}
|
||||
printf "scraping streamtape.com\n"
|
||||
video_url=$(curl -s "$video_url" | sed -n -E '
|
||||
/^<script>document/{
|
||||
s/^[^"]*"([^"]*)" \+ '\''([^'\'']*).*/https:\1\2\&dl=1/p
|
||||
q
|
||||
}
|
||||
')
|
||||
;;
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ $is_download -eq 0 ]; then
|
||||
@ -452,45 +456,45 @@ playlist_add=0
|
||||
playlist_file="$CFG_DIR/playlists/playlist.txt"
|
||||
while getopts 'hd:HlpadP:' OPT; do
|
||||
case $OPT in
|
||||
h)
|
||||
help_text
|
||||
exit 0
|
||||
;;
|
||||
d)
|
||||
is_download=1
|
||||
download_dir="$OPTARG"
|
||||
h)
|
||||
help_text
|
||||
exit 0
|
||||
;;
|
||||
d)
|
||||
is_download=1
|
||||
download_dir="$OPTARG"
|
||||
|
||||
if [ "$VERBOSE" -eq 1 ]; then
|
||||
echo "DOWNLOAD DIR: $download_dir"
|
||||
fi
|
||||
;;
|
||||
H)
|
||||
scrape=history
|
||||
;;
|
||||
l)
|
||||
list_history=1
|
||||
;;
|
||||
p)
|
||||
scrape=playlist
|
||||
is_playlist=1
|
||||
;;
|
||||
a)
|
||||
is_add=1
|
||||
scrape=add
|
||||
;;
|
||||
d)
|
||||
is_delete=1
|
||||
scrape=delete
|
||||
;;
|
||||
P)
|
||||
is_playlist=1
|
||||
# remove spaces from $OPTARG
|
||||
playlist_file="${OPTARG/ //}"
|
||||
[ -z "$playlist_file" ] && die "Enter in path to playlist"
|
||||
[ "$VERBOSE" -eq 1 ] && printf "%s\n" "$playlist_file"
|
||||
$player_fn "$playlist_file"
|
||||
exit 0
|
||||
;;
|
||||
if [ "$VERBOSE" -eq 1 ]; then
|
||||
echo "DOWNLOAD DIR: $download_dir"
|
||||
fi
|
||||
;;
|
||||
H)
|
||||
scrape=history
|
||||
;;
|
||||
l)
|
||||
list_history=1
|
||||
;;
|
||||
p)
|
||||
scrape=playlist
|
||||
is_playlist=1
|
||||
;;
|
||||
a)
|
||||
is_add=1
|
||||
scrape=add
|
||||
;;
|
||||
d)
|
||||
is_delete=1
|
||||
scrape=delete
|
||||
;;
|
||||
P)
|
||||
is_playlist=1
|
||||
# remove spaces from $OPTARG
|
||||
playlist_file="${OPTARG/ //}"
|
||||
[ -z "$playlist_file" ] && die "Enter in path to playlist"
|
||||
[ "$VERBOSE" -eq 1 ] && printf "%s\n" "$playlist_file"
|
||||
$player_fn "$playlist_file"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
@ -511,63 +515,63 @@ if [[ "$list_history" -eq 1 ]]; then
|
||||
fi
|
||||
|
||||
case $scrape in
|
||||
query)
|
||||
query)
|
||||
|
||||
get_search_query "$*"
|
||||
search_results=$(search_anime "$query")
|
||||
[ -z "$search_results" ] && die "No search results found"
|
||||
anime_selection "$search_results"
|
||||
[ $? -ne 0 ] && die "No anime selection found"
|
||||
episode_selection
|
||||
;;
|
||||
history)
|
||||
# search_results=$(sed -n -E 's/\t[0-9]*//p' "$logfile")
|
||||
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"
|
||||
anime_selection "${search_results[@]}"
|
||||
[ $? -ne 0 ] && die "No anime selection found"
|
||||
stmt="SELECT episode_number FROM watch_history ORDER BY watch_date DESC LIMIT 1"
|
||||
run_stmt "$stmt"
|
||||
ep_choice_start=$?
|
||||
echo "EPISODE: $ep_choice_start"
|
||||
# ep_choice_start=$(sed -n -E "s/${selection_id}\t//p" "$logfile")
|
||||
;;
|
||||
playlist)
|
||||
lines=$(cat "$playlist_file" | wc -l)
|
||||
[ "$VERBOSE" -eq 1 ] && printf "%s%d\n" "Num lines in playlist: " "$lines"
|
||||
if [[ "$lines" -eq 0 ]]; then
|
||||
get_search_query "$*"
|
||||
search_results=$(search_anime "$query")
|
||||
[ -z "$search_results" ] && die "No search results found"
|
||||
anime_selection "$search_results"
|
||||
[ $? -ne 0 ] && die "No anime selection found"
|
||||
episode_selection
|
||||
;;
|
||||
history)
|
||||
# search_results=$(sed -n -E 's/\t[0-9]*//p' "$logfile")
|
||||
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"
|
||||
anime_selection "${search_results[@]}"
|
||||
[ $? -ne 0 ] && die "No anime selection found"
|
||||
stmt="SELECT episode_number FROM watch_history ORDER BY watch_date DESC LIMIT 1"
|
||||
run_stmt "$stmt"
|
||||
ep_choice_start=$?
|
||||
echo "EPISODE: $ep_choice_start"
|
||||
# ep_choice_start=$(sed -n -E "s/${selection_id}\t//p" "$logfile")
|
||||
;;
|
||||
playlist)
|
||||
lines=$(cat "$playlist_file" | wc -l)
|
||||
[ "$VERBOSE" -eq 1 ] && printf "%s%d\n" "Num lines in playlist: " "$lines"
|
||||
if [[ "$lines" -eq 0 ]]; then
|
||||
get_search_query "$*"
|
||||
search_results=$(search_anime "$query")
|
||||
[ -z "$search_results" ] && die "No search results found"
|
||||
anime_selection "$search_results"
|
||||
[ $? -ne 0 ] && die "No anime selection found"
|
||||
episode_selection
|
||||
else
|
||||
line=($(sed '1q;d' "$playlist_file"))
|
||||
if [[ "${#line[@]}" -ne 2 ]]; then
|
||||
die "Something went wrong with the playlist file... exiting"
|
||||
fi
|
||||
selection_id="${line[0]}"
|
||||
episodes=($selection_id)
|
||||
ep_choice_start="${line[1]}"
|
||||
ep_choice_end=""
|
||||
read last_ep_number <<-EOF
|
||||
$(search_eps "$selection_id")
|
||||
EOF
|
||||
[ "$VERBOSE" -eq 1 ] && printf "Anime: %s Episode: %d\n" "$episodes" "$ep_choice_start"
|
||||
[ "$VERBOSE" -eq 1 ] && printf "Episodes: %s\n" "${episodes[@]}"
|
||||
else
|
||||
line=($(sed '1q;d' "$playlist_file"))
|
||||
if [[ "${#line[@]}" -ne 2 ]]; then
|
||||
die "Something went wrong with the playlist file... exiting"
|
||||
fi
|
||||
;;
|
||||
add)
|
||||
get_search_query "$*"
|
||||
search_results=$(search_anime "$query")
|
||||
[ -z "$search_results" ] && die "No search results found"
|
||||
anime_selection "$search_results"
|
||||
[ $? -ne 0 ] && die "No anime selection found"
|
||||
episode_selection
|
||||
;;
|
||||
delete) ;;
|
||||
selection_id="${line[0]}"
|
||||
episodes=($selection_id)
|
||||
ep_choice_start="${line[1]}"
|
||||
ep_choice_end=""
|
||||
read last_ep_number <<-EOF
|
||||
$(search_eps "$selection_id")
|
||||
EOF
|
||||
[ "$VERBOSE" -eq 1 ] && printf "Anime: %s Episode: %d\n" "$episodes" "$ep_choice_start"
|
||||
[ "$VERBOSE" -eq 1 ] && printf "Episodes: %s\n" "${episodes[@]}"
|
||||
fi
|
||||
;;
|
||||
add)
|
||||
get_search_query "$*"
|
||||
search_results=$(search_anime "$query")
|
||||
[ -z "$search_results" ] && die "No search results found"
|
||||
anime_selection "$search_results"
|
||||
[ $? -ne 0 ] && die "No anime selection found"
|
||||
episode_selection
|
||||
;;
|
||||
delete) ;;
|
||||
|
||||
esac
|
||||
|
||||
@ -618,29 +622,29 @@ while :; do
|
||||
|
||||
printf "$c_reset"
|
||||
case $choice in
|
||||
n)
|
||||
episode=$((episode + 1))
|
||||
;;
|
||||
p)
|
||||
episode=$((episode - 1))
|
||||
;;
|
||||
n)
|
||||
episode=$((episode + 1))
|
||||
;;
|
||||
p)
|
||||
episode=$((episode - 1))
|
||||
;;
|
||||
|
||||
s)
|
||||
printf "${c_blue}Choose episode $c_cyan[1-%d]$c_reset:$c_green " $last_ep_number
|
||||
read episode
|
||||
printf "$c_reset"
|
||||
[ "$episode" -eq "$episode" ] 2>/dev/null || die "Invalid number entered"
|
||||
;;
|
||||
s)
|
||||
printf "${c_blue}Choose episode $c_cyan[1-%d]$c_reset:$c_green " $last_ep_number
|
||||
read episode
|
||||
printf "$c_reset"
|
||||
[ "$episode" -eq "$episode" ] 2>/dev/null || die "Invalid number entered"
|
||||
;;
|
||||
|
||||
r) ;;
|
||||
r) ;;
|
||||
|
||||
q)
|
||||
break
|
||||
;;
|
||||
q)
|
||||
break
|
||||
;;
|
||||
|
||||
*)
|
||||
die "invalid choice"
|
||||
;;
|
||||
*)
|
||||
die "invalid choice"
|
||||
;;
|
||||
esac
|
||||
open_episode "$selection_id" "$episode" "$download_dir"
|
||||
done
|
||||
|
@ -7,7 +7,7 @@ DEFAULT_DOWNLOAD="$HOME/Videos/sauce"
|
||||
DEFAULT_PLAYLIST="$HOME/Videos/sauce/playlists/playlist.txt"
|
||||
CFG_DIR="$XDG_CONFIG_HOME/aniwrapper"
|
||||
CFG_FILE="meh.rasi"
|
||||
VERBOSE=1
|
||||
VERBOSE=0
|
||||
|
||||
# printf "%s\n" "CONFIG DIR: $CFG_DIR"
|
||||
|
||||
@ -44,7 +44,6 @@ if [[ "$selection" == "1." ]]; then
|
||||
# streaming
|
||||
# ---------------------------------------------------------------------------
|
||||
log "Streaming mode"
|
||||
printf "%s\n" "STREAMING..."
|
||||
run
|
||||
elif [[ "$selection" == "2." ]]; then
|
||||
# ---------------------------------------------------------------------------
|
||||
|
BIN
assets/gifs/streaming.gif
Normal file
BIN
assets/gifs/streaming.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 MiB |
BIN
assets/gifs/streaming_new.gif
Normal file
BIN
assets/gifs/streaming_new.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 MiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Loading…
Reference in New Issue
Block a user