Skip to content

Commit e9da9fc

Browse files
author
Bastien Guerry
committed
src/consolidate-datacodegouvfr.clj: Output latest-sill.xml
1 parent f2060ad commit e9da9fc

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/consolidate-datacodegouvfr.clj

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
(def awesome-releases (atom ()))
2828

2929
(def urls {:hosts "https://data.code.gouv.fr/api/v1/hosts"
30+
:sill "https://code.gouv.fr/sill/api/sill.json"
3031
:annuaire_sup "https://code.gouv.fr/data/annuaire_sup.json"
3132
:annuaire_tops "https://code.gouv.fr/data/annuaire_tops.json"
3233
:comptes-organismes-publics "https://code.gouv.fr/data/comptes-organismes-publics.yml"
@@ -210,6 +211,23 @@
210211
json/generate-string
211212
(spit "owners.json")))
212213

214+
(defn output-latest-sill-xml []
215+
(->> (fetch-json (:sill urls))
216+
(sort-by #(java.util.Date. (:referencedSinceTime %)))
217+
reverse
218+
(take 10)
219+
(map #(let [link (str "https://code.gouv.fr/sill/detail?name=" (:name %))]
220+
{:title (str "Nouveau logiciel au SILL : " (:name %))
221+
:link link
222+
:guid link
223+
:description (:function %)
224+
:pubDate (.toInstant (java.util.Date. (:referencedSinceTime %)))}))
225+
(rss/channel-xml
226+
{:title "code.gouv.fr - Nouveaux logiciels libres au SILL - New SILL entries"
227+
:link "https://code.gouv.fr/data/latest-sill.xml"
228+
:description "code.gouv.fr - Nouveaux logiciels libres au SILL - New SILL entries"})
229+
(spit "latest-sill.xml")))
230+
213231
(defn output-latest-owners-xml []
214232
(->> @owners
215233
(filter #(:created_at (val %)))
@@ -393,7 +411,8 @@
393411
(set-awesome-releases!)
394412
(update-awesome!))
395413
(output-owners-json)
396-
(when-not only-owners
414+
(when-not only-owners
415+
(output-latest-sill-xml)
397416
(output-latest-owners-xml)
398417
(output-repositories-json)
399418
(output-latest-repositories-xml)

0 commit comments

Comments
 (0)