packages feed

gpmf 0.1.1.1 → 0.1.1.2

raw patch · 4 files changed

+16/−7 lines, 4 files

Files

app/Main.hs view
@@ -11,4 +11,7 @@ main :: IO () main = do   [fn] <- getArgs-  either print (mapM_ (BL.putStrLn . maybe "" showDEVC . uncurry mkDEVC)) . parseGPMF =<< BS.readFile fn+  either print (mapM_ (ps . maybe "" showDEVC . uncurry mkDEVC)) . parseGPMF =<< BS.readFile fn++  where+    ps s = BL.putStr s *> BL.putStr "\n"
gpmf.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.7.+-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack ----- hash: 02deec16ad0ae901f9aab83fe594d492d38e1492ded6e44501c7037008324a53+-- hash: 7571cd9d9b95b052897d6f76314c207aa300046dabffcdf8131672c4291a2aee  name:           gpmf-version:        0.1.1.1+version:        0.1.1.2 description:    Please see the README on GitHub at <https://github.com/dustin/gpmf#readme> homepage:       https://github.com/dustin/gpmf#readme bug-reports:    https://github.com/dustin/gpmf/issues
src/GoPro/DEVC.hs view
@@ -217,7 +217,7 @@ grokGPS vals = do   GUint16 [gpsp] <- listToMaybe =<< findVal "GPSP" vals   GTimestamp time <- listToMaybe =<< findVal "GPSU" vals-  scals <- fmap (\(GInt32 [x]) -> realToFrac x) <$> findVal "SCAL" vals+  scals <- mapMaybe (fmap realToFrac . anInt) <$> findVal "SCAL" vals   g5s <- findVal "GPS5" vals   rs <- mconcat <$> traverse (readings scals) g5s @@ -229,6 +229,9 @@                                      -> Just [GPSReading{..}]                                    _ -> Nothing     readings _ _ = Nothing++    anInt (GInt32 [x]) = Just x+    anInt _ = Nothing  grokAudioLevel :: [Value] -> Maybe AudioLevel grokAudioLevel vals = do
src/GoPro/GPMF.hs view
@@ -10,6 +10,7 @@ -}  {-# LANGUAGE TupleSections #-}+{-# LANGUAGE DeriveGeneric #-}  module GoPro.GPMF (parseGPMF, Value(..), FourCC(..)) where @@ -27,6 +28,8 @@ import           Data.Time.Clock                  (UTCTime) import           Data.Time.Format                 (defaultTimeLocale, parseTimeM) import           Data.Word                        (Word16, Word32, Word64, Word8)+import GHC.Generics (Generic)+ {- Type Char	Definition	typedef	Comment b	single byte signed integer	int8_t	-128 to 127@@ -49,7 +52,7 @@ null	Nested metadata	uint32_t	The data within is GPMF structured KLV data -} -newtype FourCC = FourCC (Char, Char, Char, Char) deriving (Show, Eq)+newtype FourCC = FourCC (Char, Char, Char, Char) deriving (Show, Eq, Generic)  instance IsString FourCC where   fromString [a,b,c,d] = FourCC (a,b,c,d)@@ -74,7 +77,7 @@     | GComplex String [Value]     | GNested (FourCC, [Value])     | GUnknown (Char, Int, Int, [[Word8]])-    deriving (Show)+    deriving (Show, Generic)  type Parser = StateT String A.Parser