aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/Resource.hs
diff options
context:
space:
mode:
authorpacien2019-12-31 00:16:29 +0100
committerpacien2019-12-31 00:16:29 +0100
commit9d2b6cf4641cfff08ad556d3a7b24d4d63464eb5 (patch)
tree374b88146cb32ea2b5ab8e8b7d613d16d65f0059 /compiler/src/Resource.hs
parentd0962ef2dea7e8a0c25ca8fdbc55fcbafeeb2f79 (diff)
downloadldgallery-9d2b6cf4641cfff08ad556d3a7b24d4d63464eb5.tar.gz
compiler: populate the properties field in the index
GitHub: closes #8
Diffstat (limited to 'compiler/src/Resource.hs')
-rw-r--r--compiler/src/Resource.hs10
1 files changed, 5 insertions, 5 deletions
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 @@
25 25
26module Resource 26module Resource
27 ( DirProcessor, ItemProcessor, ThumbnailProcessor 27 ( DirProcessor, ItemProcessor, ThumbnailProcessor
28 , GalleryItem, GalleryItemProps, Resolution(..) 28 , GalleryItem(..), GalleryItemProps(..), Resolution(..)
29 , buildGalleryTree, galleryCleanupResourceDir 29 , buildGalleryTree, galleryCleanupResourceDir
30 ) where 30 ) where
31 31
@@ -99,7 +99,7 @@ instance ToJSON GalleryItem where
99 99
100 100
101type DirProcessor = Path -> IO Path 101type DirProcessor = Path -> IO Path
102type ItemProcessor = Path -> IO Path 102type ItemProcessor = Path -> IO (Path, GalleryItemProps)
103type ThumbnailProcessor = Path -> IO (Maybe Path) 103type ThumbnailProcessor = Path -> IO (Maybe Path)
104 104
105 105
@@ -115,16 +115,16 @@ buildGalleryTree processDir processItem processThumbnail galleryName inputTree =
115 mkGalleryItem :: InputTree -> IO GalleryItem 115 mkGalleryItem :: InputTree -> IO GalleryItem
116 mkGalleryItem InputFile{path, sidecar} = 116 mkGalleryItem InputFile{path, sidecar} =
117 do 117 do
118 processedItem <- processItem path 118 (processedItemPath, properties) <- processItem path
119 processedThumbnail <- processThumbnail path 119 processedThumbnail <- processThumbnail path
120 return GalleryItem 120 return GalleryItem
121 { title = optMeta title $ fileName path 121 { title = optMeta title $ fileName path
122 , date = optMeta date "" -- TODO: check and normalise dates 122 , date = optMeta date "" -- TODO: check and normalise dates
123 , description = optMeta description "" 123 , description = optMeta description ""
124 , tags = optMeta tags [] 124 , tags = optMeta tags []
125 , path = processedItem 125 , path = processedItemPath
126 , thumbnail = processedThumbnail 126 , thumbnail = processedThumbnail
127 , properties = Other } -- TODO 127 , properties = properties } -- TODO
128 where 128 where
129 optMeta :: (Sidecar -> Maybe a) -> a -> a 129 optMeta :: (Sidecar -> Maybe a) -> a -> a
130 optMeta get fallback = fromMaybe fallback $ get sidecar 130 optMeta get fallback = fromMaybe fallback $ get sidecar