rockbox/types

Domain types and JSON decoders shared across the SDK.

Types

pub type Album {
  Album(
    id: String,
    title: String,
    artist: String,
    year: Int,
    year_string: String,
    album_art: option.Option(String),
    md5: String,
    artist_id: String,
    copyright_message: option.Option(String),
    tracks: List(Track),
  )
}

Constructors

  • Album(
      id: String,
      title: String,
      artist: String,
      year: Int,
      year_string: String,
      album_art: option.Option(String),
      md5: String,
      artist_id: String,
      copyright_message: option.Option(String),
      tracks: List(Track),
    )
pub type Artist {
  Artist(
    id: String,
    name: String,
    bio: option.Option(String),
    image: option.Option(String),
    tracks: List(Track),
    albums: List(Album),
  )
}

Constructors

pub type BluetoothDevice {
  BluetoothDevice(
    address: String,
    name: String,
    paired: Bool,
    trusted: Bool,
    connected: Bool,
    rssi: option.Option(Int),
  )
}

Constructors

  • BluetoothDevice(
      address: String,
      name: String,
      paired: Bool,
      trusted: Bool,
      connected: Bool,
      rssi: option.Option(Int),
    )
pub type ChannelConfig {
  Stereo
  StereoNarrow
  Mono
  LeftMix
  RightMix
  Karaoke
}

Constructors

  • Stereo
  • StereoNarrow
  • Mono
  • LeftMix
  • RightMix
  • Karaoke
pub type CompressorSettings {
  CompressorSettings(
    threshold: Int,
    makeup_gain: Int,
    ratio: Int,
    knee: Int,
    release_time: Int,
    attack_time: Int,
  )
}

Constructors

  • CompressorSettings(
      threshold: Int,
      makeup_gain: Int,
      ratio: Int,
      knee: Int,
      release_time: Int,
      attack_time: Int,
    )
pub type Device {
  Device(
    id: String,
    name: String,
    host: String,
    ip: String,
    port: Int,
    service: String,
    app: String,
    is_connected: Bool,
    base_url: option.Option(String),
    is_cast_device: Bool,
    is_source_device: Bool,
    is_current_device: Bool,
  )
}

Constructors

  • Device(
      id: String,
      name: String,
      host: String,
      ip: String,
      port: Int,
      service: String,
      app: String,
      is_connected: Bool,
      base_url: option.Option(String),
      is_cast_device: Bool,
      is_source_device: Bool,
      is_current_device: Bool,
    )
pub type Entry {
  Entry(
    name: String,
    attr: Int,
    time_write: Int,
    customaction: Int,
    display_name: option.Option(String),
  )
}

Constructors

  • Entry(
      name: String,
      attr: Int,
      time_write: Int,
      customaction: Int,
      display_name: option.Option(String),
    )

    Arguments

    attr

    Bitmask: bit 4 (0x10) marks a directory.

    display_name

    Human-readable display name (used for UPnP entries).

pub type EqBandSetting {
  EqBandSetting(cutoff: Int, q: Int, gain: Int)
}

Constructors

  • EqBandSetting(cutoff: Int, q: Int, gain: Int)

Where new tracks land in the queue (matches Mopidy/Kodi conventions).

pub type InsertPosition {
  Next
  AfterCurrent
  Last
  First
}

Constructors

  • Next

    Right after the currently playing track.

  • AfterCurrent

    After the last manually inserted track.

  • Last

    At the very end of the queue.

  • First

    Replace the entire playlist.

pub type PlaybackStatus {
  Stopped
  Playing
  Paused
  UnknownStatus(Int)
}

Constructors

  • Stopped
  • Playing
  • Paused
  • UnknownStatus(Int)
pub type Playlist {
  Playlist(
    amount: Int,
    index: Int,
    max_playlist_size: Int,
    first_index: Int,
    last_insert_pos: Int,
    seed: Int,
    last_shuffled_start: Int,
    tracks: List(Track),
  )
}

Constructors

  • Playlist(
      amount: Int,
      index: Int,
      max_playlist_size: Int,
      first_index: Int,
      last_insert_pos: Int,
      seed: Int,
      last_shuffled_start: Int,
      tracks: List(Track),
    )
pub type RepeatMode {
  RepeatOff
  RepeatAll
  RepeatOne
  RepeatShuffle
  RepeatAB
}

