diff options
author | pacien | 2019-12-30 23:18:49 +0100 |
---|---|---|
committer | pacien | 2019-12-30 23:18:49 +0100 |
commit | d0962ef2dea7e8a0c25ca8fdbc55fcbafeeb2f79 (patch) | |
tree | 16c4909877b94fabb735e9ef1437b57628d878c5 /compiler/src/Processors.hs | |
parent | 8a75458290002c765a0fa673912c162020de2bd1 (diff) | |
download | ldgallery-d0962ef2dea7e8a0c25ca8fdbc55fcbafeeb2f79.tar.gz |
compiler: refactor resource transformation pipeline
Diffstat (limited to 'compiler/src/Processors.hs')
-rw-r--r-- | compiler/src/Processors.hs | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/compiler/src/Processors.hs b/compiler/src/Processors.hs index ded3cc5..df05c24 100644 --- a/compiler/src/Processors.hs +++ b/compiler/src/Processors.hs | |||
@@ -37,9 +37,6 @@ import Data.Function ((&)) | |||
37 | import Data.Ratio ((%)) | 37 | import Data.Ratio ((%)) |
38 | import Data.Char (toLower) | 38 | import Data.Char (toLower) |
39 | 39 | ||
40 | import GHC.Generics (Generic) | ||
41 | import Data.Aeson (FromJSON) | ||
42 | |||
43 | import System.Directory hiding (copyFile) | 40 | import System.Directory hiding (copyFile) |
44 | import qualified System.Directory | 41 | import qualified System.Directory |
45 | import System.FilePath | 42 | import System.FilePath |
@@ -60,7 +57,7 @@ data Format = | |||
60 | | Other | 57 | | Other |
61 | 58 | ||
62 | formatFromPath :: Path -> Format | 59 | formatFromPath :: Path -> Format |
63 | formatFromPath = aux . (map toLower) . fileName | 60 | formatFromPath = aux . (map toLower) . takeExtension . fileName |
64 | where | 61 | where |
65 | aux ".bmp" = Bmp | 62 | aux ".bmp" = Bmp |
66 | aux ".jpg" = Jpg | 63 | aux ".jpg" = Jpg |
@@ -71,9 +68,6 @@ formatFromPath = aux . (map toLower) . fileName | |||
71 | aux ".gif" = Gif | 68 | aux ".gif" = Gif |
72 | aux _ = Other | 69 | aux _ = Other |
73 | 70 | ||
74 | data Resolution = Resolution | ||
75 | { width :: Int | ||
76 | , height :: Int } deriving (Show, Generic, FromJSON) | ||
77 | 71 | ||
78 | type FileProcessor = | 72 | type FileProcessor = |
79 | FileName -- ^ Input path | 73 | FileName -- ^ Input path |