hscdio-0.1.0.0: Haskell bindings to the libcdio disc-reading library.
Copyright(c) 2018-2021 Sam May
LicenseGPL-3.0-or-later
Maintainerag@eitilt.life
Stabilitystable
Portabilitynon-portable (requires libcdio)
Safe HaskellNone
LanguageHaskell2010

Foreign.Libcdio.CdText

Description

Metadata is stored in a binary format both library-internally and on the disc. Most audio archivists will recognize it as "those information fields in a CUE file" (though there are other formats as well), and casual listeners will recognize it as the scrolling text that you're always happy to see, on the rare times your music player shows it. Little-used and even-less-known, however, is that a single disc can theoretically contain metadata in up to eight different languages; because of the complexity that introduces, no unifying datatype is provided in favour of a function-based interface.

cdtext.h

Defines

Types

  • cdtext_field_t -> Field

    • CDTEXT_FIELD_INVALID (removed; handled via Nothing)
  • cdtext_genre_t -> Genre

    • CDTEXT_GENRE_UNUSED (removed; handled via Nothing)
  • cdtext_lang_t -> Language

    • CDTEXT_LANGUAGE_UNKNOWN -> UnknownLanguage

      • Before libcdio 2.1.0: (often effectively removed; handled via Nothing)
    • CDTEXT_LANGUAGE_INVALID (removed; handled via Nothing)
    • CDTEXT_LANGUAGE_BLOCK_UNUSED (removed; handled via Nothing)
  • cdtext_t (removed; merged into Cdio objects)

Symbols

Sound.Libcdio.Read.CdText

While similar functionality is provided, the Sound.Libcdio.Read.CdText is written as a separate monadic interface rather than in the Cdio-bound style used here.

Synopsis

Types

data Cdio Source #

A particular disc reading/writing device, along with the data contained on the loaded disc. Note well that this is always a mutable object, and is not thread-safe; moreover, any function this is passed to may wind up silently modifying the data.

data Field Source #

Instances

Instances details
Bounded Field Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Enum Field Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Eq Field Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Methods

(==) :: Field -> Field -> Bool #

(/=) :: Field -> Field -> Bool #

Ord Field Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Methods

compare :: Field -> Field -> Ordering #

(<) :: Field -> Field -> Bool #

(<=) :: Field -> Field -> Bool #

(>) :: Field -> Field -> Bool #

(>=) :: Field -> Field -> Bool #

max :: Field -> Field -> Field #

min :: Field -> Field -> Field #

Read Field Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Show Field Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Methods

showsPrec :: Int -> Field -> ShowS #

show :: Field -> String #

showList :: [Field] -> ShowS #

data Genre Source #

Genres recognized in the CD Text standard.

Instances

Instances details
Bounded Genre Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Enum Genre Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Eq Genre Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Methods

(==) :: Genre -> Genre -> Bool #

(/=) :: Genre -> Genre -> Bool #

Ord Genre Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Methods

compare :: Genre -> Genre -> Ordering #

(<) :: Genre -> Genre -> Bool #

(<=) :: Genre -> Genre -> Bool #

(>) :: Genre -> Genre -> Bool #

(>=) :: Genre -> Genre -> Bool #

max :: Genre -> Genre -> Genre #

min :: Genre -> Genre -> Genre #

Read Genre Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Show Genre Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Methods

showsPrec :: Int -> Genre -> ShowS #

show :: Genre -> String #

showList :: [Genre] -> ShowS #

data Language Source #

Written languages recognized in the CD Text standard.

Description

fieldString :: Field -> String Source #

Describe the type of data in a human-readable manner, as opposed to the machine representation returned by the Show instance.

languageString :: Language -> String Source #

Return a canonical English name of the given language, as opposed to the machine representation returned by the Show instance.

parseLanguage :: String -> Maybe Language Source #

Transform a string returned by languageString back into its Language representation.

Before libcdio 2.1.0: Always returns Nothing

genreString :: Genre -> String Source #

Return a canonical English name of the given genre, as opposed to the machine representation returned by the Show instance.

Management

cdTextDataInit :: ByteString -> IO (Maybe Cdio) Source #

Read binary CD-TEXT data into a structured datatype.

Note that binary CdText dumps will frequently include four bytes at the beginning indicating the size of the file; this implementation expects that those bytes are not included. If your dump does include them, drop 4 before passing the ByteString to this function.

Before libcdio 0.94: Always returns Nothing

listLanguages :: Cdio -> IO [Language] Source #

Retrieve the languages included in the disc metadata. Note that this does not save the index position or any duplicate language blocks (if that is desired, see listAllLanguages instead).

listAllLanguages :: Cdio -> IO [Maybe Language] Source #

Retrieve the languages included in the disc metadata, in the order they occur, and respecting any empty language blocks if there's a valid language after them (empty blocks at the end are cleaned away).

Before libcdio 2.1.0: Acts as listLanguages

selectLanguage :: Cdio -> Language -> IO Bool Source #

Try to set the data associated with the given language as active for future calls to cdTextGet and similar. If passed UnknownLanguage or the CDTEXT does not provide the one requested, selects the first (default) data set instead, and returns False.

selectLanguageIndex :: Cdio -> Word -> IO Bool Source #

Select the language at the given index of listAllLanguages for future data retrieval. If the index is out of bounds or corresponds to a Nothing in listAllLanguages, the first (default) data set is selected instead and 'False is returned.

Access

cdTextGet :: Cdio -> Field -> Maybe Track -> IO (Maybe String) Source #

Attempt to retrieve the value of a given field from the disc (if Nothing) or track (if Just) metadata, in the currently-active language. Note that GenreName and DiscId will always refer to the disc-level data.

genre :: Cdio -> IO (Maybe Genre) Source #

The machine-readable genre describing the music on this disc. For any associated human-readable name or subgenre, use cdTextGet c GenreName Nothing.

language :: Cdio -> IO (Maybe Language) Source #

Indicate which language results will (currently) be returned in. See selectLanguage to change this.

firstTrack :: Cdio -> IO (Maybe Track) Source #

The earliest track with any associated metadata in the current language. Note that this may differ from minTrack.

lastTrack :: Cdio -> IO (Maybe Track) Source #

The final track with any associated metadata in the current language. Note that this may differ from maxTrack.