31 lines
1.6 KiB
Clojure
31 lines
1.6 KiB
Clojure
(ns dhyan.main
|
|
(:require [dhyan.connections.shaarli :as shaarli]
|
|
[dhyan.connections.wallabag :as wallabag]
|
|
[clojure.string :as string]
|
|
[dhyan.connections.matrix :as matrix]))
|
|
|
|
(defn -main
|
|
[& _args]
|
|
(matrix/setup)
|
|
(let [shaarli-data (shaarli/get-all-shaarli-music-data)
|
|
; filter to bandcamp (and maybe others?)
|
|
filtered-shaarli-data (shaarli/url-filterer shaarli-data "bandcamp")
|
|
album-of-the-day (->> filtered-shaarli-data
|
|
(mapv #(select-keys % [:url :title]))
|
|
rand-nth)
|
|
shaarli-message (str "Album of the day is: " (get album-of-the-day :title)
|
|
" available at: " (get album-of-the-day :url))
|
|
wallabag-data (wallabag/get-archived-annotated-entries)
|
|
wallabag-entry-of-the-day (rand-nth wallabag-data)
|
|
wallabag-annotation-of-the-day (rand-nth wallabag-entry-of-the-day)
|
|
wallabag-message (str "Annotation of the day: " wallabag-annotation-of-the-day
|
|
" from the article: " (get wallabag-entry-of-the-day :title)
|
|
" available at: " (get wallabag-entry-of-the-day :url)
|
|
" tagged as: " (string/join ", " (get wallabag-entry-of-the-day :tags)))
|
|
message (string/join "\n" [shaarli-message wallabag-message])
|
|
;file-data (sh "ls" (System/getenv "folder"))
|
|
; remove anything in () [] {}
|
|
;filtered-file-data (filterv #(string/replace % #"(.*)" "") file-data)
|
|
]
|
|
(matrix/post-message message)))
|