aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/Compiler.hs
diff options
context:
space:
mode:
authorpacien2019-12-30 23:18:49 +0100
committerpacien2019-12-30 23:18:49 +0100
commitd0962ef2dea7e8a0c25ca8fdbc55fcbafeeb2f79 (patch)
tree16c4909877b94fabb735e9ef1437b57628d878c5 /compiler/src/Compiler.hs
parent8a75458290002c765a0fa673912c162020de2bd1 (diff)
downloadldgallery-d0962ef2dea7e8a0c25ca8fdbc55fcbafeeb2f79.tar.gz
compiler: refactor resource transformation pipeline
Diffstat (limited to 'compiler/src/Compiler.hs')
-rw-r--r--compiler/src/Compiler.hs17
1 files changed, 7 insertions, 10 deletions
diff --git a/compiler/src/Compiler.hs b/compiler/src/Compiler.hs
index 0a3e540..048afc1 100644
--- a/compiler/src/Compiler.hs
+++ b/compiler/src/Compiler.hs
@@ -37,8 +37,7 @@ import qualified Data.Aeson as JSON
37 37
38import Config 38import Config
39import Input (decodeYamlFile, readInputTree) 39import Input (decodeYamlFile, readInputTree)
40import Resource (ResourceTree, buildResourceTree, cleanupResourceDir) 40import Resource (GalleryItem, buildGalleryTree, galleryCleanupResourceDir)
41import Gallery (buildGallery)
42import Files 41import Files
43 ( FileName 42 ( FileName
44 , FSNode(..) 43 , FSNode(..)
@@ -75,17 +74,15 @@ compileGallery inputDirPath outputDirPath rebuildAll =
75 74
76 invalidateCache <- isOutdated False inputGalleryConf outputIndex 75 invalidateCache <- isOutdated False inputGalleryConf outputIndex
77 let cache = if invalidateCache || rebuildAll then skipCached else withCached 76 let cache = if invalidateCache || rebuildAll then skipCached else withCached
77
78 let itemProc = itemProcessor (pictureMaxResolution config) cache 78 let itemProc = itemProcessor (pictureMaxResolution config) cache
79 let thumbnailProc = thumbnailProcessor (thumbnailResolution config) cache 79 let thumbnailProc = thumbnailProcessor (thumbnailResolution config) cache
80 resourceTree <- buildResourceTree dirProcessor itemProc thumbnailProc inputTree 80 let galleryBuilder = buildGalleryTree dirProcessor itemProc thumbnailProc
81 81 resources <- galleryBuilder (galleryName config) inputTree
82 cleanupResourceDir resourceTree outputDirPath
83
84 buildGallery (galleryName config) resourceTree
85 & writeJSON outputIndex
86 82
87 viewer fullConfig 83 galleryCleanupResourceDir resources outputDirPath
88 & writeJSON outputViewerConf 84 writeJSON outputIndex resources
85 writeJSON outputViewerConf $ viewer fullConfig
89 86
90 where 87 where
91 galleryConf = "gallery.yaml" 88 galleryConf = "gallery.yaml"