Created
November 22, 2018 13:01
-
-
Save jackrusher/2a993ed218066823da1b6b24d81b7fa8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns livecode.flickr | |
(:require [datoteka.core :as fs] | |
[clojure.string :as cs] | |
[clojure.data.json :as json] | |
[hiccup.page :as hp] | |
[hiccup.core :as hc])) | |
(def json-files | |
(reduce | |
(fn [m file] | |
(assoc m (str file) (json/read (clojure.java.io/reader file) :key-fn keyword))) | |
{} | |
(fs/list-dir "data/flickr" "*json"))) | |
(def albums (:albums (get json-files "data/flickr/albums.json"))) | |
(defn photo-id->filename [id] | |
(str "data/flickr/photo_" id ".json")) | |
(spit "flickr.html" | |
(hp/html5 | |
(hc/html | |
(for [a albums] | |
[:div | |
[:h3 (:title a)] | |
(let [cover (last (cs/split (:cover_photo a) #"/"))] | |
[:img {:src (:original (json-files (photo-id->filename cover)))}])])))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment