diff options
Diffstat (limited to 'compiler/src')
-rw-r--r-- | compiler/src/Compiler.hs | 4 | ||||
-rw-r--r-- | compiler/src/Config.hs | 6 | ||||
-rw-r--r-- | compiler/src/Gallery.hs | 6 |
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 | |||
38 | import Config | 38 | import Config |
39 | import Input (decodeYamlFile, readInputTree) | 39 | import Input (decodeYamlFile, readInputTree) |
40 | import Resource (ResourceTree, buildResourceTree, cleanupResourceDir) | 40 | import Resource (ResourceTree, buildResourceTree, cleanupResourceDir) |
41 | import Gallery (buildGalleryTree) | 41 | import Gallery (buildGallery) |
42 | import Files | 42 | import 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 | ||
43 | data CompilerConfig = CompilerConfig | 43 | data 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 | ||
48 | instance FromJSON CompilerConfig where | 49 | instance 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 | ||
25 | module Gallery | 25 | module 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 | |||
132 | buildGallery :: String -> ResourceTree -> GalleryItem | ||
133 | buildGallery galleryName resourceTree = | ||
134 | (buildGalleryTree resourceTree) { title = galleryName } | ||