View Source Id3vx.Tag (Id3vx v0.0.1-rc1)

Utility module for building ID3 tags and common frames conveniently.

Link to this section Summary

Link to this section Types

@type t() :: %Id3vx.Tag{
  extended_header:
    %Id3vx.ExtendedHeaderV3{
      crc_data: term(),
      flags: term(),
      padding_size: term(),
      size: term()
    }
    | %Id3vx.ExtendedHeaderV4{flag_bytes: term(), flags: term(), size: term()},
  flags: %Id3vx.TagFlags{
    experimental: term(),
    extended_header: term(),
    footer: term(),
    unsynchronisation: term()
  },
  footer: term(),
  frames: [Id3vx.Frame.t()],
  revision: integer(),
  size: integer(),
  version: 3 | 4
}

Link to this section Functions

Link to this function

add_attached_picture(container, description, mime_type, image_data, picture_type \\ :other)

View Source
@spec add_attached_picture(
  container :: t() | Id3vx.Frame.Chapter.t(),
  description :: String.t(),
  mime_type :: String.t(),
  image_data :: binary(),
  picture_type :: atom()
) :: t() | Id3vx.Frame.Chapter.t()

Add a picture to a Id3vx.Tag or Id3vx.Frame.Chapter.

Link to this function

add_custom_url(container, description, url)

View Source
@spec add_custom_url(
  container :: t() | Id3vx.Frame.Chapter.t(),
  description :: String.t(),
  url :: String.t()
) :: t() | Id3vx.Frame.Chapter.t()

Add a custom URL to a Id3vx.Tag or Id3vx.Frame.Chapter.

Typically used for Chapters.

Link to this function

add_text_frame(container, frame_id, text)

View Source
@spec add_text_frame(
  container :: t() | Id3vx.Frame.Chapter.t(),
  frame_id :: String.t(),
  text :: String.t()
) :: t() | Id3vx.Frame.Chapter.t()

Add a text frame to a Id3vx.Tag or Id3vx.Frame.Chapter.

Link to this function

add_typical_chapter_and_toc(tag, start_time, end_time, start_offset, end_offset, title, callback)

View Source
@spec add_typical_chapter_and_toc(
  tag :: t(),
  start_time :: integer(),
  end_time :: integer(),
  start_offset :: integer(),
  end_offset :: integer(),
  title :: String.t(),
  callback :: (Id3vx.Frame.Chapter.t() -> Id3vx.Frame.Chapter.t())
) :: t()

Add a typical Id3vx.Frame.Chapter frame to a tag.

The callback gets the new chapter frame and is normally used to add sub-frames like text, links, pictures using the other tag-building utilities in this module.

It also creates a matching Table of Content frame and entry. Essentially it tries to take care of all the annoying bits.

Link to this function

change_element(container, frame_id, element_id, callback)

View Source
@spec change_element(
  container :: t() | Id3vx.Frame.Chapter.t(),
  frame_id :: String.t(),
  element_id :: String.t(),
  callback :: (... -> any())
) :: t() | Id3vx.Frame.Chapter.t()

Change specific frame in a Id3vx.Tag or Id3vx.Frame.Chapter.

Runs the callback on all frames that match the frame ID and the element ID.

Returns the updated container.

Link to this function

change_elements(container, frame_id, callback)

View Source
@spec change_elements(
  container :: t() | Id3vx.Frame.Chapter.t(),
  frame_id :: String.t(),
  callback :: (... -> any())
) :: t() | Id3vx.Frame.Chapter.t()

Change frames in a Id3vx.Tag or Id3vx.Frame.Chapter.

Runs the callback on all frames that match the frame ID.

Returns the updated container.

@spec create(version :: integer()) :: t()

Create a new blank tag for a specific version of the ID3 spec.

Link to this function

delete_chapter(container, element_id)

View Source
@spec delete_chapter(
  container :: t() | Id3vx.Frame.Chapter.t(),
  element_id :: String.t()
) :: t() | Id3vx.Frame.Chapter.t()

Delete a chapter in a Id3vx.Tag.

Delete ToC element and chapter matching element ID.

Returns the updated container.

Link to this function

delete_elements(container, frame_id)

View Source
@spec delete_elements(
  container :: t() | Id3vx.Frame.Chapter.t(),
  frame_id :: String.t()
) :: t() | Id3vx.Frame.Chapter.t()

Delete frames in a Id3vx.Tag or Id3vx.Frame.Chapter.

Deletes all frames matching frame ID.

Returns the updated container.

Link to this function

find_element(container, frame_id)

View Source
@spec find_element(
  container :: t() | Id3vx.Frame.Chapter.t(),
  frame_id :: String.t()
) :: Id3vx.Frame.t() | nil

Find specific frame in a Id3vx.Tag or Id3vx.Frame.Chapter.

Returns the frame if anything matches the frame ID or nil if nothing was found.

Link to this function

find_element(container, frame_id, element_id)

View Source
@spec find_element(
  container :: t() | Id3vx.Frame.Chapter.t(),
  frame_id :: String.t(),
  element_id :: String.t()
) :: Id3vx.Frame.t() | nil

Find specific frame in a Id3vx.Tag or Id3vx.Frame.Chapter.

Returns the frame if anything matches the frame ID and element ID, or nil if nothing was found.