packages feed

hsexif 0.2.0.0 → 0.2.0.1

raw patch · 2 files changed

+14/−9 lines, 2 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Graphics.HsExif: readExifDateTime :: String -> LocalTime

Files

Graphics/HsExif.hs view
@@ -6,6 +6,7 @@ 	ExifValue(..), 	parseFileExif, 	parseExif,+	readExifDateTime, 	getDateTimeOriginal, 	getOrientation, 	ImageOrientation(..),@@ -78,10 +79,11 @@ 	| ExifRational Int Int 	-- ^ A rational number (numerator, denominator). 	-- Sometimes we're used to it as rational (exposition time: 1/160),-	-- sometimes as float (exposition compensation, we rather think -0.75)+	-- sometimes as float (exposure compensation, we rather think -0.75) 	-- 'show' will display it as 1/160. 	| ExifUnknown Word16 Int -- type then value-	-- ^ Unknown exif tag. Not a rarity, we don't support all existing tags.+	-- ^ Unknown exif value type. Maybe float? If the JPEG file is not+	-- corrupted, please send it to me. 	deriving Eq  instance Show ExifValue where@@ -326,17 +328,20 @@ signedInt32ToInt :: Word32 -> Int signedInt32ToInt w = fromIntegral (fromIntegral w :: Int32) --- | Extract the date and time when the picture was taken--- from the EXIF information.-getDateTimeOriginal :: Map ExifTag ExifValue -> Maybe LocalTime-getDateTimeOriginal exifData = do -	dateStr <- liftM show $ Map.lookup dateTimeOriginal exifData+-- | Decode an EXIF date time value.+readExifDateTime :: String -> LocalTime+readExifDateTime dateStr =  	-- i know more elegant ways to code this.. parsec, regex, text.. 	-- but i don't want to bring in too many dependencies to this library. 	-- the date is like "YYYY:MM:DD HH:MM:SS"-	return $ LocalTime+	LocalTime 		(fromGregorian (read $ take 4 dateStr) (read $ take 2 . drop 5 $ dateStr) (read $ take 2 . drop 8 $ dateStr)) 		(TimeOfDay (read $ take 2 . drop 11 $ dateStr) (read $ take 2 . drop 14 $ dateStr) (read $ take 2 . drop 17 $ dateStr))++-- | Extract the date and time when the picture was taken+-- from the EXIF information.+getDateTimeOriginal :: Map ExifTag ExifValue -> Maybe LocalTime+getDateTimeOriginal exifData = liftM (readExifDateTime . show) $ Map.lookup dateTimeOriginal exifData  data RotationDirection = MinusNinety 	| Ninety
hsexif.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                hsexif-version:             0.2.0.0+version:             0.2.0.1 synopsis:            EXIF handling library in pure Haskell description:         The hsexif library provides functions for working with EXIF data                      contained in JPEG files. Currently it only supports reading the data.