From a569794f944285952442967b1db4a71828815293 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 1 Mar 2017 09:54:25 -0700 Subject: implement generating PDF metadata block --- Main.hs | 14 ++++++++++++-- 1 file 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 . 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 -- cgit v1.2.3