odmobile

package
v1.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package odmobile is the OpenDeezer engine exposed for gomobile (gobind), so a native Android (or iOS) app can drive the same login/decrypt/decode/playback pipeline the desktop GUIs use. Build it with:

gomobile bind -target=android -androidapi 24 -o gui/android/app/libs/odmobile.aar ./mobile

Every browse/list call returns a JSON string (the wire shape the GUIs already use); mutations return bool/string. The caller polls FinishedCount to drive auto-advance, mirroring the C-archive frontends.

Index

Constants

View Source
const Version = version.Number

Version is the engine/app version (single source: internal/version).

Variables

This section is empty.

Functions

func Account

func Account() string

func AddFavorite

func AddFavorite(id string) bool

func AddToPlaylist

func AddToPlaylist(playlistID, trackID string) bool

func AlbumTracks

func AlbumTracks(id string) string

func ArtistProfile

func ArtistProfile(id string) string

func ArtistTop

func ArtistTop(id string) string

func CancelSleepTimer added in v1.6.0

func CancelSleepTimer()

CancelSleepTimer disarms the sleep timer.

func Charts

func Charts() string

func CheckUpdate added in v1.5.1

func CheckUpdate() string

CheckUpdate checks GitHub for a newer release; returns JSON {current, latest, hasUpdate, url, notes}.

func ConnectDevice

func ConnectDevice(addr string) bool

ConnectDevice routes playback to the device at addr (host:port). Stops local playback (audio moves to the device). Returns true on success.

func ConnectHostInfo added in v1.5.1

func ConnectHostInfo() string

ConnectHostInfo returns a JSON string: {"enabled":bool,"addr":"<lanip>:<port>","port":<int>,"name":"<account>"}. addr/name are empty when the Connect host is disabled.

func ConnectHostSetEnabled added in v1.5.1

func ConnectHostSetEnabled(on int)

ConnectHostSetEnabled makes this device a discoverable OpenDeezer Connect target on the LAN (on!=0), so other devices signed into the same Deezer account can find it in their device picker and drive its playback; or stops advertising it (on==0). The control server runs on a LAN address with same-account auth. Idempotent.

func ConnectedDevice

func ConnectedDevice() string

ConnectedDevice returns the connected device address ("" if local).

func CreatePlaylist

func CreatePlaylist(title string) string

func CrossfadeMS

func CrossfadeMS() int

func DeletePlaylist

func DeletePlaylist(id string) bool

func DisconnectDevice

func DisconnectDevice()

