Compare commits

...

3 Commits

Author SHA1 Message Date
ksyasuda
6dd2b4c279 update watch history highlighting when there is an episode 0 2022-04-25 19:49:05 -07:00
ksyasuda
04476f3ba4 allow autoselecting episode 0 2022-04-25 19:39:22 -07:00
ksyasuda
d061438e2e allow episode 0 2022-04-25 19:30:38 -07:00
2 changed files with 7 additions and 4 deletions

View File

@ -678,7 +678,11 @@ episode_selection() {
# Get Watch History for $anime_id as comma separated list # Get Watch History for $anime_id as comma separated list
watch_history="" watch_history=""
while read -r i; do while read -r i; do
if ((FIRST_EP_NUMBER == 0)); then
[[ -z "$watch_history" ]] && watch_history="$((i))" || watch_history="$watch_history, $((i))"
else
[[ -z "$watch_history" ]] && watch_history="$((--i))" || watch_history="$watch_history, $((--i))" [[ -z "$watch_history" ]] && watch_history="$((--i))" || watch_history="$watch_history, $((--i))"
fi
done < <(run_stmt "$stmt") done < <(run_stmt "$stmt")
lg "Episode watch history -> $watch_history" lg "Episode watch history -> $watch_history"
@ -706,7 +710,7 @@ episode_selection() {
read -r ep_choice_start ep_choice_end read -r ep_choice_start ep_choice_end
[[ -z "$ep_choice_end" ]] && ep_choice_end="$ep_choice_start" [[ -z "$ep_choice_end" ]] && ep_choice_end="$ep_choice_start"
fi fi
if (((ep_choice_start <= 0 || ep_choice_start > LAST_EP_NUMBER) || ep_choice_end < ep_choice_start || ep_choice_end > LAST_EP_NUMBER)); then if (((ep_choice_start < 0 || ep_choice_start > LAST_EP_NUMBER) || ep_choice_end < ep_choice_start || ep_choice_end > LAST_EP_NUMBER)); then
die "Invalid episode/range entered: ep_start -> $ep_choice_start | ep_end -> $ep_choice_end" die "Invalid episode/range entered: ep_start -> $ep_choice_start | ep_end -> $ep_choice_end"
fi fi
} }
@ -794,7 +798,7 @@ stream() {
die "No anime selection found" die "No anime selection found"
fi fi
fi fi
if (((FIRST_EP_NUMBER == LAST_EP_NUMBER && FIRST_EP_NUMBER == 1))); then if (((FIRST_EP_NUMBER == LAST_EP_NUMBER && (FIRST_EP_NUMBER == 0 || FIRST_EP_NUMBER == 1)))); then
ep_choice_start=1 ep_choice_start=1
else else
episode_selection episode_selection

View File

@ -24,7 +24,6 @@ CREATE TABLE IF NOT EXISTS watch_history (
episode_number integer NOT NULL, episode_number integer NOT NULL,
watch_date DATETIME NOT NULL, watch_date DATETIME NOT NULL,
CHECK (LENGTH(anime_name) > 0), CHECK (LENGTH(anime_name) > 0),
CHECK (episode_number > 0),
UNIQUE (anime_name, episode_number, watch_date) UNIQUE (anime_name, episode_number, watch_date)
); );