module Id3v2:sig
..end
Parse and generate id3v2 binary tags.
This module provides ways to manipulate id3v2 tags not attached to a file. It is quite low-level and, despite good care in tightening its API, it is possible to generate invalid id3v2 tags using it. The user is thus advised to read about the id3v2 standard before using this module.
Currently, only attaching text-based frames are supported.
Reading tag's frames can only be done currently through the
common tag_title
, ... API.
See examples/tagutil.ml
for an example of the use of this module.
typestate =
[ `Invalid | `Parsed | `Valid ]
State of the tag. This is used to enforce validity of the generated tag.
A tag is valid iff it has been properly parsed or at least one frame has been added to it.
type [< state ]
id3v2_tag
type[< state ]
id3v2 =([< state ] as 'a) id3v2_tag Taglib.t
typeframe_type =
string
A frame type is the id3v2 identifier, e.g. TIT2, TALB, ...
typeframe_text =
string
Text content of a frame.
val init : unit -> [ `Invalid ] id3v2
val header_size : int
val parse_header : [ `Invalid ] id3v2 ->
string -> [ `Parsed ] id3v2
val tag_size : [< `Parsed | `Valid ] id3v2 -> int
val parse_tag : [ `Parsed ] id3v2 ->
string -> [ `Valid ] id3v2
val attach_frame : [< `Invalid | `Valid ] id3v2 ->
frame_type ->
frame_text -> [ `Valid ] id3v2
val render : [ `Valid ] id3v2 -> string
These functions perform the same operations as their counter-part from Taglib
.
The only difference here is that they return a valid tag.
val tag_set_title : [< `Invalid | `Valid ] id3v2 ->
string -> [ `Valid ] id3v2
val tag_set_artist : [< `Invalid | `Valid ] id3v2 ->
string -> [ `Valid ] id3v2
val tag_set_album : [< `Invalid | `Valid ] id3v2 ->
string -> [ `Valid ] id3v2
val tag_set_comment : [< `Invalid | `Valid ] id3v2 ->
string -> [ `Valid ] id3v2
val tag_set_genre : [< `Invalid | `Valid ] id3v2 ->
string -> [ `Valid ] id3v2
val tag_set_year : [< `Invalid | `Valid ] id3v2 ->
int -> [ `Valid ] id3v2
val tag_set_track : [< `Invalid | `Valid ] id3v2 ->
int -> [ `Valid ] id3v2