High-level operations composed from NetMD.Interface commands, ported
from netmd-js's netmd-commands.
Divergence from the reference: the title-space estimation
(remaining_characters_for_titles/2 and friends) computes group ranges
cleanly where the reference's JavaScript accidentally splices "false"
and "null" strings into its worst-case length estimates.
Summary
Functions
TOC cells needed for a track's titles, as {half_width, full_width}.
Compile raw disc title strings with group markup from a NetMD.Disc,
fitting as many groups as the TOC allows.
Current device state: disc presence, operating state, track and time.
Download a track to the disc: prepare, run a secure session, transfer, and release the device.
Full disc listing: title, capacity, groups and per-track details.
Get the device ready for downloads: wait until it is idle, clear any stale secure session and take control.
Characters still available for titling, as {half_width, full_width}.
Rename the disc, preserving any group markup in the raw title.
Write a disc's group structure back to the TOC.
Convert an {hours, minutes, seconds, frames} tuple to frames
(512 per second).
Upload a track from the disc (MZ-RH1 only), returning the disc format and the audio prefixed with a playable header: AEA for SP, WAV with the ATRAC3 format tag for LP2/LP4.
Types
@type error() :: NetMD.Interface.error()
Functions
@spec cells_for_title(NetMD.Disc.Track.t()) :: {non_neg_integer(), non_neg_integer()}
TOC cells needed for a track's titles, as {half_width, full_width}.
@spec compile_disc_titles(NetMD.Disc.t()) :: {String.t(), String.t()}
Compile raw disc title strings with group markup from a NetMD.Disc,
fitting as many groups as the TOC allows.
@spec device_status(NetMD.Device.t()) :: {:ok, %{ disc_present: boolean(), state: atom(), track: non_neg_integer() | nil, time: %{minute: integer(), second: integer(), frame: integer()} | nil }} | error()
Current device state: disc presence, operating state, track and time.
@spec download(NetMD.Device.t(), NetMD.Track.t(), keyword()) :: {:ok, %{track: non_neg_integer(), uuid: binary(), ccid: binary()}} | error()
Download a track to the disc: prepare, run a secure session, transfer, and release the device.
Options: :progress, :settle_ms (see NetMD.Interface.send_track/8),
:disc_format (see NetMD.Session.download_track/3) and :attempts
(see prepare_download/2).
@spec list_content(NetMD.Device.t()) :: {:ok, NetMD.Disc.t()} | error()
Full disc listing: title, capacity, groups and per-track details.
@spec prepare_download( NetMD.Device.t(), keyword() ) :: :ok | error()
Get the device ready for downloads: wait until it is idle, clear any stale secure session and take control.
@spec remaining_characters_for_titles( NetMD.Disc.t(), keyword() ) :: {non_neg_integer(), non_neg_integer()}
Characters still available for titling, as {half_width, full_width}.
@spec rename_disc(NetMD.Device.t(), String.t(), keyword()) :: :ok | error()
Rename the disc, preserving any group markup in the raw title.
Accepts full_width_title: to also set the full-width title.
@spec rewrite_disc_groups(NetMD.Device.t(), NetMD.Disc.t()) :: :ok | error()
Write a disc's group structure back to the TOC.
Convert an {hours, minutes, seconds, frames} tuple to frames
(512 per second).
@spec upload(NetMD.Device.t(), non_neg_integer(), keyword()) :: {:ok, %{format: byte(), data: binary()}} | error()
Upload a track from the disc (MZ-RH1 only), returning the disc format and the audio prefixed with a playable header: AEA for SP, WAV with the ATRAC3 format tag for LP2/LP4.
Options are passed to NetMD.Interface.save_track_to_binary/3.