fix ordering of episode numbers

This commit is contained in:
ksyasuda 2021-11-01 17:41:00 -07:00
parent 2912950366
commit f363d2fca5

View File

@ -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
@ -491,7 +492,11 @@ case $scrape in
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