diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/src/Processors.hs | 24 | ||||
-rw-r--r-- | compiler/src/Resource.hs | 2 |
2 files changed, 24 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 | |||
47 | instance Exception ProcessingException | 47 | instance Exception ProcessingException |
48 | 48 | ||
49 | 49 | ||
50 | -- TODO: handle video, music, markdown... | 50 | data Format = |
51 | data Format = PictureFormat | PlainTextFormat | PortableDocumentFormat | Unknown | 51 | PictureFormat |
52 | | PlainTextFormat | ||
53 | | PortableDocumentFormat | ||
54 | | VideoFormat | ||
55 | | AudioFormat | ||
56 | | Unknown | ||
52 | 57 | ||
53 | formatFromPath :: Path -> Format | 58 | formatFromPath :: Path -> Format |
54 | formatFromPath = | 59 | formatFromPath = |
@@ -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 | ||
diff --git a/compiler/src/Resource.hs b/compiler/src/Resource.hs index 129a817..c08677d 100644 --- a/compiler/src/Resource.hs +++ b/compiler/src/Resource.hs | |||
@@ -77,6 +77,8 @@ data GalleryItemProps = | |||
77 | , resolution :: Resolution } | 77 | , resolution :: Resolution } |
78 | | PlainText { resource :: Resource } | 78 | | PlainText { resource :: Resource } |
79 | | PDF { resource :: Resource } | 79 | | PDF { resource :: Resource } |
80 | | Video { resource :: Resource } | ||
81 | | Audio { resource :: Resource } | ||
80 | | Other { resource :: Resource } | 82 | | Other { resource :: Resource } |
81 | deriving (Generic, Show) | 83 | deriving (Generic, Show) |
82 | 84 | ||