From 9d2b6cf4641cfff08ad556d3a7b24d4d63464eb5 Mon Sep 17 00:00:00 2001 From: pacien Date: Tue, 31 Dec 2019 00:16:29 +0100 Subject: compiler: populate the properties field in the index GitHub: closes #8 --- compiler/src/Resource.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'compiler/src/Resource.hs') diff --git a/compiler/src/Resource.hs b/compiler/src/Resource.hs index dcf9422..bffa569 100644 --- a/compiler/src/Resource.hs +++ b/compiler/src/Resource.hs @@ -25,7 +25,7 @@ module Resource ( DirProcessor, ItemProcessor, ThumbnailProcessor - , GalleryItem, GalleryItemProps, Resolution(..) + , GalleryItem(..), GalleryItemProps(..), Resolution(..) , buildGalleryTree, galleryCleanupResourceDir ) where @@ -99,7 +99,7 @@ instance ToJSON GalleryItem where type DirProcessor = Path -> IO Path -type ItemProcessor = Path -> IO Path +type ItemProcessor = Path -> IO (Path, GalleryItemProps) type ThumbnailProcessor = Path -> IO (Maybe Path) @@ -115,16 +115,16 @@ buildGalleryTree processDir processItem processThumbnail galleryName inputTree = mkGalleryItem :: InputTree -> IO GalleryItem mkGalleryItem InputFile{path, sidecar} = do - processedItem <- processItem path + (processedItemPath, properties) <- processItem path processedThumbnail <- processThumbnail path return GalleryItem { title = optMeta title $ fileName path , date = optMeta date "" -- TODO: check and normalise dates , description = optMeta description "" , tags = optMeta tags [] - , path = processedItem + , path = processedItemPath , thumbnail = processedThumbnail - , properties = Other } -- TODO + , properties = properties } -- TODO where optMeta :: (Sidecar -> Maybe a) -> a -> a optMeta get fallback = fromMaybe fallback $ get sidecar -- cgit v1.2.3