diff options
author | pacien | 2020-05-13 00:18:16 +0200 |
---|---|---|
committer | Notkea | 2020-05-22 01:02:18 +0200 |
commit | 04d5cb917f4288c26a308dfda4ba788d77fda8fd (patch) | |
tree | b8f21b974130fb6c74cd4aba149be72016a430c7 /compiler/src/Processors.hs | |
parent | 478fb074b7101beabc149f01f45061d3aeefe3eb (diff) | |
download | ldgallery-04d5cb917f4288c26a308dfda4ba788d77fda8fd.tar.gz |
compiler: add plain text file format support through simple copy
Diffstat (limited to 'compiler/src/Processors.hs')
-rw-r--r-- | compiler/src/Processors.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/src/Processors.hs b/compiler/src/Processors.hs index 02db325..ca8a74c 100644 --- a/compiler/src/Processors.hs +++ b/compiler/src/Processors.hs | |||
@@ -47,8 +47,8 @@ data ProcessingException = ProcessingException FilePath String deriving Show | |||
47 | instance Exception ProcessingException | 47 | instance Exception ProcessingException |
48 | 48 | ||
49 | 49 | ||
50 | -- TODO: handle video, music, text... | 50 | -- TODO: handle video, music, markdown, pdf... |
51 | data Format = PictureFormat | Unknown | 51 | data Format = PictureFormat | PlainTextFormat | Unknown |
52 | 52 | ||
53 | formatFromPath :: Path -> Format | 53 | formatFromPath :: Path -> Format |
54 | formatFromPath = | 54 | formatFromPath = |
@@ -66,6 +66,8 @@ formatFromPath = | |||
66 | ".tiff" -> PictureFormat | 66 | ".tiff" -> PictureFormat |
67 | ".hdr" -> PictureFormat | 67 | ".hdr" -> PictureFormat |
68 | ".gif" -> PictureFormat | 68 | ".gif" -> PictureFormat |
69 | ".txt" -> PlainTextFormat | ||
70 | ".md" -> PlainTextFormat -- TODO: handle markdown separately | ||
69 | _ -> Unknown | 71 | _ -> Unknown |
70 | 72 | ||
71 | 73 | ||
@@ -170,6 +172,7 @@ itemFileProcessor maxResolution cached inputBase outputBase resClass inputRes = | |||
170 | processorFor :: Format -> Maybe Resolution -> (FileProcessor, ItemDescriber) | 172 | processorFor :: Format -> Maybe Resolution -> (FileProcessor, ItemDescriber) |
171 | processorFor PictureFormat (Just maxRes) = (resizePictureUpTo maxRes, getPictureProps) | 173 | processorFor PictureFormat (Just maxRes) = (resizePictureUpTo maxRes, getPictureProps) |
172 | processorFor PictureFormat Nothing = (copyFileProcessor, getPictureProps) | 174 | processorFor PictureFormat Nothing = (copyFileProcessor, getPictureProps) |
175 | processorFor PlainTextFormat _ = (copyFileProcessor, const $ return . PlainText) | ||
173 | -- TODO: handle video reencoding and others? | 176 | -- TODO: handle video reencoding and others? |
174 | processorFor Unknown _ = (copyFileProcessor, const $ return . Other) | 177 | processorFor Unknown _ = (copyFileProcessor, const $ return . Other) |
175 | 178 | ||