diff --git a/src/rss_thread_watch/core.clj b/src/rss_thread_watch/core.clj index c84131e..f14cd61 100644 --- a/src/rss_thread_watch/core.clj +++ b/src/rss_thread_watch/core.clj @@ -56,6 +56,21 @@ (with-open [r (io/reader fl)] (edn/read (java.io.PushbackReader. r)))))) +(defn config-fill-board-defaults + "Fills every enabled board with default values" + [conifg] + ;; Získat všechny klíče desek které musíme vyplnit + ;; Každý klíč mergnout s default mapou + (u/map-apply-defaults ) + (let [board-defaults (:boards-default config) + boards (keys (:boards-enabled config))] + (update-in config '(:boards-enabled) (fn [val] + (u/fmap (fn []) + val) ) + ;; just do fmap of boards + ()) + ) + (defn get-some-config "Attempts to get config somehow, first from command line argument @@ -67,8 +82,10 @@ (let [file-to-try (u/nil?-else (first cmd-args) "./config.edn")] (u/when-else (load-config file-to-try) - (println "WARN: Using default internal config because suggessted " file-to-try " not found.") + (println "WARN: Using default internal config because suggessted file: '" file-to-try "' not found.") CONFIG-DEFAULT))) +;;TODO: We want to copy default board-local config into every board, that way we won't have to always look +;; into defaults, but ;; Todo: Add option to write default config to stdout (defn -main diff --git a/src/rss_thread_watch/watcher.clj b/src/rss_thread_watch/watcher.clj index 5eba442..1a00299 100644 --- a/src/rss_thread_watch/watcher.clj +++ b/src/rss_thread_watch/watcher.clj @@ -19,10 +19,16 @@ (:gen-class)) (def chod-threads-cache - "Cached vector of threads that have CHanceOfDeath > configured" - (atom [])) + "Cached map of threads that have CHanceOfDeath > configured" + nil) -(def time-of-cache (atom 0)) +(def time-of-cache nil) + +(defn init-global-cache + "Initializes global cache of catalogs" + [config] + (keys (:boards-enabled config)) + ) (defn process-page "Procesess every thread in page, leaving only relevant information