14 lines
441 B
Clojure
14 lines
441 B
Clojure
|
(ns yenu.db.migration
|
||
|
(:require [yenu.helpers.images :as image]
|
||
|
[me.raynes.fs :as fs]
|
||
|
[yenu.db.core :as db]))
|
||
|
|
||
|
(defn migrate-image [image-path]
|
||
|
(let [new-id (fs/base-name image-path true)
|
||
|
hash (image/scale-image-and-save image-path)]
|
||
|
(db/set-image-hash {:hash hash :id new-id})))
|
||
|
|
||
|
(defn start-migration []
|
||
|
(let [images (fs/list-dir (image/data-path "to-process"))]
|
||
|
(run! migrate-image images)))
|