aboutsummaryrefslogtreecommitdiff
path: root/local_episodes.pl
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-02-13 13:25:39 +0100
committerJohn Ankarström <john@ankarstrom.se>2022-02-13 13:25:39 +0100
commit92f7852b6979239214848b7ebb4046d52e4aba06 (patch)
treedf49eb01bc34c2acebdc3ad42f505cdb64afdae9 /local_episodes.pl
downloadEpisodeBrowser-92f7852b6979239214848b7ebb4046d52e4aba06.tar.gz
Begin Win32 re-implementation.
Diffstat (limited to 'local_episodes.pl')
-rw-r--r--local_episodes.pl31
1 files changed, 31 insertions, 0 deletions
diff --git a/local_episodes.pl b/local_episodes.pl
new file mode 100644
index 0000000..283ccb7
--- /dev/null
+++ b/local_episodes.pl
@@ -0,0 +1,31 @@
+:- module(local_episodes, [local_episode//1,
+ episode_file/2,
+ open_episode/1]).
+
+:- use_module(library(dcg/basics)).
+:- use_module(atom_dcg).
+
+local_episode -->
+ local_episode(_).
+local_episode(N) -->
+ string(_), "Detective_Conan_-_", integer(N), string(_).
+local_episode(N) -->
+ string(_), "Detective_Conan_-_",
+ integer(First), "-", integer(Last), string(_),
+ { Second is First + 1, between(Second, Last, 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),
+ ( nonvar(N)
+ -> include(atom_phrase(local_episode(N)), F1, [F|_])
+ ; include(atom_phrase(local_episode), F1, F2),
+ member(F, F2),
+ atom_phrase(local_episode(N), F)
+ ).
+
+open_episode(N) :-
+ episode_file(N, F),
+ win_shell(open, F).