From 74e4a83ac7511086f45d2fa9880b7ae5728020bd Mon Sep 17 00:00:00 2001 From: pacien Date: Tue, 25 Feb 2020 20:19:54 +0100 Subject: compiler: add cli arg for output gallery index GitHub: closes #143 --- compiler/src/Compiler.hs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'compiler/src/Compiler.hs') diff --git a/compiler/src/Compiler.hs b/compiler/src/Compiler.hs index 2970102..51f5065 100644 --- a/compiler/src/Compiler.hs +++ b/compiler/src/Compiler.hs @@ -51,8 +51,8 @@ import Processors defaultGalleryConf :: String defaultGalleryConf = "gallery.yaml" -indexFile :: String -indexFile = "index.json" +defaultIndexFile :: String +defaultIndexFile = "index.json" itemsDir :: String itemsDir = "items" @@ -103,8 +103,8 @@ galleryDirFilter config excludedCanonicalDirs = isExcludedDir File{} = False -compileGallery :: FilePath -> FilePath -> FilePath -> [FilePath] -> Bool -> Bool -> IO () -compileGallery configPath inputDirPath outputDirPath excludedDirs rebuildAll cleanOutput = +compileGallery :: FilePath -> FilePath -> FilePath -> FilePath -> [FilePath] -> Bool -> Bool -> IO () +compileGallery configPath inputDirPath outputDirPath outputIndexPath excludedDirs rebuildAll cleanOutput = do config <- readConfig $ inputGalleryConf configPath @@ -121,13 +121,17 @@ compileGallery configPath inputDirPath outputDirPath excludedDirs rebuildAll cle resources <- galleryBuilder inputTree when cleanOutput $ galleryCleanupResourceDir resources outputDirPath - writeJSON (outputDirPath indexFile) $ GalleryIndex (viewerConfig config) resources + writeJSON (outputGalleryIndex outputIndexPath) $ GalleryIndex (viewerConfig config) resources where inputGalleryConf :: FilePath -> FilePath inputGalleryConf "" = inputDirPath defaultGalleryConf inputGalleryConf file = file + outputGalleryIndex :: FilePath -> FilePath + outputGalleryIndex "" = outputDirPath defaultIndexFile + outputGalleryIndex file = file + itemProcessor config cache = itemFileProcessor (pictureMaxResolution config) cache -- cgit v1.2.3