From d0962ef2dea7e8a0c25ca8fdbc55fcbafeeb2f79 Mon Sep 17 00:00:00 2001 From: pacien Date: Mon, 30 Dec 2019 23:18:49 +0100 Subject: compiler: refactor resource transformation pipeline --- compiler/src/Compiler.hs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'compiler/src/Compiler.hs') 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 import Config import Input (decodeYamlFile, readInputTree) -import Resource (ResourceTree, buildResourceTree, cleanupResourceDir) -import Gallery (buildGallery) +import Resource (GalleryItem, buildGalleryTree, galleryCleanupResourceDir) import Files ( FileName , FSNode(..) @@ -75,17 +74,15 @@ compileGallery inputDirPath outputDirPath rebuildAll = invalidateCache <- isOutdated False inputGalleryConf outputIndex let cache = if invalidateCache || rebuildAll then skipCached else withCached + let itemProc = itemProcessor (pictureMaxResolution config) cache let thumbnailProc = thumbnailProcessor (thumbnailResolution config) cache - resourceTree <- buildResourceTree dirProcessor itemProc thumbnailProc inputTree - - cleanupResourceDir resourceTree outputDirPath - - buildGallery (galleryName config) resourceTree - & writeJSON outputIndex + let galleryBuilder = buildGalleryTree dirProcessor itemProc thumbnailProc + resources <- galleryBuilder (galleryName config) inputTree - viewer fullConfig - & writeJSON outputViewerConf + galleryCleanupResourceDir resources outputDirPath + writeJSON outputIndex resources + writeJSON outputViewerConf $ viewer fullConfig where galleryConf = "gallery.yaml" -- cgit v1.2.3