Compare commits
2 commits
693c47d465
...
cd540fda36
Author | SHA1 | Date | |
---|---|---|---|
cd540fda36 | |||
22f6c54bf4 |
3 changed files with 30 additions and 6 deletions
|
@ -4,7 +4,7 @@
|
|||
:default-board "/mlp/" ;Board to be used when no board=x param given
|
||||
:board-disabled-message "This board is not enabled for feed generation.\n\nYou can contact me here: [contact]"
|
||||
:enable-board-listing true ;Whether to show list of enabled boards in /boards
|
||||
:boards-defaults {:refresh-rate 300
|
||||
:boards-defaults {:refresh-rate 300 ;how often new data should be downloaded in seconds
|
||||
:starting-page 7
|
||||
:default-chod 94
|
||||
;; If you want to do some preprocessing beforehand, you can override
|
||||
|
@ -14,7 +14,8 @@
|
|||
;; Commented parts bellow are still unimplemented
|
||||
;; Only download catalog when someone requests feed and cache is old
|
||||
;; Saves request to 4chan, usefull for borads that are checked rarely
|
||||
;; :lazy-load false
|
||||
;; Generally the better option, first request in :refresh-rate may take longer
|
||||
:lazy-load true
|
||||
;; Whether to allow regex search thru the threads (&qr= param)
|
||||
;; :regex-enable true
|
||||
;; Wheter to create cache by downloading whole catalog or every required
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue