From 987eb81cb5d98262299c7917d752c54907cbbc33 Mon Sep 17 00:00:00 2001 From: pacien Date: Thu, 23 Jan 2020 22:36:21 +0100 Subject: compiler: add directory incl and excl glob settings GitHub: closes #41 --- compiler/src/Config.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'compiler/src/Config.hs') diff --git a/compiler/src/Config.hs b/compiler/src/Config.hs index 53333a5..d670aae 100644 --- a/compiler/src/Config.hs +++ b/compiler/src/Config.hs @@ -34,8 +34,10 @@ import Resource (Resolution(..)) data CompilerConfig = CompilerConfig { galleryName :: String - , includeFiles :: [String] - , excludeFiles :: [String] + , includedDirectories :: [String] + , excludedDirectories :: [String] + , includedFiles :: [String] + , excludedFiles :: [String] , tagsFromDirectories :: Int , thumbnailMaxResolution :: Resolution , pictureMaxResolution :: Maybe Resolution @@ -44,8 +46,10 @@ data CompilerConfig = CompilerConfig instance FromJSON CompilerConfig where parseJSON = withObject "CompilerConfig" $ \v -> CompilerConfig <$> v .:? "galleryName" .!= "Gallery" - <*> v .:? "includeFiles" .!= ["*"] - <*> v .:? "excludeFiles" .!= [] + <*> v .:? "includedDirectories" .!= ["*"] + <*> v .:? "excludedDirectories" .!= [] + <*> v .:? "includedFiles" .!= ["*"] + <*> v .:? "excludedFiles" .!= [] <*> v .:? "tagsFromDirectories" .!= 0 <*> v .:? "thumbnailMaxResolution" .!= (Resolution 400 400) <*> v .:? "pictureMaxResolution" -- cgit v1.2.3 From cf91102432b1196b8f3c1fa388b3963948ad49a6 Mon Sep 17 00:00:00 2001 From: pacien Date: Thu, 23 Jan 2020 23:16:07 +0100 Subject: compiler: add jpeg export quality setting GitHub: closes #2 --- compiler/src/Config.hs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'compiler/src/Config.hs') diff --git a/compiler/src/Config.hs b/compiler/src/Config.hs index d670aae..4446c14 100644 --- a/compiler/src/Config.hs +++ b/compiler/src/Config.hs @@ -41,6 +41,7 @@ data CompilerConfig = CompilerConfig , tagsFromDirectories :: Int , thumbnailMaxResolution :: Resolution , pictureMaxResolution :: Maybe Resolution + , jpegExportQuality :: Int } deriving (Generic, Show) instance FromJSON CompilerConfig where @@ -53,6 +54,7 @@ instance FromJSON CompilerConfig where <*> v .:? "tagsFromDirectories" .!= 0 <*> v .:? "thumbnailMaxResolution" .!= (Resolution 400 400) <*> v .:? "pictureMaxResolution" + <*> v .:? "jpegExportQuality" .!= 80 data GalleryConfig = GalleryConfig -- cgit v1.2.3 From c05cbe525ad44273cc1b9b58549af757f549dcb7 Mon Sep 17 00:00:00 2001 From: pacien Date: Mon, 27 Jan 2020 14:29:47 +0100 Subject: compiler: switch to imagemagick Use ImageMagick to resize images instead of JuicyPixels, using the superior Lanczos resampling and cutting memory usage. This requires ImageMagick to be installed on the host system and the `magick` executable to be present in the PATH. GitHub: closes #49 --- compiler/src/Config.hs | 2 -- 1 file changed, 2 deletions(-) (limited to 'compiler/src/Config.hs') diff --git a/compiler/src/Config.hs b/compiler/src/Config.hs index 4446c14..d670aae 100644 --- a/compiler/src/Config.hs +++ b/compiler/src/Config.hs @@ -41,7 +41,6 @@ data CompilerConfig = CompilerConfig , tagsFromDirectories :: Int , thumbnailMaxResolution :: Resolution , pictureMaxResolution :: Maybe Resolution - , jpegExportQuality :: Int } deriving (Generic, Show) instance FromJSON CompilerConfig where @@ -54,7 +53,6 @@ instance FromJSON CompilerConfig where <*> v .:? "tagsFromDirectories" .!= 0 <*> v .:? "thumbnailMaxResolution" .!= (Resolution 400 400) <*> v .:? "pictureMaxResolution" - <*> v .:? "jpegExportQuality" .!= 80 data GalleryConfig = GalleryConfig -- cgit v1.2.3 From a524bc557ee154d5880153d9b8da680e0b5f3e85 Mon Sep 17 00:00:00 2001 From: pacien Date: Sun, 2 Feb 2020 20:58:10 +0100 Subject: compiler: tweak default thumbnail size For better packing. --- compiler/src/Config.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/src/Config.hs') diff --git a/compiler/src/Config.hs b/compiler/src/Config.hs index d670aae..4c9aa40 100644 --- a/compiler/src/Config.hs +++ b/compiler/src/Config.hs @@ -51,7 +51,7 @@ instance FromJSON CompilerConfig where <*> v .:? "includedFiles" .!= ["*"] <*> v .:? "excludedFiles" .!= [] <*> v .:? "tagsFromDirectories" .!= 0 - <*> v .:? "thumbnailMaxResolution" .!= (Resolution 400 400) + <*> v .:? "thumbnailMaxResolution" .!= (Resolution 400 300) <*> v .:? "pictureMaxResolution" -- cgit v1.2.3 From 395a76bc4193c0c7182f87778458a68d0079e836 Mon Sep 17 00:00:00 2001 From: pacien Date: Fri, 14 Feb 2020 15:39:56 +0100 Subject: compiler: metadata sidecar for whole directories GitHub: closes #3 --- compiler/src/Config.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'compiler/src/Config.hs') diff --git a/compiler/src/Config.hs b/compiler/src/Config.hs index 4c9aa40..4826f17 100644 --- a/compiler/src/Config.hs +++ b/compiler/src/Config.hs @@ -33,8 +33,7 @@ import Resource (Resolution(..)) data CompilerConfig = CompilerConfig - { galleryName :: String - , includedDirectories :: [String] + { includedDirectories :: [String] , excludedDirectories :: [String] , includedFiles :: [String] , excludedFiles :: [String] @@ -45,8 +44,7 @@ data CompilerConfig = CompilerConfig instance FromJSON CompilerConfig where parseJSON = withObject "CompilerConfig" $ \v -> CompilerConfig - <$> v .:? "galleryName" .!= "Gallery" - <*> v .:? "includedDirectories" .!= ["*"] + <$> v .:? "includedDirectories" .!= ["*"] <*> v .:? "excludedDirectories" .!= [] <*> v .:? "includedFiles" .!= ["*"] <*> v .:? "excludedFiles" .!= [] -- cgit v1.2.3 From 68899f0c1ba4f641c376fda1e51d9694b02b9c5d Mon Sep 17 00:00:00 2001 From: pacien Date: Mon, 17 Feb 2020 18:09:20 +0100 Subject: compiler: add a prefix setting for tags generated from parent dirs GitHub: closes #59 --- compiler/src/Config.hs | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'compiler/src/Config.hs') diff --git a/compiler/src/Config.hs b/compiler/src/Config.hs index 4826f17..bf5a28e 100644 --- a/compiler/src/Config.hs +++ b/compiler/src/Config.hs @@ -19,17 +19,24 @@ module Config ( GalleryConfig(..) , CompilerConfig(..) + , TagsFromDirectoriesConfig(..) + , Resolution(..) , readConfig ) where import GHC.Generics (Generic) -import Data.Aeson (FromJSON, withObject, (.:?), (.!=)) +import Data.Aeson (ToJSON, FromJSON, withObject, (.:?), (.!=)) import qualified Data.Aeson as JSON import Files (FileName) import Input (decodeYamlFile) -import Resource (Resolution(..)) + + +data Resolution = Resolution + { width :: Int + , height :: Int + } deriving (Generic, Show, ToJSON, FromJSON) data CompilerConfig = CompilerConfig @@ -37,7 +44,7 @@ data CompilerConfig = CompilerConfig , excludedDirectories :: [String] , includedFiles :: [String] , excludedFiles :: [String] - , tagsFromDirectories :: Int + , tagsFromDirectories :: TagsFromDirectoriesConfig , thumbnailMaxResolution :: Resolution , pictureMaxResolution :: Maybe Resolution } deriving (Generic, Show) @@ -48,11 +55,22 @@ instance FromJSON CompilerConfig where <*> v .:? "excludedDirectories" .!= [] <*> v .:? "includedFiles" .!= ["*"] <*> v .:? "excludedFiles" .!= [] - <*> v .:? "tagsFromDirectories" .!= 0 + <*> v .:? "tagsFromDirectories" .!= (TagsFromDirectoriesConfig 0 "") <*> v .:? "thumbnailMaxResolution" .!= (Resolution 400 300) <*> v .:? "pictureMaxResolution" +data TagsFromDirectoriesConfig = TagsFromDirectoriesConfig + { fromParents :: Int + , prefix :: String + } deriving (Generic, Show) + +instance FromJSON TagsFromDirectoriesConfig where + parseJSON = withObject "TagsFromDirectoriesConfig" $ \v -> TagsFromDirectoriesConfig + <$> v .:? "fromParents" .!= 0 + <*> v .:? "prefix" .!= "" + + data GalleryConfig = GalleryConfig { compiler :: CompilerConfig , viewer :: JSON.Object -- cgit v1.2.3 From e42f4e864bac21ed3b19d1869df2cdd4f8c3433c Mon Sep 17 00:00:00 2001 From: pacien Date: Sat, 22 Feb 2020 14:53:03 +0100 Subject: compiler: flatten gallery config GitHub: closes #129 --- compiler/src/Config.hs | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'compiler/src/Config.hs') diff --git a/compiler/src/Config.hs b/compiler/src/Config.hs index bf5a28e..5f1806d 100644 --- a/compiler/src/Config.hs +++ b/compiler/src/Config.hs @@ -17,11 +17,10 @@ -- along with this program. If not, see . module Config - ( GalleryConfig(..) - , CompilerConfig(..) + ( GalleryConfig(..), readConfig + , ViewerConfig(..), viewerConfig , TagsFromDirectoriesConfig(..) , Resolution(..) - , readConfig ) where @@ -39,7 +38,18 @@ data Resolution = Resolution } deriving (Generic, Show, ToJSON, FromJSON) -data CompilerConfig = CompilerConfig +data TagsFromDirectoriesConfig = TagsFromDirectoriesConfig + { fromParents :: Int + , prefix :: String + } deriving (Generic, Show) + +instance FromJSON TagsFromDirectoriesConfig where + parseJSON = withObject "TagsFromDirectoriesConfig" $ \v -> TagsFromDirectoriesConfig + <$> v .:? "fromParents" .!= 0 + <*> v .:? "prefix" .!= "" + + +data GalleryConfig = GalleryConfig { includedDirectories :: [String] , excludedDirectories :: [String] , includedFiles :: [String] @@ -49,8 +59,8 @@ data CompilerConfig = CompilerConfig , pictureMaxResolution :: Maybe Resolution } deriving (Generic, Show) -instance FromJSON CompilerConfig where - parseJSON = withObject "CompilerConfig" $ \v -> CompilerConfig +instance FromJSON GalleryConfig where + parseJSON = withObject "GalleryConfig" $ \v -> GalleryConfig <$> v .:? "includedDirectories" .!= ["*"] <*> v .:? "excludedDirectories" .!= [] <*> v .:? "includedFiles" .!= ["*"] @@ -59,22 +69,13 @@ instance FromJSON CompilerConfig where <*> v .:? "thumbnailMaxResolution" .!= (Resolution 400 300) <*> v .:? "pictureMaxResolution" - -data TagsFromDirectoriesConfig = TagsFromDirectoriesConfig - { fromParents :: Int - , prefix :: String - } deriving (Generic, Show) - -instance FromJSON TagsFromDirectoriesConfig where - parseJSON = withObject "TagsFromDirectoriesConfig" $ \v -> TagsFromDirectoriesConfig - <$> v .:? "fromParents" .!= 0 - <*> v .:? "prefix" .!= "" +readConfig :: FileName -> IO GalleryConfig +readConfig = decodeYamlFile -data GalleryConfig = GalleryConfig - { compiler :: CompilerConfig - , viewer :: JSON.Object - } deriving (Generic, FromJSON, Show) +data ViewerConfig = ViewerConfig + { -- TODO: add viewer config keys (tag groups...) + } deriving (Generic, ToJSON, Show) -readConfig :: FileName -> IO GalleryConfig -readConfig = decodeYamlFile +viewerConfig :: GalleryConfig -> ViewerConfig +viewerConfig _ = ViewerConfig -- TODO -- cgit v1.2.3 From b468dcbf3343ea251703078ec89d3215116fc2f6 Mon Sep 17 00:00:00 2001 From: pacien Date: Tue, 25 Feb 2020 19:25:16 +0100 Subject: compiler: re-introduce gallery title --- compiler/src/Config.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'compiler/src/Config.hs') diff --git a/compiler/src/Config.hs b/compiler/src/Config.hs index 5f1806d..1bdb2b8 100644 --- a/compiler/src/Config.hs +++ b/compiler/src/Config.hs @@ -50,7 +50,8 @@ instance FromJSON TagsFromDirectoriesConfig where data GalleryConfig = GalleryConfig - { includedDirectories :: [String] + { galleryTitle :: String + , includedDirectories :: [String] , excludedDirectories :: [String] , includedFiles :: [String] , excludedFiles :: [String] @@ -61,7 +62,8 @@ data GalleryConfig = GalleryConfig instance FromJSON GalleryConfig where parseJSON = withObject "GalleryConfig" $ \v -> GalleryConfig - <$> v .:? "includedDirectories" .!= ["*"] + <$> v .:? "galleryTitle" .!= "ldgallery" + <*> v .:? "includedDirectories" .!= ["*"] <*> v .:? "excludedDirectories" .!= [] <*> v .:? "includedFiles" .!= ["*"] <*> v .:? "excludedFiles" .!= [] @@ -75,7 +77,8 @@ readConfig = decodeYamlFile data ViewerConfig = ViewerConfig { -- TODO: add viewer config keys (tag groups...) + galleryTitle :: String } deriving (Generic, ToJSON, Show) viewerConfig :: GalleryConfig -> ViewerConfig -viewerConfig _ = ViewerConfig -- TODO +viewerConfig GalleryConfig{galleryTitle} = ViewerConfig galleryTitle -- cgit v1.2.3 From f09e9d9fa29284bd9ae872efe5ba1d526e349011 Mon Sep 17 00:00:00 2001 From: pacien Date: Wed, 26 Feb 2020 22:13:00 +0100 Subject: compiler: add tag inclusion and exclusion globs GitHub: closes #30 --- compiler/src/Config.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'compiler/src/Config.hs') diff --git a/compiler/src/Config.hs b/compiler/src/Config.hs index 1bdb2b8..8796c3c 100644 --- a/compiler/src/Config.hs +++ b/compiler/src/Config.hs @@ -55,6 +55,8 @@ data GalleryConfig = GalleryConfig , excludedDirectories :: [String] , includedFiles :: [String] , excludedFiles :: [String] + , includedTags :: [String] + , excludedTags :: [String] , tagsFromDirectories :: TagsFromDirectoriesConfig , thumbnailMaxResolution :: Resolution , pictureMaxResolution :: Maybe Resolution @@ -67,6 +69,8 @@ instance FromJSON GalleryConfig where <*> v .:? "excludedDirectories" .!= [] <*> v .:? "includedFiles" .!= ["*"] <*> v .:? "excludedFiles" .!= [] + <*> v .:? "includedTags" .!= ["*"] + <*> v .:? "excludedTags" .!= [] <*> v .:? "tagsFromDirectories" .!= (TagsFromDirectoriesConfig 0 "") <*> v .:? "thumbnailMaxResolution" .!= (Resolution 400 300) <*> v .:? "pictureMaxResolution" -- cgit v1.2.3 From 54790c6c73d7c51ff22cf5e9722b141cdc0249df Mon Sep 17 00:00:00 2001 From: pacien Date: Sat, 29 Feb 2020 16:39:55 +0100 Subject: compiler: add tagCategories setting to gallery.yaml --- compiler/src/Config.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'compiler/src/Config.hs') diff --git a/compiler/src/Config.hs b/compiler/src/Config.hs index 8796c3c..0ae0fa1 100644 --- a/compiler/src/Config.hs +++ b/compiler/src/Config.hs @@ -57,6 +57,7 @@ data GalleryConfig = GalleryConfig , excludedFiles :: [String] , includedTags :: [String] , excludedTags :: [String] + , tagCategories :: [String] , tagsFromDirectories :: TagsFromDirectoriesConfig , thumbnailMaxResolution :: Resolution , pictureMaxResolution :: Maybe Resolution @@ -71,6 +72,7 @@ instance FromJSON GalleryConfig where <*> v .:? "excludedFiles" .!= [] <*> v .:? "includedTags" .!= ["*"] <*> v .:? "excludedTags" .!= [] + <*> v .:? "tagCategories" .!= [] <*> v .:? "tagsFromDirectories" .!= (TagsFromDirectoriesConfig 0 "") <*> v .:? "thumbnailMaxResolution" .!= (Resolution 400 300) <*> v .:? "pictureMaxResolution" @@ -80,9 +82,9 @@ readConfig = decodeYamlFile data ViewerConfig = ViewerConfig - { -- TODO: add viewer config keys (tag groups...) - galleryTitle :: String + { galleryTitle :: String + , tagCategories :: [String] } deriving (Generic, ToJSON, Show) viewerConfig :: GalleryConfig -> ViewerConfig -viewerConfig GalleryConfig{galleryTitle} = ViewerConfig galleryTitle +viewerConfig GalleryConfig{galleryTitle, tagCategories} = ViewerConfig galleryTitle tagCategories -- cgit v1.2.3