Module SkhcMetadata.MetadataSource

Operation on music's metadata. This module on its own doesn't modify the file.

Sourcemodule Values : sig ... end
Sourcemodule Properties : sig ... end
Sourcemodule Keys : sig ... end

Module containing some well-known keys by Taglib.

Sourcetype t

type of metadata

init audioproperties pictures properties creates metadata from audioproperties, pictures and properties.

Sourceval of_properties : ?audioproperties:Otaglibc.audioproperties -> ?covers:Otaglibc.picture array -> Values.t Properties.t -> t

of_properties ?audioproperties ?covers properties is init with optional audioproperties and covers.

Sourceval empty : t

Empty metadata

Sourceval set_property : string -> string -> t -> t

set_property key value metadata sets the property associated with key to value.

Sourceval add_property : string -> string -> t -> t

add_property key value metadata adds value to the list of the property associated with key.

Sourceval remove_property : string -> t -> t

remove_property key metadata removes values associated with key from metadata.

  • since 0.3.0
Sourceval property : string -> t -> Values.t option

property key metadata returns values associated with key.

Sourceval properties : t -> Values.t Properties.t

properties metadata returns all properties.

Sourceval property_min : string -> t -> string option

property_min key metadata returns the min value, as defined by Values.min_elt_opt, associated with key.

Sourceval property_list : string -> t -> string list

property_list key metadata returns values associated with key. Returns an empty list if no value is associed with key.

Sourceval property_match : (string -> 'a option) -> string -> t -> 'a option

property_match conv key metadata returns the first value associated with key where conv is Some.

Sourceval equal : t -> t -> bool

equal m1 m2 tests whether m1 and m2 are equal.

Sourceval is_empty : t -> bool

is_empty metadata tests whether metadata is empty.

Sourceval title : t -> string option

title metadata is property_min with Keys.title key.

Sourceval set_title : string -> t -> t

set_title title metadata is set_property with Keys.title key.

Sourceval title_sort : t -> string option

title_sort metadata is property_min with Keys.title_sort key.

Sourceval set_title_sort : string -> t -> t

set_title_sort title_sort metadata is set_property with Keys.title_sort key.

Sourceval artists : t -> string list

artists metadata is property_list with Keys.artist key.

Sourceval artist : sep:string -> t -> string

artist ~sep metadata is artists composed with String.concat sep.

Sourceval set_artist : string -> t -> t

set_artist artist metadata is set_property with Keys.artist key.

Sourceval add_artist : string -> t -> t

add_artist artist metadata is add_property with Keys.artist key.

Sourceval artist_sort : t -> string option

artist_sort metadata is property_min with Keys.artist_sort key.

Sourceval set_artist_sort : string -> t -> t

set_artist_sort artist_sort metadata is set_property with Keys.artist_sort key.

Sourceval album_artists : t -> string list

album_artists metadata is property_list with Keys.album_artist key.

Sourceval album_artist : sep:string -> t -> string

album_artist ~sep metadata is album_artists composed with String.concat sep.

Sourceval set_album_artist : string -> t -> t

set_album_artist album_artist metadata is set_property with Keys.album_artist key.

Sourceval add_album_artist : string -> t -> t

add_artist album_artist metadata is add_property with Keys.album_artist key.

Sourceval composers : t -> string list

composers metadata is property_list with Keys.composer key.

Sourceval composer : sep:string -> t -> string

composer ~sep metadata is composer composed with String.concat sep.

Sourceval set_composer : string -> t -> t

set_composer composer metadata is set_property with Keys.composer key.

Sourceval add_composer : string -> t -> t

add_composer composer metadata is add_property with Keys.composer key.

Sourceval album : t -> string option

album metadata is property_min with Keys.album key.

Sourceval set_album : string -> t -> t

set_album album metadata is set_property with Keys.album key.

Sourceval album_sort : t -> string option

album_sort metadata is property_min with Keys.album_sort key.

Sourceval set_album_sort : string -> t -> t

set_album_sort album_sort metadata is set_property with Keys.album_sort key.

Sourceval track : t -> int option

track metadata is property_min with Keys.track key. conv takes all the valid integer token from the value and tries to parse it as a string.

Sourceval set_track : int -> t -> t

set_track track metadata is set_property with Keys.track key.

Sourceval comments : t -> string list

comments metadata is property_list with Keys.comment key.

Sourceval comment : sep:string -> t -> string

comment ~sep metadata is comments composed with String.concat sep.

Sourceval set_comment : string -> t -> t

set_comment comment metadata is set_property with Keys.comment key.

Sourceval add_comment : string -> t -> t

add_comment comment metadata is add_property with Keys.comment key.

Sourceval genre : t -> string option

genre metadata is property_min with Keys.genre key.

Sourceval set_genre : string -> t -> t

set_genre album metadata is set_property with Keys.album key.

Sourceval year : t -> int option

year metadata is property_match with Keys.date key. conv takes all the valid integer token from the value and tries to parse it as a string.

Sourceval set_year : int -> t -> t

set_year year metadata is set_property with Keys.date

Sourceval disc : t -> int option

disc metadata is property_match with Keys.disc_number key. conv takes all the valid integer token from the value and tries to parse it as a string.

Sourceval disc' : t -> int

disc' metadata is disc but defaults to 0.

Sourceval set_disc : int -> t -> t

set_disc disc metadata is set_property with Keys.disc_number key.

Sourceval covers : t -> Otaglibc.picture array

covers metadata returns pictures inside metadata.

Sourceval add_cover : ?first:bool -> Otaglibc.picture -> t -> t

add_cover ?(first:true) picture metadata adds picture to metadata. If first, picture is preprended to the list of pictures. At the end otherwise.

Sourceval patch : t -> t -> t

patch base p updates base with the field set in p.

Sourceval audioproperties : t -> Otaglibc.audioproperties option

audioproperties metadata returns audioproperties associated with metadata.

Sourceval set_audioproperties : Otaglibc.audioproperties option -> t -> t

set_audioproperties audioproperties metadata sets audioproperties in metadata.

Sourceval set_audioproperties' : Otaglibc.audioproperties -> t -> t

set_audioproperties' audioproperties metadata is set_audioproperties but wraps audioproperties in Some.

Sourceval properties_iter : (string -> Values.t -> unit) -> t -> unit

properties_iter f metadata applies f to each property.

Sourceval unicode_normalize : Uunf.form -> t -> t

unicode_normalize form metadata returns metadata with all properties coverted to form.

Sourceval is_set : Field.t -> t -> bool

is_set field metadata tests whether value associed with field is set.

Sourceval of_taglib : Otaglibc.t -> t

of_taglib taglib creates a metadata from a taglib handler.

Sourceval apply : clear_picture:bool -> save:bool -> t -> Otaglibc.t -> bool

apply ~clear_picture ~save metadata taglib applies all properties of metadata to taglib handlers. If clear_picture, all pictures inside taglib are removed before adding ones inside metadata. If save, calls Otaglibc.save. Returns whether the file was saved.

Sourceval pp : Format.formatter -> t -> unit

pp format metadata is a pretty-printer.