SYNC commit
This commit is contained in:
parent
99d01b3f70
commit
a5d7d58a25
3 changed files with 9 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
(defproject rss-thread-watch "0.4.1-SNAPSHOT"
|
(defproject rss-thread-watch "0.4.2-SNAPSHOT"
|
||||||
:description "RSS based thread watcher"
|
:description "RSS based thread watcher"
|
||||||
:url "http://example.com/FIXME"
|
:url "http://example.com/FIXME"
|
||||||
:license {:name "AGPL-3.0-only"
|
:license {:name "AGPL-3.0-only"
|
||||||
|
|
|
@ -84,9 +84,8 @@
|
||||||
(map guid-fn actuall-matches)))
|
(map guid-fn actuall-matches)))
|
||||||
|
|
||||||
(defn thread-to-rss-item
|
(defn thread-to-rss-item
|
||||||
"If I wasnt retarded I could have made the cached version look like
|
"Converts cached thread item to feed item which can be serialized into RSS"
|
||||||
rss item already but what can you do. I'll refactor I promise, I just need this done ASAP" ;Todo: do what the docstring says
|
[t host board] ;;NOW2 ;TODO: oh Luna the hardcodes ;;RESUME
|
||||||
[t] ;TODO: oh Luna the hardcodes ;;RESUME
|
|
||||||
(let [link-url (str "https://boards.4chan.org/mlp/thread/" (:no t))] ; jesus, well I said only /mlp/ is supported now so fuck it
|
(let [link-url (str "https://boards.4chan.org/mlp/thread/" (:no t))] ; jesus, well I said only /mlp/ is supported now so fuck it
|
||||||
{:title (format "%.2f%% - %s" (:chod t) (:title t)) ;TODO: Generate link from the target somehow, or just include it from API response
|
{:title (format "%.2f%% - %s" (:chod t) (:title t)) ;TODO: Generate link from the target somehow, or just include it from API response
|
||||||
;; :url link-url <- this is supposed to be for images according to: https://cyber.harvard.edu/rss/rss.html
|
;; :url link-url <- this is supposed to be for images according to: https://cyber.harvard.edu/rss/rss.html
|
||||||
|
@ -96,7 +95,7 @@
|
||||||
|
|
||||||
(defn generate-feed
|
(defn generate-feed
|
||||||
"Generates feed from matching items"
|
"Generates feed from matching items"
|
||||||
[query-vec chod-treshold repeat? cache]
|
[query-vec chod-treshold repeat? cache board-config]
|
||||||
(let [items (filter-chod-posts query-vec chod-treshold repeat? cache)
|
(let [items (filter-chod-posts query-vec chod-treshold repeat? cache)
|
||||||
head {:title "RSS Thread watcher v0.4.1" ;TODO: hardcoded string here, remake to reference to config.clj
|
head {:title "RSS Thread watcher v0.4.1" ;TODO: hardcoded string here, remake to reference to config.clj
|
||||||
:link "https://tools.treebrary.org/thread-watcher/feed.xml"
|
:link "https://tools.treebrary.org/thread-watcher/feed.xml"
|
||||||
|
@ -130,6 +129,7 @@
|
||||||
60 (Integer/parseInt chod))
|
60 (Integer/parseInt chod))
|
||||||
(catch Exception e
|
(catch Exception e
|
||||||
94)))
|
94)))
|
||||||
|
board-config (get )
|
||||||
cache @watcher/chod-threads-cache]
|
cache @watcher/chod-threads-cache]
|
||||||
(println "\n\nRCVD: " rqst)
|
(println "\n\nRCVD: " rqst)
|
||||||
;; (println rqst)
|
;; (println rqst)
|
||||||
|
@ -166,7 +166,7 @@
|
||||||
;; There shouldn't be any problems with this mime type but if there are
|
;; There shouldn't be any problems with this mime type but if there are
|
||||||
;; replace with "text/xml", or even better, get RSS reader that is not utter shit
|
;; replace with "text/xml", or even better, get RSS reader that is not utter shit
|
||||||
:header {"Content-Type" "application/rss+xml"}
|
:header {"Content-Type" "application/rss+xml"}
|
||||||
:body (generate-feed queries real-chod repeat? (watcher/get-thread-data board @watcher/GLOBAL-CONFIG))})
|
:body (generate-feed queries real-chod repeat? (watcher/get-thread-data board @watcher/GLOBAL-CONFIG))}) ;NOW3 give board specific config here
|
||||||
(catch Exception e
|
(catch Exception e
|
||||||
;; Ex-info has been crafted to match HTTP response body so we can send it
|
;; Ex-info has been crafted to match HTTP response body so we can send it
|
||||||
(if-let [caught (ex-data e)]
|
(if-let [caught (ex-data e)]
|
||||||
|
|
|
@ -47,6 +47,9 @@
|
||||||
(recur (rest remaining-threads)
|
(recur (rest remaining-threads)
|
||||||
threads-total
|
threads-total
|
||||||
(inc index)
|
(inc index)
|
||||||
|
;; NOW: Cache fomrat here
|
||||||
|
;; We have to somehow include URL which is a problem since the catalog does not contain any
|
||||||
|
;; I of course know how to craft it but the result will be kind of 4chan specific
|
||||||
(conj! ret {:title (or (:sub thread) ;We use thread title if thread has it
|
(conj! ret {:title (or (:sub thread) ;We use thread title if thread has it
|
||||||
(:com thread) ;we use body if thread has it
|
(:com thread) ;we use body if thread has it
|
||||||
"") ;Thread has neither, this prevents null pointer
|
"") ;Thread has neither, this prevents null pointer
|
||||||
|
|
Loading…
Reference in a new issue