From 3168ebb6dd6bae5c7f492b780a5ae18fc981d578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Tue, 29 Mar 2022 01:16:21 +0200 Subject: Show all episodes, not just local copies. Ideally, I'd like to distinguish them visually, but it is a bit complicated. For now, I don't really care. --- c/episodelistview.c | 22 ++++++++++------------ pl/episode_data.pl | 5 +++++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/c/episodelistview.c b/c/episodelistview.c index 77eefca..37962b1 100644 --- a/c/episodelistview.c +++ b/c/episodelistview.c @@ -148,9 +148,8 @@ void ElvUpdate() { fid_t f; - int iTop; + int iLast, iTop; LVITEM lviEpisode, lviName; - qid_t q; term_t t; SendMessage(HElv, WM_SETREDRAW, FALSE, 0); @@ -161,22 +160,22 @@ ElvUpdate() lviName.mask = LVIF_TEXT; F(f); - t = T(2); - q = Q("local_episodes","sort_episode_file",2,t); + t = T(1); + P("episode_data","last_episode",1,t) goto f; + GI(t,&iLast) goto f; - for (int i = 0; Qn(q); i++) { + for (int i = 0; i < iLast; i++) { char *szName; fid_t f2; - int cb, iEpisode, iItem, r; + int cb; TCHAR *tszEpisode, *tszName; term_t t2; /* Format name string. */ - GI(t,&iEpisode) goto e; F(f2); t2 = T(3); - PI(t2,iEpisode) goto e; + PI(t2,i+1) goto e; tszName = NULL; P("episode_data","lookup_episode_local",3,t2) goto skipname; GAC(t2+1,&szName) goto skipname; @@ -188,14 +187,14 @@ skipname: cb = 100; tszEpisode = malloc(cb*sizeof(TCHAR)); if (!tszEpisode) goto e1; - _stprintf_s(tszEpisode, cb, TEXT("%d"), iEpisode); + _stprintf_s(tszEpisode, cb, TEXT("%d"), i+1); /* Insert item. */ lviEpisode.iItem = i; lviEpisode.iSubItem = 0; lviEpisode.pszText = tszEpisode; - lviEpisode.lParam = iEpisode; + lviEpisode.lParam = i+1; ListView_InsertItem(HElv, &lviEpisode); if (tszName) { @@ -219,8 +218,7 @@ e: Fd(f2); SendMessage(HElv, WM_SETREDRAW, TRUE, 0); ElvRedraw(); - Qc(q); - Fd(f); +f: Fd(f); } /* Update episode name. */ diff --git a/pl/episode_data.pl b/pl/episode_data.pl index c6a5f3a..0c43bdc 100644 --- a/pl/episode_data.pl +++ b/pl/episode_data.pl @@ -1,4 +1,5 @@ :- module(episode_data, [retract_episode/1, + last_episode/1, lookup_episode/3, lookup_episode_local/3, lookup_episode_remote/3]). @@ -21,6 +22,10 @@ detach :- % Interface. +last_episode(Ep) :- + setof(E, N^D^lookup_episode_local(E,N,D), Es), + last(Es, Ep). + lookup_episode(Ep, Name, Data) :- lookup_episode_local(Ep, Name, Data), !. lookup_episode(Ep, Name, Data) :- lookup_episode_remote(Ep, Name, Data). -- cgit v1.2.3