Skip to content

Commit

Permalink
updating with scheduling, only working in intellij, think the thread …
Browse files Browse the repository at this point in the history
…isn't getting hit with the println of the feed... might try another.
  • Loading branch information
xicubed committed Sep 18, 2013
1 parent 193c496 commit 33df706
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Atom & RSS parser for Clojure. Modified to post to a flipthis-webhook running on

## Usage

supports RSS 2.0
Supports RSS 2.0

e.g.

Expand Down
2 changes: 1 addition & 1 deletion lastrun.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Tue, 17 Sep 2013 16:47:57 +0000
Wed, 18 Sep 2013 21:15:44 +0000
26 changes: 24 additions & 2 deletions src/ariane/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,27 @@
[ariane.rss :as rss]
[ariane.atom :as atom]
[clj-time.core :as ct]
[clj-time.format :as ctf]))
[clj-time.format :as ctf]
[overtone.at-at :as ot]))


; scheduling
; set the feed you want to post
(def my-url "http://news.boisestate.edu/update/feed/")
(def my-pool (ot/mk-pool))
;; (ot/every 60000 (parse my-url) my-pool :desc "polls periodically")

;; scheduling stuff https://github.com/overtone/at-at




;(ot/show-schedule my-pool)

; to stop
; (overtone.at-at/stop-and-reset-pool! ariane.rss/my-pool)
; or force
; (overtone.at-at/stop-and-reset-pool! ariane.rss/my-pool :strategy :kill)

(defn- rss-feed?
[feed]
Expand All @@ -26,5 +44,9 @@
:else (println "Unsupported format")))
)

(defn runme
[]
(println (parse my-url)))
;(do (parse my-url)))


(ot/every 360000 runme my-pool :desc "polls periodically" :initial-delay 10000)
13 changes: 12 additions & 1 deletion src/ariane/rss.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
[clj-http.client :as client]
[clj-time.core :as ct]
[clj-time.format :as ctf]
[overtone.at-at :as ot]))
))








(def lastrun (atom (slurp "lastrun.txt") ))

Expand Down Expand Up @@ -50,6 +57,7 @@
(defn- infos
[root]


(reset! now (first (zipxml/xml-> root :lastBuildDate zipxml/text)) )
(spit "lastrun.txt" (first (zipxml/xml-> root :lastBuildDate zipxml/text)) )

Expand Down Expand Up @@ -78,6 +86,8 @@
nil
)



(defn parse-rss
"Parse Atom feed generated by ariane.core/parse. "
[feed]
Expand All @@ -87,3 +97,4 @@
:entries (entries channel)
})
)

0 comments on commit 33df706

Please sign in to comment.