Constructors

  • RepeatOff
  • RepeatAll
  • RepeatOne
  • RepeatShuffle
  • RepeatAB
pub type ReplaygainSettings {
  ReplaygainSettings(noclip: Bool, type_: Int, preamp: Int)
}

Constructors

  • ReplaygainSettings(noclip: Bool, type_: Int, preamp: Int)
pub type ReplaygainType {
  ReplaygainTrack
  ReplaygainAlbum
  ReplaygainShuffle
}

Constructors

  • ReplaygainTrack
  • ReplaygainAlbum
  • ReplaygainShuffle
pub type SavedPlaylist {
  SavedPlaylist(
    id: String,
    name: String,
    description: option.Option(String),
    image: option.Option(String),
    folder_id: option.Option(String),
    track_count: Int,
    created_at: Int,
    updated_at: Int,
  )
}

Constructors

  • SavedPlaylist(
      id: String,
      name: String,
      description: option.Option(String),
      image: option.Option(String),
      folder_id: option.Option(String),
      track_count: Int,
      created_at: Int,
      updated_at: Int,
    )
pub type SavedPlaylistFolder {
  SavedPlaylistFolder(
    id: String,
    name: String,
    created_at: Int,
    updated_at: Int,
  )
}

Constructors

  • SavedPlaylistFolder(
      id: String,
      name: String,
      created_at: Int,
      updated_at: Int,
    )
pub type SearchResults {
  SearchResults(
    artists: List(Artist),
    albums: List(Album),
    tracks: List(Track),
    liked_tracks: List(Track),
    liked_albums: List(Album),
  )
}

Constructors

  • SearchResults(
      artists: List(Artist),
      albums: List(Album),
      tracks: List(Track),
      liked_tracks: List(Track),
      liked_albums: List(Album),
    )
pub type SmartPlaylist {
  SmartPlaylist(
    id: String,
    name: String,
    description: option.Option(String),
    image: option.Option(String),
    folder_id: option.Option(String),
    is_system: Bool,
    rules: String,
    created_at: Int,
    updated_at: Int,
  )
}

Constructors

  • SmartPlaylist(
      id: String,
      name: String,
      description: option.Option(String),
      image: option.Option(String),
      folder_id: option.Option(String),
      is_system: Bool,
      rules: String,
      created_at: Int,
      updated_at: Int,
    )

    Arguments

    rules

    JSON-encoded rules string.

pub type SystemStatus {
  SystemStatus(
    resume_index: Int,
    resume_crc32: Int,
    resume_elapsed: Int,
    resume_offset: Int,
    runtime: Int,
    topruntime: Int,
    dircache_size: Int,
    last_screen: Int,
    viewer_icon_count: Int,
    last_volume_change: Int,
  )
}

Constructors

  • SystemStatus(
      resume_index: Int,
      resume_crc32: Int,
      resume_elapsed: Int,
      resume_offset: Int,
      runtime: Int,
      topruntime: Int,
      dircache_size: Int,
      last_screen: Int,
      viewer_icon_count: Int,
      last_volume_change: Int,
    )
pub type Track {
  Track(
    id: option.Option(String),
    title: String,
    artist: String,
    album: String,
    genre: String,
    disc: String,
    track_string: String,
    year_string: String,
    composer: String,
    comment: String,
    album_artist: String,
    grouping: String,
    discnum: Int,
    tracknum: Int,
    layer: Int,
    year: Int,
    bitrate: Int,
    frequency: Int,
    filesize: Int,
    length: Int,
    elapsed: Int,
    path: String,
    album_id: option.Option(String),
    artist_id: option.Option(String),
    genre_id: option.Option(String),
    album_art: option.Option(String),
  )
}

Constructors

  • Track(
      id: option.Option(String),
      title: String,
      artist: String,
      album: String,
      genre: String,
      disc: String,
      track_string: String,
      year_string: String,
      composer: String,
      comment: String,
      album_artist: String,
      grouping: String,
      discnum: Int,
      tracknum: Int,
      layer: Int,
      year: Int,
      bitrate: Int,
      frequency: Int,
      filesize: Int,
      length: Int,
      elapsed: Int,
      path: String,
      album_id: option.Option(String),
      artist_id: option.Option(String),
      genre_id: option.Option(String),
      album_art: option.Option(String),
    )

    Arguments

    length

    Duration in milliseconds.

    elapsed

    Current playback position in milliseconds.

