mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2025-01-30 10:27:38 -08:00
fix ordering of episode numbers
This commit is contained in:
parent
2912950366
commit
f363d2fca5
13
ani-cli
13
ani-cli
@ -363,7 +363,8 @@ open_episode() {
|
|||||||
err "Episode out of range"
|
err "Episode out of range"
|
||||||
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' \
|
||||||
|
ORDER BY episode_number ASC;"
|
||||||
# hist=$(echo "$stmt" | sqlite3 "$history_db" | awk '{ if ( NR > 2 ) { print } }')
|
# hist=$(echo "$stmt" | sqlite3 "$history_db" | awk '{ if ( NR > 2 ) { print } }')
|
||||||
hist=$(run_stmt "$stmt")
|
hist=$(run_stmt "$stmt")
|
||||||
if [[ "$VERBOSE" -eq 1 ]]; then
|
if [[ "$VERBOSE" -eq 1 ]]; then
|
||||||
@ -477,7 +478,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")
|
||||||
@ -485,13 +486,17 @@ case $scrape in
|
|||||||
anime_selection "$search_results"
|
anime_selection "$search_results"
|
||||||
episode_selection
|
episode_selection
|
||||||
;;
|
;;
|
||||||
history)
|
history)
|
||||||
# search_results=$(sed -n -E 's/\t[0-9]*//p' "$logfile")
|
# search_results=$(sed -n -E 's/\t[0-9]*//p' "$logfile")
|
||||||
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"
|
||||||
anime_selection "${search_results[@]}"
|
anime_selection "${search_results[@]}"
|
||||||
ep_choice_start=$(sed -n -E "s/${selection_id}\t//p" "$logfile")
|
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")
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user