aboutsummaryrefslogtreecommitdiff
path: root/pl/cfg.pl
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-04-05 02:37:58 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-04-05 02:37:58 +0200
commit9a48743eeba0f1bc4cf74f47fef96bdbcadfc98b (patch)
treef78c6062b2ec931f1c181d7726ee612c332b892b /pl/cfg.pl
parent96f4b3a127e027364c77416f1ee8e5a471c5d783 (diff)
downloadEpisodeBrowser-9a48743eeba0f1bc4cf74f47fef96bdbcadfc98b.tar.gz
Move settings to registry.
Diffstat (limited to 'pl/cfg.pl')
-rw-r--r--pl/cfg.pl33
1 files changed, 33 insertions, 0 deletions
diff --git a/pl/cfg.pl b/pl/cfg.pl
new file mode 100644
index 0000000..f24e44e
--- /dev/null
+++ b/pl/cfg.pl
@@ -0,0 +1,33 @@
+:- module(cfg, [set_glob/1,
+ get_glob/1,
+ set_root/1,
+ get_root/1,
+ set_url/1,
+ get_url/1]).
+
+:- use_module(library(registry)).
+
+set_key(Key, Value) :-
+ registry_set_key(current_user/software/'JohnAJ'/'EpisodeBrowser'/'Settings', Key, Value).
+get_key(Key, Value) :-
+ catch(registry_get_key(current_user/software/'JohnAJ'/'EpisodeBrowser'/'Settings', Key, Value),
+ _,
+ fail).
+
+set_root(V) :- set_key('EpisodeRoot', V).
+get_root(V) :-
+ get_key('EpisodeRoot', V0),
+ re_replace('\\\\', '/', V0, V1),
+ atom_string(V, V1).
+
+set_glob(V) :- set_key('EpisodeRoot', V).
+get_glob(V) :-
+ ( get_key('EpisodeRoot', V)
+ ; V = '*/*.*'
+ ).
+
+set_url(V) :- set_key('UrlPrefix', V).
+get_url(V) :-
+ ( get_key('UrlPrefix', V)
+ ; V = 'https://gogoanime.fi/detective-conan-episode-'
+ ).