diff options
-rw-r--r-- | pl/episode_data.pl | 5 |
1 files changed, 4 insertions, 1 deletions
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), |