diff options
Diffstat (limited to 'pl/local_episodes.pl')
-rw-r--r-- | pl/local_episodes.pl | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/pl/local_episodes.pl b/pl/local_episodes.pl new file mode 100644 index 0000000..283ccb7 --- /dev/null +++ b/pl/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). |