mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-10-28 04:44:11 -07:00
clean up code a bit
This commit is contained in:
parent
a726b9d550
commit
2e9e28883e
10
ani-cli
10
ani-cli
@ -575,11 +575,9 @@ episode_selection() {
|
|||||||
stmt="SELECT DISTINCT episode_number \
|
stmt="SELECT DISTINCT episode_number \
|
||||||
FROM watch_history \
|
FROM watch_history \
|
||||||
WHERE anime_name = '$anime_id';"
|
WHERE anime_name = '$anime_id';"
|
||||||
# hist=$(run_stmt "$stmt")
|
|
||||||
|
|
||||||
# Get Watch History for $anime_id as comma separated list
|
# Get Watch History for $anime_id as comma separated list
|
||||||
watch_history=""
|
watch_history=""
|
||||||
# for i in $hist; do
|
|
||||||
while read -r i; do
|
while read -r i; do
|
||||||
if [[ "$watch_history" == "" ]]; then
|
if [[ "$watch_history" == "" ]]; then
|
||||||
watch_history="$((--i))"
|
watch_history="$((--i))"
|
||||||
@ -837,13 +835,13 @@ parse_args() {
|
|||||||
main() {
|
main() {
|
||||||
case $scrape in
|
case $scrape in
|
||||||
query)
|
query)
|
||||||
BASE_URL=$(curl -s -L -o /dev/null -w "%{url_effective}\n" https://gogoanime.cm)
|
BASE_URL="$(curl -s -L -o /dev/null -w "%{url_effective}\n" https://gogoanime.cm)"
|
||||||
stream
|
stream
|
||||||
;;
|
;;
|
||||||
history)
|
history)
|
||||||
BASE_URL=$(curl -s -L -o /dev/null -w "%{url_effective}\n" https://gogoanime.cm)
|
BASE_URL="$(curl -s -L -o /dev/null -w "%{url_effective}\n" https://gogoanime.cm)"
|
||||||
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"
|
||||||
if ! anime_selection "${search_results[@]}"; then
|
if ! anime_selection "${search_results[@]}"; then
|
||||||
die "No anime selection found"
|
die "No anime selection found"
|
||||||
@ -894,7 +892,7 @@ main() {
|
|||||||
lg "STARTING DIR: $play_dir"
|
lg "STARTING DIR: $play_dir"
|
||||||
[ ! -d "$play_dir" ] && die "$play_dir does not exist"
|
[ ! -d "$play_dir" ] && die "$play_dir does not exist"
|
||||||
insert_history "directory" "$play_dir"
|
insert_history "directory" "$play_dir"
|
||||||
video_path=$(find_media "$play_dir")
|
video_path="$(find_media "$play_dir")"
|
||||||
retcode="$?"
|
retcode="$?"
|
||||||
if [ "$retcode" -ne 0 ]; then
|
if [ "$retcode" -ne 0 ]; then
|
||||||
die "QUITTING"
|
die "QUITTING"
|
||||||
|
Loading…
Reference in New Issue
Block a user