mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-10-28 04:44:11 -07:00
Compare commits
6 Commits
aa39625956
...
228c2014c7
Author | SHA1 | Date | |
---|---|---|---|
|
228c2014c7 | ||
|
006fdc6572 | ||
|
3c4189e3ac | ||
|
5c7093daf0 | ||
|
776c4961aa | ||
|
aac3761e37 |
@ -150,6 +150,7 @@ aniwrapper -h # Show help menu
|
||||
aniwrapper -p # Enable player selection menu
|
||||
aniwrapper -q # Launch menu with quality selection
|
||||
aniwrapper -Q <query> # Query the history database
|
||||
aniwrapper -r # Launch aniwrapper in quick-resume mode (start script on episode selection for the most recently streamed anime)
|
||||
aniwrapper -S # Enable silent mode (suppress output to stdout) [cannot be used with -v]
|
||||
aniwrapper -t <theme> # Choose rofi theme from presets
|
||||
aniwrapper -T <path_to_config> # Specify custom rofi config
|
||||
|
29
ani-cli
29
ani-cli
@ -85,7 +85,7 @@ get_dpage_link() {
|
||||
# credits to fork: https://github.com/Dink4n/ani-cli for the fix
|
||||
for params in "-episode-$ep_no" "-$ep_no" "-episode-$ep_no-1" "-camrip-episode-$ep_no"; do
|
||||
anime_page=$(curl -s "$BASE_URL/$anime_id$params")
|
||||
printf '%s' "$anime_page" | grep -q '404' || break
|
||||
printf '%s' "$anime_page" | grep -q '<h1 class="entry-title">404</h1>' || break
|
||||
done
|
||||
|
||||
printf '%s' "$anime_page" |
|
||||
@ -103,7 +103,7 @@ decrypt_link() {
|
||||
#encrypt and create the final ajax
|
||||
ajax=$(printf "%s\010\016\003\010\t\003\004\t" "$id" | openssl enc -aes256 -K "$secret_key" -iv "$iv" -a)
|
||||
#send request and get the data(most lamest way)
|
||||
data=$(curl -s -H "X-Requested-With:XMLHttpRequest" "$ajax_url" -d "id=$ajax" | cut -d\" -f4 | tr -d '\\')
|
||||
data=$(curl -s -H "X-Requested-With:XMLHttpRequest" "$ajax_url" -d "id=$ajax" | sed -e 's/{"data":"//' -e 's/"}/\n/' -e 's/\\//g')
|
||||
|
||||
#decrypt the data to get final links
|
||||
printf '%s' "$data" | base64 -d | openssl enc -d -aes256 -K "$secret_key" -iv "$iv" | sed -e 's/\].*/\]/' -e 's/\\//g' |
|
||||
@ -375,9 +375,6 @@ play_file() {
|
||||
mpv)
|
||||
nohup "$PLAYER_FN" --force-media-title="aniwrapper: play-from-file - $1" "$1" > /dev/null 2>&1 &
|
||||
;;
|
||||
mplayer)
|
||||
nohup "$PLAYER_FN" -title "aniwrapper: play-from-file - $1" "$1" > /dev/null 2>&1 &
|
||||
;;
|
||||
*)
|
||||
nohup "$PLAYER_FN" "$1" > /dev/null 2>&1 &
|
||||
;;
|
||||
@ -620,8 +617,9 @@ episode_selection() {
|
||||
lg "START: $ep_choice_start | END: $ep_choice_end"
|
||||
elif ((LAST_EP_NUMBER > 1)); then
|
||||
[[ "$is_download" -eq 1 ]] &&
|
||||
inf "Range of episodes can be specified: start_number end_number"
|
||||
prompt "Choose episode" "[$FIRST_EP_NUMBER-$LAST_EP_NUMBER]"
|
||||
inf "Range of episodes can be specified:" "start_number end_number"
|
||||
inf "Anime:" "$anime_id"
|
||||
prompt "Choose episode " "[$FIRST_EP_NUMBER-$LAST_EP_NUMBER]"
|
||||
read -r ep_choice_start ep_choice_end
|
||||
[[ -z "$ep_choice_end" ]] && ep_choice_end="$ep_choice_start"
|
||||
fi
|
||||
@ -672,9 +670,6 @@ open_episode() {
|
||||
mpv)
|
||||
nohup "$PLAYER_FN" --referrer="$dpage_link" "$video_url" --force-media-title="aniwrapper: $anime_id E$(printf "%03d" "$episode")" > /dev/null 2>&1 &
|
||||
;;
|
||||
mplayer)
|
||||
nohup "$PLAYER_FN" -referrer "$dpage_link" "$video_url" -title "aniwrapper: $anime_id E$(printf "%03d" "$episode")" > /dev/null 2>&1 &
|
||||
;;
|
||||
vlc)
|
||||
nohup "$PLAYER_FN" --play-and-exit --http-referrer="$dpage_link" "$video_url" > /dev/null 2>&1 &
|
||||
;;
|
||||
@ -744,13 +739,17 @@ parse_args() {
|
||||
is_download=0
|
||||
download_dir="."
|
||||
half_ep=0
|
||||
while getopts 'd:Hsvq:cf:t:T:CQ:D:Sp:' OPT; do
|
||||
is_resume=0
|
||||
while getopts 'd:Hsvq:cf:t:T:CQ:D:Sp:r' OPT; do
|
||||
case "$OPT" in
|
||||
d)
|
||||
is_download=1
|
||||
download_dir="$OPTARG"
|
||||
lg "DOWNLOAD DIR: $download_dir"
|
||||
;;
|
||||
r)
|
||||
is_resume=1
|
||||
;;
|
||||
H)
|
||||
scrape=history
|
||||
;;
|
||||
@ -833,7 +832,13 @@ main() {
|
||||
case $scrape in
|
||||
query)
|
||||
BASE_URL="$(curl -s -L -o /dev/null -w "%{url_effective}\n" https://gogoanime.fi)"
|
||||
stream "$@"
|
||||
stmt="SELECT anime_name FROM watch_history ORDER BY watch_date DESC LIMIT 1;"
|
||||
((is_resume == 1)) && anime="$(run_stmt "$stmt")" || anime="$*"
|
||||
if [ -z "$anime" ]; then
|
||||
stream
|
||||
else
|
||||
stream "$anime"
|
||||
fi
|
||||
;;
|
||||
history)
|
||||
BASE_URL="$(curl -s -L -o /dev/null -w "%{url_effective}\n" https://gogoanime.fi)"
|
||||
|
24
aniwrapper
24
aniwrapper
@ -12,7 +12,7 @@ DEFAULT_DOWNLOAD="$HOME/Videos/sauce"
|
||||
ROFI_THEME="aniwrapper.rasi"
|
||||
THEMES="alter|aniwrapper|dracula|doomone|fancy|material|monokai|nord|nord2|onedark"
|
||||
QUALITIES="1. best|2. 1080p|3. 720p|4. 480p|5. 360p|6. worst"
|
||||
SUPPORTED_PLAYERS="mpv|mplayer|vlc"
|
||||
SUPPORTED_PLAYERS="mpv|vlc"
|
||||
QUALITY=best
|
||||
PLAYER_FN=mpv
|
||||
DPI=96
|
||||
@ -52,6 +52,7 @@ Options:
|
||||
-p enable player selection menu
|
||||
-q enable quality selection
|
||||
-Q <query> query the history database
|
||||
-r start script in episode selection using the most recently watched anime
|
||||
-v verbose output
|
||||
-S silent mode (suppress output to stdout) [cannot be used with -v]
|
||||
-t <alter|aniwrapper (default)|dracula|doomone|fancy|material|monokai|nord|nord2|onedark> change rofi theme
|
||||
@ -170,12 +171,16 @@ set_theme() {
|
||||
}
|
||||
|
||||
parse_args() {
|
||||
while getopts 'vhqcdf:-:t:T:CQ:D:Sp' OPT; do
|
||||
while getopts 'vhqcdf:t:T:CQ:D:Spr' OPT; do
|
||||
case "$OPT" in
|
||||
h)
|
||||
help_text
|
||||
exit 0
|
||||
;;
|
||||
r)
|
||||
IS_RESUME=1
|
||||
lg "Selecting previously watched anime"
|
||||
;;
|
||||
v)
|
||||
VERBOSE=1
|
||||
;;
|
||||
@ -274,7 +279,11 @@ check_flags() {
|
||||
lg "SELECTED PLAYER FN -> $PLAYER_FN"
|
||||
fi
|
||||
if ((IS_ROFI == 0 && IS_DOWNLOAD == 0)); then
|
||||
run -c "$@"
|
||||
if ((IS_RESUME == 1)); then
|
||||
run -cr "$@"
|
||||
else
|
||||
run -c "$@"
|
||||
fi
|
||||
exit $?
|
||||
elif ((IS_ROFI == 0 && IS_DOWNLOAD == 1)); then
|
||||
prompt "Enter download directory"
|
||||
@ -283,7 +292,11 @@ check_flags() {
|
||||
if [ ! -d "$dl_dir" ]; then
|
||||
mkdir -p "$dl_dir" || seppuku "Error creating directory: $dl_dir"
|
||||
fi
|
||||
run "-cd $dl_dir" "$@"
|
||||
if ((IS_RESUME == 1)); then
|
||||
run "-crd" "$dl_dir" "$@"
|
||||
else
|
||||
run "-cd $dl_dir" "$@"
|
||||
fi
|
||||
exit $?
|
||||
elif ((IS_ROFI == 1 && IS_PLAY_FROM_FILE == 1 && IS_CUSTOM_THEME == 1)); then
|
||||
run "-f$play_path" -T "$CFG_FILE" "$@"
|
||||
@ -291,6 +304,9 @@ check_flags() {
|
||||
elif ((IS_ROFI == 1 && IS_PLAY_FROM_FILE == 1 && IS_CUSTOM_THEME == 0)); then
|
||||
run "-f$play_path" -t "$theme" "$@"
|
||||
exit $?
|
||||
elif ((IS_RESUME == 1)); then
|
||||
run -r "$@"
|
||||
exit $?
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ aniwrapper - A rofi wrapper around ani-cli: a command-line tool to
|
||||
stream, download, and play anime
|
||||
.SH SYNOPSIS
|
||||
.PP
|
||||
\f[B]aniwrapper\f[R] [-dhpqSv] [-t \f[I]theme\f[R] | -T
|
||||
\f[B]aniwrapper\f[R] [-dhpqrSv] [-t \f[I]theme\f[R] | -T
|
||||
\f[I]config_path\f[R]] [\f[I]query\f[R]]
|
||||
.PD 0
|
||||
.P
|
||||
@ -18,7 +18,7 @@ stream, download, and play anime
|
||||
.PD 0
|
||||
.P
|
||||
.PD
|
||||
\f[B]aniwrapper\f[R] -c [-dhpqSv] [\f[I]query\f[R]]
|
||||
\f[B]aniwrapper\f[R] -c [-dhpqrSv] [\f[I]query\f[R]]
|
||||
.PD 0
|
||||
.P
|
||||
.PD
|
||||
@ -65,6 +65,9 @@ Enable video player selection menu
|
||||
\f[B]-q\f[R]
|
||||
Enable quality selection
|
||||
.TP
|
||||
\f[B]-r\f[R]
|
||||
Start script at episode selection for the most recently watched anime
|
||||
.TP
|
||||
\f[B]-Q\f[R] \f[I]query\f[R]
|
||||
Run a query on the history databse
|
||||
.TP
|
||||
|
@ -12,9 +12,9 @@ aniwrapper - A rofi wrapper around ani-cli: a command-line tool to stream, downl
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
**aniwrapper** [-dhpqSv] [-t _theme_ | -T _config_path_] [_query_]\
|
||||
**aniwrapper** [-dhpqrSv] [-t _theme_ | -T _config_path_] [_query_]\
|
||||
**aniwrapper** -f _directory_path_ [-t _theme_ | -T _config_path_] [-pSv] [_query_]\
|
||||
**aniwrapper** -c [-dhpqSv] [_query_]\
|
||||
**aniwrapper** -c [-dhpqrSv] [_query_]\
|
||||
**aniwrapper** -Q _query_\
|
||||
**aniwrapper** -C
|
||||
|
||||
@ -53,6 +53,9 @@ Defaults:
|
||||
**-q**
|
||||
: Enable quality selection
|
||||
|
||||
**-r**
|
||||
: Start script at episode selection for the most recently watched anime
|
||||
|
||||
**-Q** _query_
|
||||
: Run a query on the history databse
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user