diff options
Diffstat (limited to 'compiler/src/Resource.hs')
-rw-r--r-- | compiler/src/Resource.hs | 10 |
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 | ||
26 | module Resource | 26 | module 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 | ||
101 | type DirProcessor = Path -> IO Path | 101 | type DirProcessor = Path -> IO Path |
102 | type ItemProcessor = Path -> IO Path | 102 | type ItemProcessor = Path -> IO (Path, GalleryItemProps) |
103 | type ThumbnailProcessor = Path -> IO (Maybe Path) | 103 | type 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 |