aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2017-03-01 09:54:25 -0700
committerSean Whitton <spwhitton@spwhitton.name>2017-03-01 09:54:25 -0700
commita569794f944285952442967b1db4a71828815293 (patch)
tree8ace55a6560007d64b0f43377f37c3d856834175
parentbb17a258054d190724f81062dca9cefba818d69a (diff)
downloadsscan-a569794f944285952442967b1db4a71828815293.tar.gz
implement generating PDF metadata block
-rw-r--r--Main.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/Main.hs b/Main.hs
index 3e64c55..43b627d 100644
--- a/Main.hs
+++ b/Main.hs
@@ -25,7 +25,9 @@ along with sscan. If not, see <http://www.gnu.org/licenses/>.
import Control.Concurrent (forkIO)
import Control.Monad (void, when)
-import Data.Time.Clock.POSIX (getPOSIXTime)
+import Data.Time.Clock.POSIX (getPOSIXTime, posixSecondsToUTCTime)
+import Data.Time.Format (defaultTimeLocale, formatTime,
+ iso8601DateFormat)
import Lens.Micro ((&), (.~), (^.))
import System.Directory (getHomeDirectory,
removeDirectoryRecursive, renamePath,
@@ -93,7 +95,15 @@ processScanSessDir st dir = withCurrentDirectory dir $ do
PDF -> "pdf"
PNG -> "png"
allPages = map (\n -> "page" ++ show n <.> "tiff") [1..(getLatestPage st)]
- metadata posix = undefined
+ metadata posix = let date = formatTime
+ defaultTimeLocale
+ (iso8601DateFormat Nothing)
+ (posixSecondsToUTCTime posix)
+ in unlines [ "InfoKey: Title"
+ , "InfoValue: scan of " ++ date
+ , "InfoKey: Author"
+ , "InfoValue: spw"
+ ]
makeInitialState :: IO St
makeInitialState = do