aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-03-23 23:08:13 +0100
committerJohn Ankarström <john@ankarstrom.se>2022-03-23 23:08:13 +0100
commitc9b639d63f0d17eb7d901d4eda42476ed9d5c8a0 (patch)
treec0eefd335bbae14b8d8501a174d4e258e945bf21
parent2c92cdf8c23fa0724829cc5aa25cb04ae263c796 (diff)
downloadEpisodeBrowser-c9b639d63f0d17eb7d901d4eda42476ed9d5c8a0.tar.gz
Sort episodes.
-rw-r--r--c/episodelistview.c2
-rw-r--r--pl/local_episodes.pl9
2 files changed, 8 insertions, 3 deletions
diff --git a/c/episodelistview.c b/c/episodelistview.c
index 9aa73ef..77eefca 100644
--- a/c/episodelistview.c
+++ b/c/episodelistview.c
@@ -162,7 +162,7 @@ ElvUpdate()
F(f);
t = T(2);
- q = Q("local_episodes","episode_file",2,t);
+ q = Q("local_episodes","sort_episode_file",2,t);
for (int i = 0; Qn(q); i++) {
char *szName;
diff --git a/pl/local_episodes.pl b/pl/local_episodes.pl
index c746883..3839399 100644
--- a/pl/local_episodes.pl
+++ b/pl/local_episodes.pl
@@ -1,5 +1,6 @@
:- module(local_episodes, [local_episode//1,
episode_file/2,
+ sort_episode_file/2,
open_episode/1]).
:- use_module(library(dcg/basics)).
@@ -8,6 +9,7 @@
local_episode_prefix --> string(_), "Detective_Conan_-_".
local_episode_prefix --> string(_), "Detective Conan - ".
local_episode_prefix --> string(_), "Detective-Conan-".
+local_episode_prefix --> string(_), "detective_conan_".
local_episode -->
local_episode(_).
@@ -20,8 +22,7 @@ local_episode(N) -->
% Find episode on disk.
episode_file(N, F) :-
- expand_file_name('C:/Users/John/Nedladdningar/Detective Conan season 1 to season 22 + season 23(incomplete)/*/*.*',
- F1),
+ expand_file_name('C:/Users/John/Nedladdningar/Detective Conan season 1 to season 22 + season 23(incomplete)/*/*.*', F1),
( nonvar(N)
-> include(atom_phrase(local_episode(N)), F1, [F|_])
; include(atom_phrase(local_episode), F1, F2),
@@ -29,6 +30,10 @@ episode_file(N, F) :-
atom_phrase(local_episode(N), F)
).
+sort_episode_file(N, F) :-
+ setof(N_-F_, episode_file(N_, F_), S),
+ member(N-F, S).
+
open_episode(N) :-
episode_file(N, F),
win_shell(open, F).