aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/Processors.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/src/Processors.hs')
-rw-r--r--compiler/src/Processors.hs10
1 files changed, 4 insertions, 6 deletions
diff --git a/compiler/src/Processors.hs b/compiler/src/Processors.hs
index 7362822..ded3cc5 100644
--- a/compiler/src/Processors.hs
+++ b/compiler/src/Processors.hs
@@ -59,8 +59,8 @@ data Format =
59 | Gif -- TODO: might be animated 59 | Gif -- TODO: might be animated
60 | Other 60 | Other
61 61
62formatFromExt :: String -> Format 62formatFromPath :: Path -> Format
63formatFromExt = aux . (map toLower) 63formatFromPath = aux . (map toLower) . fileName
64 where 64 where
65 aux ".bmp" = Bmp 65 aux ".bmp" = Bmp
66 aux ".jpg" = Jpg 66 aux ".jpg" = Jpg
@@ -169,10 +169,9 @@ type ItemFileProcessor =
169 169
170itemFileProcessor :: Maybe Resolution -> Cache -> ItemFileProcessor 170itemFileProcessor :: Maybe Resolution -> Cache -> ItemFileProcessor
171itemFileProcessor maxRes cached inputBase outputBase resClass inputRes = 171itemFileProcessor maxRes cached inputBase outputBase resClass inputRes =
172 cached (processor maxRes (extOf inputRes)) inPath outPath 172 cached (processor maxRes (formatFromPath inputRes)) inPath outPath
173 >> return relOutPath 173 >> return relOutPath
174 where 174 where
175 extOf = formatFromExt . takeExtension . head
176 relOutPath = resClass /> inputRes 175 relOutPath = resClass /> inputRes
177 inPath = localPath $ inputBase /> inputRes 176 inPath = localPath $ inputBase /> inputRes
178 outPath = localPath $ outputBase /> relOutPath 177 outPath = localPath $ outputBase /> relOutPath
@@ -196,10 +195,9 @@ type ThumbnailFileProcessor =
196 195
197thumbnailFileProcessor :: Resolution -> Cache -> ThumbnailFileProcessor 196thumbnailFileProcessor :: Resolution -> Cache -> ThumbnailFileProcessor
198thumbnailFileProcessor maxRes cached inputBase outputBase resClass inputRes = 197thumbnailFileProcessor maxRes cached inputBase outputBase resClass inputRes =
199 cached <$> processor (extOf inputRes) 198 cached <$> processor (formatFromPath inputRes)
200 & process 199 & process
201 where 200 where
202 extOf = formatFromExt . takeExtension . head
203 relOutPath = resClass /> inputRes 201 relOutPath = resClass /> inputRes
204 inPath = localPath $ inputBase /> inputRes 202 inPath = localPath $ inputBase /> inputRes
205 outPath = localPath $ outputBase /> relOutPath 203 outPath = localPath $ outputBase /> relOutPath