| Copyright | (c) 2018-2021 Sam May |
|---|---|
| License | GPL-3.0-or-later |
| Maintainer | ag@eitilt.life |
| Stability | stable |
| Portability | non-portable (requires libcdio) |
| Safe Haskell | None |
| Language | Haskell2010 |
Foreign.Libcdio.CdText
Contents
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
MIN_CDTEXT_FIELD(removed; identical to)minBound::FieldMAX_CDTEXT_FIELD(removed; identical to)maxBound::Field
Types
cdtext_genre_t->GenreCDTEXT_GENRE_UNUSED(removed; handled viaNothing)
cdtext_lang_t->LanguageCDTEXT_LANGUAGE_UNKNOWN->UnknownLanguage- Before libcdio 2.1.0: (often effectively removed; handled via
Nothing)
- Before libcdio 2.1.0: (often effectively removed; handled via
CDTEXT_LANGUAGE_INVALID(removed; handled viaNothing)CDTEXT_LANGUAGE_BLOCK_UNUSED(removed; handled viaNothing)
cdtext_t(removed; merged intoCdioobjects)
Symbols
cdtext_data_init->cdTextDataInitcdtext_destroy(removed; handled via the garbage collector)cdtext_field2str->fieldStringcdtext_genre2str->genreStringcdtext_get(removed; type conversion makes it identical tocdtext_get_const)cdtext_get_const->cdTextGetcdtext_get_first_track->firstTrackcdtext_get_genre->genrecdtext_get_language->languagecdtext_get_last_track->lastTrackcdtext_init(removed; internal function without much external occasion)cdtext_lang2str->languageStringcdtext_list_languages->listLanguagescdtext_list_languages_v2->listAllLanguagescdtext_select_language->selectLanguagecdtext_set(removed; primarily intended for internal use, and is more limited than would be expected)cdtext_set_language_index->selectLanguageIndexcdtext_str2lang->parseLanguage
Sound.Libcdio.Read.CdText
While similar functionality is provided, the
Sound.Libcdio.Read. is written as a separate
monadic interface rather than in the CdTextCdio-bound style used here.
cdTextDataInit->parseCdTextcdTextGet->discId,, andsndgenreinfogenre->fstgenrelistAllLanguages->languageslistLanguages(removed; obsolete and imprecise)selectLanguage->withLanguageselectLanguageIndex->withIndex
Synopsis
- data Cdio
- data Field
- data Genre
- data Language
- = UnknownLanguage
- | Albanian
- | Breton
- | Catalan
- | Croatian
- | Welsh
- | Czech
- | Danish
- | German
- | English
- | Spanish
- | Esperanto
- | Estonian
- | Basque
- | Faroese
- | French
- | Frisian
- | Irish
- | Gaelic
- | Galician
- | Icelandic
- | Italian
- | Lappish
- | Latin
- | Latvian
- | Luxembourgian
- | Lithuanian
- | Hungarian
- | Maltese
- | Dutch
- | Norwegian
- | Occitan
- | Polish
- | Portuguese
- | Romanian
- | Romansh
- | Serbian
- | Slovak
- | Slovenian
- | Finnish
- | Swedish
- | Turkish
- | Flemish
- | Wallon
- | Zulu
- | Vietnamese
- | Uzbek
- | Urdu
- | Ukrainian
- | Thai
- | Telugu
- | Tatar
- | Tamil
- | Tadzhik
- | Swahili
- | SrananTongo
- | Somali
- | Sinhalese
- | Shona
- | SerboCroatian
- | Ruthenian
- | Russian
- | Quechua
- | Pushtu
- | Punjabi
- | Persian
- | Papamiento
- | Oriya
- | Nepali
- | Ndebele
- | Marathi
- | Moldavian
- | Malaysian
- | Malagasay
- | Macedonian
- | Laotian
- | Korean
- | Khmer
- | Kazakh
- | Kannada
- | Japanese
- | Indonesian
- | Hindi
- | Hebrew
- | Hausa
- | Gurani
- | Gujurati
- | Greek
- | Georgian
- | Fulani
- | Dari
- | Churash
- | Chinese
- | Burmese
- | Bulgarian
- | Bengali
- | Bielorussian
- | Bambora
- | Azerbaijani
- | Assamese
- | Armenian
- | Arabic
- | Amharic
- fieldString :: Field -> String
- languageString :: Language -> String
- parseLanguage :: String -> Maybe Language
- genreString :: Genre -> String
- cdTextDataInit :: ByteString -> IO (Maybe Cdio)
- listLanguages :: Cdio -> IO [Language]
- listAllLanguages :: Cdio -> IO [Maybe Language]
- selectLanguage :: Cdio -> Language -> IO Bool
- selectLanguageIndex :: Cdio -> Word -> IO Bool
- cdTextGet :: Cdio -> Field -> Maybe Track -> IO (Maybe String)
- genre :: Cdio -> IO (Maybe Genre)
- language :: Cdio -> IO (Maybe Language)
- firstTrack :: Cdio -> IO (Maybe Track)
- lastTrack :: Cdio -> IO (Maybe Track)
Types
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.
Genres recognized in the CD Text standard.
Constructors
Written languages recognized in the CD Text standard.
Constructors
Instances
| Bounded Language Source # | |
| Enum Language Source # | |
Defined in Foreign.Libcdio.Types.Enums | |
| Eq Language Source # | |
| Ord Language Source # | |
Defined in Foreign.Libcdio.Types.Enums | |
| Read Language Source # | |
| Show Language Source # | |
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, before passing the drop
4ByteString 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
language :: Cdio -> IO (Maybe Language) Source #
Indicate which language results will (currently) be returned in. See
selectLanguage to change this.