From 3d907443ef27355ec9ced8a244fd678df1ea2538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 1 Apr 2022 03:57:11 +0200 Subject: Ensure episode data is downloaded. --- pl/episode_data.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pl') diff --git a/pl/episode_data.pl b/pl/episode_data.pl index 0c43bdc..1bdde79 100644 --- a/pl/episode_data.pl +++ b/pl/episode_data.pl @@ -23,6 +23,7 @@ detach :- % Interface. last_episode(Ep) :- + ensure, setof(E, N^D^lookup_episode_local(E,N,D), Es), last(Es, Ep). @@ -35,7 +36,6 @@ lookup_episode_remote(Ep, Name, Data) :- update, !, episode_name_data(Ep, Name, Data). - retract_episode(Ep) :- ( episode_name_data(Ep, _, _) -> retractall_episode_name_data(Ep, _, _) @@ -52,6 +52,9 @@ episode_number(Ep) --> padding(Ep), integer(Ep). % Database updating. +ensure :- episode_name_data(_, _, _), !. +ensure :- update. + update :- remote(R0), !, findall(Ep-Name-Data, (xpath(R0, //tr, R), -- cgit v1.2.3