From bd273f8726e31010b8696c8a13275903cf2ac6de Mon Sep 17 00:00:00 2001 From: Arthur Jamet Date: Mon, 1 Jul 2024 08:01:08 +0200 Subject: [PATCH] Add example to README --- CHANGELOG.md | 4 ++-- README.md | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c78d84..3a7a49f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to the [Haskell Package Versioning Policy](https://pvp.haskell.org/). -## Unreleased +## 0.1.0.0 - 2024-07-01 -## 0.1.0.0 - YYYY-MM-DD +First release! diff --git a/README.md b/README.md index fa6cdfe..045e5fc 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,24 @@ # haskell-ffprobe This package provides Haskell bindings for the `ffprobe` command. + +## Example + +```haskell +import FFProbe +import FFProbe.Data.Format (duration, formatName) +import FFProbe.Data.Stream (codecLongName) +import System.Environment + +main :: IO () +main = do + fileName:_ <- getArgs + ffprobeRes <- ffprobe fileName + case ffprobeRes of + Left err -> putStrLn $ "An error occured: " ++ err + Right ffprobeData -> do + print $ formatName (format ffprobeData) + print $ duration (format ffprobeData) + print $ length (chapters ffprobeData) + print $ codecLongName $ head (streams ffprobeData) +```