aboutsummaryrefslogtreecommitdiff
path: root/compiler/src
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/src')
-rw-r--r--compiler/src/Compiler.hs4
-rw-r--r--compiler/src/Config.hs6
-rw-r--r--compiler/src/Gallery.hs6
3 files changed, 11 insertions, 5 deletions
diff --git a/compiler/src/Compiler.hs b/compiler/src/Compiler.hs
index 2584570..dbe6cae 100644
--- a/compiler/src/Compiler.hs
+++ b/compiler/src/Compiler.hs
@@ -38,7 +38,7 @@ import qualified Data.Aeson as JSON
38import Config 38import Config
39import Input (decodeYamlFile, readInputTree) 39import Input (decodeYamlFile, readInputTree)
40import Resource (ResourceTree, buildResourceTree, cleanupResourceDir) 40import Resource (ResourceTree, buildResourceTree, cleanupResourceDir)
41import Gallery (buildGalleryTree) 41import Gallery (buildGallery)
42import Files 42import Files
43 ( FileName 43 ( FileName
44 , FSNode(..) 44 , FSNode(..)
@@ -81,7 +81,7 @@ compileGallery inputDirPath outputDirPath rebuildAll =
81 81
82 cleanupResourceDir resourceTree outputDirPath 82 cleanupResourceDir resourceTree outputDirPath
83 83
84 buildGalleryTree resourceTree 84 buildGallery (galleryName config) resourceTree
85 & writeJSON outputIndex 85 & writeJSON outputIndex
86 86
87 viewer fullConfig 87 viewer fullConfig
diff --git a/compiler/src/Config.hs b/compiler/src/Config.hs
index fe981c3..044a155 100644
--- a/compiler/src/Config.hs
+++ b/compiler/src/Config.hs
@@ -41,13 +41,15 @@ import Processors (Resolution(..))
41 41
42 42
43data CompilerConfig = CompilerConfig 43data CompilerConfig = CompilerConfig
44 { thumbnailResolution :: Resolution 44 { galleryName :: String
45 , thumbnailResolution :: Resolution
45 , pictureMaxResolution :: Maybe Resolution 46 , pictureMaxResolution :: Maybe Resolution
46 } deriving (Generic, Show) 47 } deriving (Generic, Show)
47 48
48instance FromJSON CompilerConfig where 49instance FromJSON CompilerConfig where
49 parseJSON = withObject "CompilerConfig" $ \v -> CompilerConfig 50 parseJSON = withObject "CompilerConfig" $ \v -> CompilerConfig
50 <$> v .:? "thumbnailResolution" .!= (Resolution 400 400) 51 <$> v .:? "galleryName" .!= "Gallery"
52 <*> v .:? "thumbnailResolution" .!= (Resolution 400 400)
51 <*> v .:? "pictureMaxResolution" 53 <*> v .:? "pictureMaxResolution"
52 54
53 55
diff --git a/compiler/src/Gallery.hs b/compiler/src/Gallery.hs
index f12eddb..1fa4036 100644
--- a/compiler/src/Gallery.hs
+++ b/compiler/src/Gallery.hs
@@ -23,7 +23,7 @@
23#-} 23#-}
24 24
25module Gallery 25module Gallery
26 ( GalleryItem(..), buildGalleryTree 26 ( GalleryItem(..), buildGallery
27 ) where 27 ) where
28 28
29 29
@@ -128,3 +128,7 @@ buildGalleryTree (DirResource dirItems path@(dirname:_) thumbnail) =
128 128
129 unique :: Ord a => [a] -> [a] 129 unique :: Ord a => [a] -> [a]
130 unique = Set.toList . Set.fromList 130 unique = Set.toList . Set.fromList
131
132buildGallery :: String -> ResourceTree -> GalleryItem
133buildGallery galleryName resourceTree =
134 (buildGalleryTree resourceTree) { title = galleryName }