DisconnectDevice returns control to local playback. Stops the remote device (so it doesn't keep playing unattended) before clearing the connection.

func DiscoverDevices

func DiscoverDevices(timeoutMS int) string

DiscoverDevices returns LAN + configured Connect devices as a JSON array.

func DurationMS

func DurationMS() int64

func EQJSON added in v1.7.0

func EQJSON() string

EQJSON returns the equalizer state: {enabled,mono,preampDb,gainsDb:[10],preset,bands:[10],presets:[...]}. Same wire shape as corelib's DZEQJSON so every client renders the same UI.

func Favorites

func Favorites() string

func Fetch

func Fetch(url string) []byte

Fetch downloads raw bytes (e.g. cover art) using a browser User-Agent.

func FinishedCount

func FinishedCount() int

func Flow

func Flow() string

func Format

func Format() string

func Gapless

func Gapless() bool

func Home added in v1.5.0

func Home() string

Home aggregates the Home-screen sections (charts top tracks/albums + the user's playlists) in one call, mirroring corelib DZHomeJSON. Best-effort.

func Init

func Init(arl string) bool

Init logs in with the ARL and starts the engine. Returns true on success.

func LoggedIn

func LoggedIn() bool

LoggedIn reports whether Init succeeded.

func LoginErrorKind added in v1.8.3

func LoginErrorKind() int

LoginErrorKind returns why the most recent Init failed so the UI shows a No-Internet retry screen instead of forcing re-auth: 0 = ok, 1 = ARL expired or invalid, 2 = no internet, 3 = other.

func Logout added in v1.7.0

func Logout()

Logout tears the engine session down: stops playback, closes the control server (dropping web-remote pairing sessions and the old account's same-account auth), stops Connect-host advertising, and forgets the Deezer client. A later Init starts services fresh for the new account.

func Lyrics

func Lyrics(id string) string

func NowPlaying

func NowPlaying() string

NowPlaying returns the track actually playing (remote when routed, else local).

func Pause

func Pause()

func Play

func Play(trackID string, durationMS int64) bool

Play resolves + plays a track. When routed to a Connect device, it plays there.

func PlayEpisode

func PlayEpisode(id string) bool

PlayEpisode resolves + plays a podcast episode (plain stream) with an unknown duration. Prefer PlayEpisodeMS when the caller knows the duration.

func PlayEpisodeMS added in v1.7.0

func PlayEpisodeMS(id string, durationMS int64) bool

PlayEpisodeMS resolves + plays a podcast episode (plain stream). Sets the episode as the current track immediately (id + duration, mirroring corelib DZPlayEpisode — the player never derives duration from the stream), then asynchronously enriches title / podcast name / artwork via REST /episode.

func PlaylistTracks

func PlaylistTracks(id string) string

func Playlists

func Playlists() string

func PodcastEpisodes

func PodcastEpisodes(id string) string

func PositionMS

func PositionMS() int64

func Quality

func Quality() int

func RemoveFavorite

func RemoveFavorite(id string) bool

func RemoveFromPlaylist

func RemoveFromPlaylist(playlistID, trackID string) bool

func RenamePlaylist

func RenamePlaylist(id, title string) bool

func ReplayGain

func ReplayGain() bool

func Resume

func Resume()
func Search(q string) string

func SearchPodcasts

func SearchPodcasts(q string) string

func Seek

func Seek(ms int64)

func SetClientInfo

func SetClientInfo(clientName, device string)

SetClientInfo overrides the advertised client id + device label (before Init).

func SetCrossfadeMS

func SetCrossfadeMS(ms int)

func SetEQJSON added in v1.7.0

func SetEQJSON(js string) bool

SetEQJSON applies a partial EQ update. Recognized keys (all optional): enabled (bool), mono (bool), preampDb (number), gainsDb ([10]number), preset (string), band ({"index":N,"gainDb":X}). Returns false if any present key failed to apply.

func SetGapless

func SetGapless(on bool)

func SetOutputSuspended added in v1.7.0

func SetOutputSuspended(on bool)

SetOutputSuspended suspends (true) or resumes (false) the local OS audio device without touching playback state — for audio-focus/route handling on mobile. Local-only: it never routes to a Connect device.

func SetQuality

func SetQuality(level int)

func SetRepeat added in v1.0.1

func SetRepeat(mode int)

SetRepeat sets the repeat mode on the connected remote device (mode: 0=off, 1=all, 2=one). No-op when playing locally — GUIs own their queue.

func SetReplayGain

func SetReplayGain(on bool)

func SetShuffle added in v1.0.1

func SetShuffle(on int)

SetShuffle sets shuffle on (non-zero) or off (0) on the connected remote device. No-op when playing locally — GUIs own their queue.

func SetSleepTimer added in v1.6.0

func SetSleepTimer(minutes int, endOfTrack int)

SetSleepTimer arms the sleep timer: pause after `minutes` (with a fade-out), or when the current track ends if endOfTrack != 0 (minutes ignored). minutes <= 0 with endOfTrack == 0 cancels it.

func SetVolume

func SetVolume(v float64)

func SleepActive added in v1.6.0

func SleepActive() int

SleepActive reports whether a sleep timer is armed (1) or not (0).

func SleepEndOfTrack added in v1.6.0

func SleepEndOfTrack() int

SleepEndOfTrack reports whether the armed timer is end-of-track mode (1/0).

func SleepRemainingMS added in v1.6.0

func SleepRemainingMS() int64

SleepRemainingMS returns milliseconds until the timer fires (0 if none).

func State

func State() int

func Stop

func Stop()

func TogglePause

func TogglePause()

func UserID

func UserID() string

func Volume

func Volume() float64

func WebRemoteInfo added in v1.0.1

func WebRemoteInfo() string

WebRemoteInfo returns a JSON string: {"enabled":bool,"code":"123456","url":"http://<lanip>:<port>/remote","port":<int>}. code and url are empty when the remote is disabled.

func WebRemoteQRPNG added in v1.0.1

func WebRemoteQRPNG() []byte

WebRemoteQRPNG returns a PNG-encoded QR code for the web remote URL, or nil when the remote is disabled. Free-able by the caller (Go GC manages it).

func WebRemoteSetEnabled added in v1.0.1

func WebRemoteSetEnabled(on int)

WebRemoteSetEnabled enables (on!=0) or disables (on==0) the web remote. When enabling, the control server is started on a LAN-reachable address if it is not already, and pairing is activated so a phone can scan the QR and connect.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL