Config prep, but Mainly SYNC to desktop

This commit is contained in:
Felisp 2024-07-28 14:57:35 +02:00
parent 22f6c54bf4
commit cd540fda36
2 changed files with 27 additions and 4 deletions

View file

@ -56,6 +56,21 @@
(with-open [r (io/reader fl)] (with-open [r (io/reader fl)]
(edn/read (java.io.PushbackReader. r)))))) (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 (defn get-some-config
"Attempts to get config somehow, "Attempts to get config somehow,
first from command line argument first from command line argument
@ -67,8 +82,10 @@
(let [file-to-try (u/nil?-else (first cmd-args) (let [file-to-try (u/nil?-else (first cmd-args)
"./config.edn")] "./config.edn")]
(u/when-else (load-config file-to-try) (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))) 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 ;; Todo: Add option to write default config to stdout
(defn -main (defn -main

View file

@ -19,10 +19,16 @@
(:gen-class)) (:gen-class))
(def chod-threads-cache (def chod-threads-cache
"Cached vector of threads that have CHanceOfDeath > configured" "Cached map of threads that have CHanceOfDeath > configured"
(atom [])) 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 (defn process-page
"Procesess every thread in page, leaving only relevant information "Procesess every thread in page, leaving only relevant information