aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/Processors.hs
diff options
context:
space:
mode:
authorpacien2020-05-19 21:06:16 +0200
committerNotkea2020-05-22 01:02:18 +0200
commit516ee7c5599f2c90a636fd9301806bef67830046 (patch)
tree50cc7369f8a0edf6160dfe5aca8e5bf4676fde42 /compiler/src/Processors.hs
parenta2e06f0a217b12d92cecdad77c20de88037f9912 (diff)
downloadldgallery-516ee7c5599f2c90a636fd9301806bef67830046.tar.gz
compiler: add audio and video extensions
Diffstat (limited to 'compiler/src/Processors.hs')
-rw-r--r--compiler/src/Processors.hs24
1 files changed, 22 insertions, 2 deletions
diff --git a/compiler/src/Processors.hs b/compiler/src/Processors.hs
index 2988f83..0efbf6d 100644
--- a/compiler/src/Processors.hs
+++ b/compiler/src/Processors.hs
@@ -47,8 +47,13 @@ data ProcessingException = ProcessingException FilePath String deriving Show
47instance Exception ProcessingException 47instance Exception ProcessingException
48 48
49 49
50-- TODO: handle video, music, markdown... 50data Format =
51data Format = PictureFormat | PlainTextFormat | PortableDocumentFormat | Unknown 51 PictureFormat
52 | PlainTextFormat
53 | PortableDocumentFormat
54 | VideoFormat
55 | AudioFormat
56 | Unknown
52 57
53formatFromPath :: Path -> Format 58formatFromPath :: Path -> Format
54formatFromPath = 59formatFromPath =
@@ -69,6 +74,19 @@ formatFromPath =
69 ".txt" -> PlainTextFormat 74 ".txt" -> PlainTextFormat
70 ".md" -> PlainTextFormat -- TODO: handle markdown separately 75 ".md" -> PlainTextFormat -- TODO: handle markdown separately
71 ".pdf" -> PortableDocumentFormat 76 ".pdf" -> PortableDocumentFormat
77 ".wav" -> AudioFormat
78 ".oga" -> AudioFormat
79 ".ogg" -> AudioFormat
80 ".spx" -> AudioFormat
81 ".opus" -> AudioFormat
82 ".flac" -> AudioFormat
83 ".m4a" -> AudioFormat
84 ".mp3" -> AudioFormat
85 ".ogv" -> VideoFormat
86 ".ogx" -> VideoFormat
87 ".webm" -> VideoFormat
88 ".mkv" -> VideoFormat
89 ".mp4" -> VideoFormat
72 _ -> Unknown 90 _ -> Unknown
73 91
74 92
@@ -175,6 +193,8 @@ itemFileProcessor maxResolution cached inputBase outputBase resClass inputRes =
175 processorFor PictureFormat Nothing = (copyFileProcessor, getPictureProps) 193 processorFor PictureFormat Nothing = (copyFileProcessor, getPictureProps)
176 processorFor PlainTextFormat _ = (copyFileProcessor, const $ return . PlainText) 194 processorFor PlainTextFormat _ = (copyFileProcessor, const $ return . PlainText)
177 processorFor PortableDocumentFormat _ = (copyFileProcessor, const $ return . PDF) 195 processorFor PortableDocumentFormat _ = (copyFileProcessor, const $ return . PDF)
196 processorFor VideoFormat _ = (copyFileProcessor, const $ return . Video)
197 processorFor AudioFormat _ = (copyFileProcessor, const $ return . Audio)
178 -- TODO: handle video reencoding and others? 198 -- TODO: handle video reencoding and others?
179 processorFor Unknown _ = (copyFileProcessor, const $ return . Other) 199 processorFor Unknown _ = (copyFileProcessor, const $ return . Other)
180 200