packages feed

htaglib 1.1.0 → 1.1.1

raw patch · 11 files changed

+55/−175 lines, 11 filesdep ~htaglib

Dependency ranges changed: htaglib

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+## HTagLib 1.1.1++* Improved/updated documentation and metadata.+ ## HTagLib 1.1.0  * Made `getTags`, `getTags'`, `setTags`, and `setTags'` callable from any
README.md view
@@ -16,8 +16,7 @@ * [License](#license)  This is Haskell bindings to [TagLib](https://taglib.github.io/), library for-reading and editing meta-data of several popular audio formats. This library-is easy to use and type-safe.+reading and editing meta-data of several popular audio formats.  It works with the following formats: @@ -31,7 +30,7 @@ * MP4 * ASF -This happens in abstract, uniform way, so you don't need to handle any+This happens in an abstract, uniform way, so you don't need to handle any low-level details. As a consequence, it's currently not possible to work with format-specific functionality. @@ -49,18 +48,17 @@ ## A note for FLAC users  If you want to work with FLAC, there is-a [complete Haskell binding](https://github.com/mrkkrp/flac) to `libFLAC` —-reference FLAC implementation. It allows to work with all FLAC metadata-(read and write) and also provides Haskell API to stream encoder and stream-decoder. Please prefer that package if you don't need to work with other-audio formats.+a [complete Haskell binding](https://github.com/mrkkrp/flac) to+`libFLAC`—reference FLAC implementation. It allows to work with all FLAC+metadata (read and write) and also provides Haskell API to stream encoder+and stream decoder. Please prefer that package if you don't need to work+with other audio formats.  ## Quick start  First, since this is bindings to C-interface of the library, you'll need to-install the library itself. If you're on Unix-like system, chances are-you'll have it in official repositories of your distro. Users of other-systems should also be able to install it without particular pain.+install the library itself. If you're on a Unix-like system, chances are+you'll have it in the official repositories of your distro.  After installation of the library, install `htaglib` package using Cabal or Stack (recommended):@@ -96,8 +94,8 @@ data, so it's more difficult to use track title in lieu of track artist, for example. Meta data that is represented by strings also has smart constructors, they replace zero bytes with spaces, this is necessary to-avoid troubles when your Haskell strings go to C-level (well, zero-bytes in-strings is rather edge case, but it should be mentioned). Of course,+avoid troubles when your Haskell strings go to the C-level (well, zero-bytes+in strings is rather edge case, but it should be mentioned). Of course, `Title`, `Artist`, `Album`, `Comment`, and `Genre` all are instances of `IsString`, so just turn on `OverloadedStrings` and you can use normal string literals to create data of these types.@@ -156,8 +154,8 @@ of seconds as an integer. This means that if you want to calculate total duration, you'll have slightly incorrect result. Proper solution is to extract duration as floating-point number, for that we recommend bindings to-`libsndfile` — [`hsndfile`](https://hackage.haskell.org/package/hsndfile)-(or the above-mentioned `flac` package for Haskell if you work with FLAC).+`libsndfile`—[`hsndfile`](https://hackage.haskell.org/package/hsndfile) (or+the above-mentioned `flac` package for Haskell if you work with FLAC).  ### Writing meta data @@ -184,8 +182,7 @@   print track ``` -This code loads file and changes “title” and “artist” meta data-fields.+This code loads file and changes “title” and “artist” meta data fields.  ## Conclusion 
Sound/HTagLib.hs view
@@ -3,12 +3,12 @@ -- Copyright   :  © 2015–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@opmbx.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable ----- This module includes complete high-level interface to TagLib. This is the--- module you should import to use in your projects.+-- This module provides a complete high-level interface to TagLib. This is+-- the module you should import to use in your projects.  module Sound.HTagLib   ( -- * Getters
Sound/HTagLib/Getter.hs view
@@ -3,11 +3,11 @@ -- Copyright   :  © 2015–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@opmbx.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable ----- High-level applicative interface for reading of audio meta data. You+-- A high-level applicative interface for reading of audio meta data. You -- don't need to import this module directly, import "Sound.HTagLib" -- instead. @@ -37,11 +37,11 @@ import qualified Sound.HTagLib.Internal as I  #if !MIN_VERSION_base(4,8,0)-import Control.Applicative (Applicative, (<$>), (<*>), pure)+import Control.Applicative #endif --- | This type represents composable entity that can be used with 'getTags'--- or 'getTags'' functions to read batch of meta parameters.+-- | A composable entity that can be used with 'getTags' or 'getTags''+-- functions to read batch of meta parameters.  newtype TagGetter a = TagGetter { runGetter :: I.FileId -> IO a } @@ -57,9 +57,9 @@ -- | @getTags path g@ will try to read file located at @path@ and read meta -- data of the file using getter @g@. Type of file will be guessed from its -- extension. If this is not satisfactory and you want to explicitly specify--- file type, see 'getTags'' variation of this function.+-- the file type, see 'getTags'' variation of this function. ----- In case of trouble 'I.HTagLibException' will be thrown.+-- In the case of trouble 'I.HTagLibException' will be thrown.  getTags :: MonadIO m   => FilePath          -- ^ Path to audio file
Sound/HTagLib/Internal.hs view
@@ -3,7 +3,7 @@ -- Copyright   :  © 2015–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@opmbx.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable --@@ -68,6 +68,7 @@  newtype FileId = FileId (Ptr TagLibFile) +---------------------------------------------------------------------------- -- Misc  foreign import ccall unsafe "taglib/tag_c.h taglib_set_string_management_enabled"@@ -96,6 +97,7 @@ foreign import ccall unsafe "taglib/tag_c.h taglib_file_save"   c_taglib_file_save :: Ptr TagLibFile -> IO CInt +---------------------------------------------------------------------------- -- Tag API  foreign import ccall unsafe "taglib/tag_c.h taglib_tag_title"@@ -140,6 +142,7 @@ foreign import ccall unsafe "taglib/tag_c.h taglib_tag_set_track"   c_taglib_tag_set_track :: Ptr TagLibTag -> CUInt -> IO () +---------------------------------------------------------------------------- -- Audio properties API  foreign import ccall unsafe "taglib/tag_c.h taglib_audioproperties_length"@@ -154,14 +157,13 @@ foreign import ccall unsafe "taglib/tag_c.h taglib_audioproperties_channels"   c_taglib_properties_channels :: Ptr TagLibProperties -> IO CInt +---------------------------------------------------------------------------- -- Special convenience ID3v2 functions  foreign import ccall unsafe "taglib/tag_c.h taglib_id3v2_set_default_text_encoding"   c_taglib_id3v2_set_default_text_encoding :: CInt -> IO () --- Wrappers. Here we prepare a little higher-level interface that will be--- used by the rest of the library.-+---------------------------------------------------------------------------- -- File API  -- | Open audio file and return its ID (an opaque type that the rest of@@ -212,6 +214,7 @@   unless success $     throw (T.SavingFailed path) +---------------------------------------------------------------------------- -- Tag API  -- | Get title tag associated with file.@@ -284,6 +287,7 @@ setTrackNumber :: Maybe T.TrackNumber -> FileId -> IO () setTrackNumber v = setIntValue c_taglib_tag_set_track (T.unTrackNumber <$> v) +---------------------------------------------------------------------------- -- Audio properties API  -- | Get duration of track associated with file.@@ -310,6 +314,7 @@ getChannels = fmap (fromJust . T.mkChannels)   . getIntProperty c_taglib_properties_channels +---------------------------------------------------------------------------- -- Special convenience ID3v2 functions  -- | Set the default encoding for ID3v2 frames that are written to tags.@@ -317,6 +322,7 @@ id3v2SetEncoding :: T.ID3v2Encoding -> IO () id3v2SetEncoding = c_taglib_id3v2_set_default_text_encoding . enumToCInt +---------------------------------------------------------------------------- -- Helpers  getStrValue
Sound/HTagLib/Setter.hs view
@@ -3,11 +3,11 @@ -- Copyright   :  © 2015–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@opmbx.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable ----- High-level interface for writing audio meta data. You don't need to+-- A high-level interface for writing audio meta data. You don't need to -- import this module directly, import "Sound.HTagLib" instead.  {-# LANGUAGE CPP             #-}@@ -38,8 +38,8 @@ import Data.Monoid #endif --- | Composable entity that can be used together with 'setTags' or--- 'setTags'' to write meta data to audio file.+-- | A composable entity that can be used together with the 'setTags' or the+-- 'setTags'' functions to write meta data to an audio file. -- -- Note that in case of (for example): --@@ -74,9 +74,9 @@     , sdYear        = f sdYear     , sdTrackNumber = f sdTrackNumber } --- | Set tags in specified file using given setter.+-- | Set tags in specified file using the given setter. ----- In case of trouble 'I.HTagLibException' will be thrown.+-- In the case of trouble 'I.HTagLibException' will be thrown.  setTags :: MonadIO m   => FilePath          -- ^ Path to audio file
Sound/HTagLib/Type.hs view
@@ -3,7 +3,7 @@ -- Copyright   :  © 2015–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@opmbx.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable --@@ -242,8 +242,8 @@ atLeast a b = if b >= a then Just b else Nothing  -- | Types of files TagLib can work with. This may be used to explicitly--- specify type of file rather than relying on TagLib ability to guess type--- of file from its extension.+-- specify type of file instead of relying on the TagLib's ability to guess+-- type of file from its extension.  data FileType   = MPEG               -- ^ MPEG
htaglib.cabal view
@@ -1,42 +1,11 @@------ Cabal config for HTagLib.------ Copyright © 2015–2017 Mark Karpov------ Redistribution and use in source and binary forms, with or without--- modification, are permitted provided that the following conditions are--- met:------ * Redistributions of source code must retain the above copyright notice,---   this list of conditions and the following disclaimer.------ * Redistributions in binary form must reproduce the above copyright---   notice, this list of conditions and the following disclaimer in the---   documentation and/or other materials provided with the distribution.------ * Neither the name Mark Karpov nor the names of contributors may be used---   to endorse or promote products derived from this software without---   specific prior written permission.------ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS “AS IS” AND ANY--- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED--- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE--- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY--- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL--- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS--- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)--- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,--- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN--- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE--- POSSIBILITY OF SUCH DAMAGE.- name:                htaglib-version:             1.1.0+version:             1.1.1 cabal-version:       >= 1.10+tested-with:         GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.1 license:             BSD3 license-file:        LICENSE.md-author:              Mark Karpov <markkarpov@opmbx.org>-maintainer:          Mark Karpov <markkarpov@opmbx.org>+author:              Mark Karpov <markkarpov92@gmail.com>+maintainer:          Mark Karpov <markkarpov92@gmail.com> homepage:            https://github.com/mrkkrp/htaglib bug-reports:         https://github.com/mrkkrp/htaglib/issues category:            Sound, Foreign@@ -86,7 +55,7 @@                    , directory  >= 1.2 && < 1.4                    , filepath   >= 1.4 && < 2.0                    , hspec      >= 2.0 && < 3.0-                   , htaglib    >= 1.1.0+                   , htaglib   default-extensions:                      CPP   default-language:  Haskell2010
tests/Sound/HTagLib/GetterSpec.hs view
@@ -1,35 +1,3 @@------ HTagLib tests, testing of getters.------ Copyright © 2015–2017 Mark Karpov------ Redistribution and use in source and binary forms, with or without--- modification, are permitted provided that the following conditions are--- met:------ * Redistributions of source code must retain the above copyright notice,---   this list of conditions and the following disclaimer.------ * Redistributions in binary form must reproduce the above copyright---   notice, this list of conditions and the following disclaimer in the---   documentation and/or other materials provided with the distribution.------ * Neither the name Mark Karpov nor the names of contributors may be used---   to endorse or promote products derived from this software without---   specific prior written permission.------ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS “AS IS” AND ANY--- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED--- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE--- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY--- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL--- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS--- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)--- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,--- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN--- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE--- POSSIBILITY OF SUCH DAMAGE.- module Sound.HTagLib.GetterSpec (spec) where  import Sound.HTagLib@@ -37,7 +5,7 @@ import Test.Hspec  #if !MIN_VERSION_base(4,8,0)-import Control.Applicative ((<$>))+import Control.Applicative #endif  spec :: Spec
tests/Sound/HTagLib/SetterSpec.hs view
@@ -1,35 +1,3 @@------ HTagLib tests, testing of Setters.------ Copyright © 2015–2017 Mark Karpov------ Redistribution and use in source and binary forms, with or without--- modification, are permitted provided that the following conditions are--- met:------ * Redistributions of source code must retain the above copyright notice,---   this list of conditions and the following disclaimer.------ * Redistributions in binary form must reproduce the above copyright---   notice, this list of conditions and the following disclaimer in the---   documentation and/or other materials provided with the distribution.------ * Neither the name Mark Karpov nor the names of contributors may be used---   to endorse or promote products derived from this software without---   specific prior written permission.------ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS “AS IS” AND ANY--- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED--- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE--- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY--- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL--- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS--- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)--- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,--- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN--- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE--- POSSIBILITY OF SUCH DAMAGE.- {-# LANGUAGE OverloadedStrings #-}  module Sound.HTagLib.SetterSpec (spec) where@@ -41,7 +9,7 @@ import Test.Hspec  #if !MIN_VERSION_base(4,8,0)-import Control.Applicative ((<$>))+import Control.Applicative #endif  spec :: Spec
tests/Sound/HTagLib/Test/Util.hs view
@@ -1,35 +1,3 @@------ HTagLib tests, utility definitions.------ Copyright © 2015–2017 Mark Karpov------ Redistribution and use in source and binary forms, with or without--- modification, are permitted provided that the following conditions are--- met:------ * Redistributions of source code must retain the above copyright notice,---   this list of conditions and the following disclaimer.------ * Redistributions in binary form must reproduce the above copyright---   notice, this list of conditions and the following disclaimer in the---   documentation and/or other materials provided with the distribution.------ * Neither the name Mark Karpov nor the names of contributors may be used---   to endorse or promote products derived from this software without---   specific prior written permission.------ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS “AS IS” AND ANY--- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED--- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE--- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY--- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL--- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS--- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)--- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,--- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN--- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE--- POSSIBILITY OF SUCH DAMAGE.- {-# LANGUAGE OverloadedStrings #-}  module Sound.HTagLib.Test.Util@@ -47,7 +15,7 @@ import Test.Hspec  #if !MIN_VERSION_base(4,8,0)-import Control.Applicative ((<$>), (<*>), pure)+import Control.Applicative #endif  data AudioTags = AudioTags