pub type TrackStats {
  TrackStats(
    track_id: String,
    play_count: Int,
    skip_count: Int,
    last_played: option.Option(Int),
    last_skipped: option.Option(Int),
    updated_at: Int,
  )
}

Constructors

  • TrackStats(
      track_id: String,
      play_count: Int,
      skip_count: Int,
      last_played: option.Option(Int),
      last_skipped: option.Option(Int),
      updated_at: Int,
    )
pub type UserSettings {
  UserSettings(
    music_dir: String,
    volume: Int,
    balance: Int,
    bass: Int,
    treble: Int,
    channel_config: Int,
    stereo_width: Int,
    eq_enabled: Bool,
    eq_precut: Int,
    eq_band_settings: List(EqBandSetting),
    replaygain_settings: ReplaygainSettings,
    compressor_settings: CompressorSettings,
    crossfade_enabled: Int,
    crossfade_fade_in_delay: Int,
    crossfade_fade_in_duration: Int,
    crossfade_fade_out_delay: Int,
    crossfade_fade_out_duration: Int,
    crossfade_fade_out_mixmode: Int,
    crossfeed_enabled: Bool,
    crossfeed_direct_gain: Int,
    crossfeed_cross_gain: Int,
    crossfeed_hf_attenuation: Int,
    crossfeed_hf_cutoff: Int,
    repeat_mode: Int,
    single_mode: Bool,
    party_mode: Bool,
    shuffle: Bool,
    player_name: String,
  )
}

Constructors

  • UserSettings(
      music_dir: String,
      volume: Int,
      balance: Int,
      bass: Int,
      treble: Int,
      channel_config: Int,
      stereo_width: Int,
      eq_enabled: Bool,
      eq_precut: Int,
      eq_band_settings: List(EqBandSetting),
      replaygain_settings: ReplaygainSettings,
      compressor_settings: CompressorSettings,
      crossfade_enabled: Int,
      crossfade_fade_in_delay: Int,
      crossfade_fade_in_duration: Int,
      crossfade_fade_out_delay: Int,
      crossfade_fade_out_duration: Int,
      crossfade_fade_out_mixmode: Int,
      crossfeed_enabled: Bool,
      crossfeed_direct_gain: Int,
      crossfeed_cross_gain: Int,
      crossfeed_hf_attenuation: Int,
      crossfeed_hf_cutoff: Int,
      repeat_mode: Int,
      single_mode: Bool,
      party_mode: Bool,
      shuffle: Bool,
      player_name: String,
    )
pub type VolumeInfo {
  VolumeInfo(volume: Int, min: Int, max: Int)
}

Constructors

  • VolumeInfo(volume: Int, min: Int, max: Int)

Values

pub fn album_decoder() -> decode.Decoder(Album)
pub fn artist_decoder() -> decode.Decoder(Artist)
pub fn bluetooth_device_decoder() -> decode.Decoder(
  BluetoothDevice,
)
pub fn channel_config_to_int(config: ChannelConfig) -> Int
pub fn compressor_settings_decoder() -> decode.Decoder(
  CompressorSettings,
)
pub fn device_decoder() -> decode.Decoder(Device)
pub fn entry_decoder() -> decode.Decoder(Entry)
pub fn eq_band_setting_decoder() -> decode.Decoder(EqBandSetting)
pub fn insert_position_to_int(position: InsertPosition) -> Int
pub fn is_directory(entry: Entry) -> Bool

True when a directory bit (0x10) is set on the entry’s attribute mask.

pub fn playback_status_from_int(value: Int) -> PlaybackStatus
pub fn playback_status_to_int(status: PlaybackStatus) -> Int
pub fn playlist_decoder() -> decode.Decoder(Playlist)
pub fn repeat_mode_to_int(mode: RepeatMode) -> Int
pub fn replaygain_settings_decoder() -> decode.Decoder(
  ReplaygainSettings,
)
pub fn saved_playlist_folder_decoder() -> decode.Decoder(
  SavedPlaylistFolder,
)
pub fn system_status_decoder() -> decode.Decoder(SystemStatus)
pub fn track_decoder() -> decode.Decoder(Track)
pub fn track_stats_decoder() -> decode.Decoder(TrackStats)
pub fn user_settings_decoder() -> decode.Decoder(UserSettings)
pub fn volume_info_decoder() -> decode.Decoder(VolumeInfo)
Search Document