diff options
Diffstat (limited to 'compiler/src/Compiler.hs')
-rw-r--r-- | compiler/src/Compiler.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/src/Compiler.hs b/compiler/src/Compiler.hs index 1ec55c5..d92d8e9 100644 --- a/compiler/src/Compiler.hs +++ b/compiler/src/Compiler.hs | |||
@@ -85,7 +85,8 @@ loadGalleryIndex path = | |||
85 | doesFileExist path >>= bool (return Nothing) decodeIndex | 85 | doesFileExist path >>= bool (return Nothing) decodeIndex |
86 | where | 86 | where |
87 | decodeIndex = | 87 | decodeIndex = |
88 | JSON.eitherDecodeFileStrict path | 88 | putStrLn ("Loading previous index:\t" ++ path) |
89 | >> JSON.eitherDecodeFileStrict path | ||
89 | >>= either (\err -> warn err >> return Nothing) (return . Just) | 90 | >>= either (\err -> warn err >> return Nothing) (return . Just) |
90 | warn = putStrLn . ("Warning:\tUnable to reuse existing index as cache: " ++) | 91 | warn = putStrLn . ("Warning:\tUnable to reuse existing index as cache: " ++) |
91 | 92 | ||
@@ -136,10 +137,13 @@ compileGallery configPath inputDirPath outputDirPath outputIndexPath excludedDir | |||
136 | do | 137 | do |
137 | config <- readConfig $ inputGalleryConf configPath | 138 | config <- readConfig $ inputGalleryConf configPath |
138 | 139 | ||
140 | putStrLn "Inventorying input files" | ||
139 | inputDir <- readDirectory inputDirPath | 141 | inputDir <- readDirectory inputDirPath |
140 | excludedCanonicalDirs <- mapM canonicalizePath excludedDirs | 142 | excludedCanonicalDirs <- mapM canonicalizePath excludedDirs |
143 | |||
141 | let sourceFilter = galleryDirFilter config excludedCanonicalDirs | 144 | let sourceFilter = galleryDirFilter config excludedCanonicalDirs |
142 | let sourceTree = filterDir sourceFilter inputDir | 145 | let sourceTree = filterDir sourceFilter inputDir |
146 | putStrLn "Reading input metadata" | ||
143 | inputTree <- readInputTree sourceTree | 147 | inputTree <- readInputTree sourceTree |
144 | let curatedInputTree = filterInputTree (inputTreeFilter config) inputTree | 148 | let curatedInputTree = filterInputTree (inputTreeFilter config) inputTree |
145 | 149 | ||
@@ -147,8 +151,8 @@ compileGallery configPath inputDirPath outputDirPath outputIndexPath excludedDir | |||
147 | cachedIndex <- loadCachedIndex galleryIndexPath | 151 | cachedIndex <- loadCachedIndex galleryIndexPath |
148 | let cache = mkCache cachedIndex | 152 | let cache = mkCache cachedIndex |
149 | 153 | ||
150 | let itemProc = itemProcessor config (cache Resource.properties) | 154 | let itemProc = itemProcessor config (cache $ return . Resource.properties) |
151 | let thumbnailProc = thumbnailProcessor config (cache Resource.thumbnail) | 155 | let thumbnailProc = thumbnailProcessor config (cache $ fmap return . Resource.thumbnail) |
152 | let galleryBuilder = buildGalleryTree itemProc thumbnailProc (tagsFromDirectories config) | 156 | let galleryBuilder = buildGalleryTree itemProc thumbnailProc (tagsFromDirectories config) |
153 | resources <- galleryBuilder curatedInputTree | 157 | resources <- galleryBuilder curatedInputTree |
154 | 158 | ||
@@ -170,7 +174,7 @@ compileGallery configPath inputDirPath outputDirPath outputIndexPath excludedDir | |||
170 | then return Nothing | 174 | then return Nothing |
171 | else loadGalleryIndex galleryIndexPath | 175 | else loadGalleryIndex galleryIndexPath |
172 | 176 | ||
173 | mkCache :: Maybe GalleryIndex -> (GalleryItem -> a) -> Cache a | 177 | mkCache :: Maybe GalleryIndex -> (GalleryItem -> Maybe a) -> Cache a |
174 | mkCache refGalleryIndex = | 178 | mkCache refGalleryIndex = |
175 | if rebuildAll | 179 | if rebuildAll |
176 | then const noCache | 180 | then const noCache |