exiftool 0.2.0.2 → 0.2.0.4
raw patch · 4 files changed
+26/−22 lines, 4 filesdep −witchPVP ok
version bump matches the API change (PVP)
Dependencies removed: witch
API changes (from Hackage documentation)
Files
- CHANGELOG.md +8/−0
- LICENSE +1/−1
- exiftool.cabal +3/−4
- lib/ExifTool.hs +14/−17
CHANGELOG.md view
@@ -1,5 +1,13 @@ # Revision history for exiftool +## 0.2.0.4 -- 2023-03-13++* Bugfix re version number in cabal file.++## 0.2.0.3 -- 2023-03-13++* Maintenance release.+ ## 0.2.0.2 -- 2022-11-14 * Maintenance release.
LICENSE view
@@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020-2022 Martin Hoppenheit+Copyright (c) 2020-2023 Martin Hoppenheit Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
exiftool.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: exiftool-version: 0.2.0.2+version: 0.2.0.4 synopsis: Haskell bindings to ExifTool description: Haskell bindings to the [ExifTool](https://exiftool.org) command-line application that enable reading, writing and@@ -10,7 +10,7 @@ license-file: LICENSE author: Martin Hoppenheit maintainer: martin@hoppenheit.info-copyright: 2020-2022 Martin Hoppenheit+copyright: 2020-2023 Martin Hoppenheit category: Foreign extra-source-files: README.md CHANGELOG.md @@ -29,8 +29,7 @@ temporary >= 1.3 && < 1.4, text >= 1.2.3 && < 2.1, unordered-containers >= 0.2.12 && < 0.3,- vector >= 0.12.1 && < 0.14,- witch >= 1.0.0 && < 1.2+ vector >= 0.12.1 && < 0.14 source-repository head type: git
lib/ExifTool.hs view
@@ -1,10 +1,9 @@ {-# LANGUAGE DerivingVia #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TypeApplications #-} -- | -- Module : ExifTool--- Copyright : (c) Martin Hoppenheit 2020-2022+-- Copyright : (c) Martin Hoppenheit 2020-2023 -- License : MIT -- Maintainer : martin@hoppenheit.info --@@ -101,9 +100,11 @@ ( Text, intercalate, isPrefixOf,+ pack, splitOn, stripPrefix, toCaseFold,+ unpack, ) import Data.Text.Encoding (decodeUtf8', encodeUtf8) import Data.Text.IO (hGetLine, hPutStrLn)@@ -120,7 +121,6 @@ std_in, std_out, )-import Witch (into) -- | An ExifTool instance, initialized with 'startExifTool' and terminated with -- 'stopExifTool'.@@ -171,7 +171,7 @@ parseJSON (JSON.String x) | Just b <- stripPrefix "base64:" x = either- (fail . into @String)+ (fail . unpack) (pure . Binary) (decodeBase64 $ encodeUtf8 b) | otherwise = pure $ String x@@ -217,10 +217,10 @@ fromValue (Binary x) = either (const Nothing) Just $ decodeUtf8' x fromValue (Number x) = Just- . into @Text+ . pack . formatScientific Fixed (Just $ if isInteger x then 0 else 2) $ x- fromValue (Bool x) = Just . into @Text . show $ x+ fromValue (Bool x) = Just . pack . show $ x fromValue (List xs) = intercalate ", " <$> traverse fromValue xs instance ToValue Text where@@ -267,11 +267,11 @@ instance ToValue Bool where toValue = Bool -instance FromValue a => FromValue [a] where+instance (FromValue a) => FromValue [a] where fromValue (List xs) = traverse fromValue xs fromValue _ = Nothing -instance ToValue a => ToValue [a] where+instance (ToValue a) => ToValue [a] where toValue = List . fmap toValue -- | Start an ExifTool instance. Use 'stopExifTool' when done, or 'withExifTool'@@ -349,13 +349,13 @@ -- @since 0.2.0.0 readMetaEither :: ExifTool -> [Tag] -> FilePath -> IO (Either Text Metadata) readMetaEither et ts fp = do- result <- sendCommand et (into @Text fp : options <> tags)+ result <- sendCommand et (pack fp : options <> tags) pure $ Metadata . mapKeys toLower <$> (result >>= parseOutput) where options = ["-json", "-binary", "-unknown2"] tags = fmap (("-" <>) . tagName) ts parseOutput =- bimap (into @Text) head . eitherDecode . into @BL.ByteString . encodeUtf8+ bimap pack head . eitherDecode . BL.fromStrict . encodeUtf8 -- | Write metadata to a file. The file is modified in place, make sure you have -- the necessary backups!@@ -373,10 +373,7 @@ withSystemTempFile "exiftool.json" $ \metafile h -> do BL.hPut h $ encode [delete (Tag "SourceFile") m] hFlush h- void- <$> sendCommand- et- (into @Text fp : "-json=" <> into @Text metafile : options)+ void <$> sendCommand et (pack fp : "-json=" <> pack metafile : options) where options = ["-overwrite_original", "-f"] @@ -384,7 +381,7 @@ -- "Description)" m == get (Tag "description") m@. -- -- @since 0.2.0.0-get :: FromValue a => Tag -> Metadata -> Maybe a+get :: (FromValue a) => Tag -> Metadata -> Maybe a get t (Metadata m) = do v <- m !? toLower t guard (v /= String "-") -- Marked for deletion, see del function below.@@ -393,7 +390,7 @@ -- | Set a tag to a (new) value. Tag case is ignored. -- -- @since 0.2.0.0-set :: ToValue a => Tag -> a -> Metadata -> Metadata+set :: (ToValue a) => Tag -> a -> Metadata -> Metadata set t v (Metadata m) = Metadata $ insert (toLower t) (toValue v) m -- | Delete a tag (i.e., set its value to a marker that will make ExifTool@@ -405,4 +402,4 @@ -- | Extract content from Right or throw error. eitherError :: Either Text a -> a-eitherError = either (error . into @String) id+eitherError = either (error . unpack) id