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
- func Account() string
- func AddFavorite(id string) bool
- func AddToPlaylist(playlistID, trackID string) bool
- func AlbumTracks(id string) string
- func ArtistProfile(id string) string
- func ArtistTop(id string) string
- func CancelSleepTimer()
- func Charts() string
- func CheckUpdate() string
- func ConnectDevice(addr string) bool
- func ConnectHostInfo() string
- func ConnectHostSetEnabled(on int)
- func ConnectedDevice() string
- func CreatePlaylist(title string) string
- func CrossfadeMS() int
- func DeletePlaylist(id string) bool
- func DisconnectDevice()
- func DiscoverDevices(timeoutMS int) string
- func DurationMS() int64
- func EQJSON() string
- func Favorites() string
- func Fetch(url string) []byte
- func FinishedCount() int
- func Flow() string
- func Format() string
- func Gapless() bool
- func Home() string
- func Init(arl string) bool
- func LoggedIn() bool
- func LoginErrorKind() int
- func Logout()
- func Lyrics(id string) string
- func NowPlaying() string
- func Pause()
- func Play(trackID string, durationMS int64) bool
- func PlayEpisode(id string) bool
- func PlayEpisodeMS(id string, durationMS int64) bool
- func PlaylistTracks(id string) string
- func Playlists() string
- func PodcastEpisodes(id string) string
- func PositionMS() int64
- func Quality() int
- func RemoveFavorite(id string) bool
- func RemoveFromPlaylist(playlistID, trackID string) bool
- func RenamePlaylist(id, title string) bool
- func ReplayGain() bool
- func Resume()
- func Search(q string) string
- func SearchPodcasts(q string) string
- func Seek(ms int64)
- func SetClientInfo(clientName, device string)
- func SetCrossfadeMS(ms int)
- func SetEQJSON(js string) bool
- func SetGapless(on bool)
- func SetOutputSuspended(on bool)
- func SetQuality(level int)
- func SetRepeat(mode int)
- func SetReplayGain(on bool)
- func SetShuffle(on int)
- func SetSleepTimer(minutes int, endOfTrack int)
- func SetVolume(v float64)
- func SleepActive() int
- func SleepEndOfTrack() int
- func SleepRemainingMS() int64
- func State() int
- func Stop()
- func TogglePause()
- func UserID() string
- func Volume() float64
- func WebRemoteInfo() string
- func WebRemoteQRPNG() []byte
- func WebRemoteSetEnabled(on int)
Constants ¶
const Version = version.Number
Version is the engine/app version (single source: internal/version).
Variables ¶
This section is empty.
Functions ¶
func AddFavorite ¶
func AddToPlaylist ¶
func AlbumTracks ¶
func ArtistProfile ¶
func CancelSleepTimer ¶ added in v1.6.0
func CancelSleepTimer()
CancelSleepTimer disarms the sleep timer.
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 ¶
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 CrossfadeMS ¶
func CrossfadeMS() int
func DeletePlaylist ¶
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 ¶
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 FinishedCount ¶
func FinishedCount() int
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 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 NowPlaying ¶
func NowPlaying() string
NowPlaying returns the track actually playing (remote when routed, else local).
func PlayEpisode ¶
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
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 PodcastEpisodes ¶
func PositionMS ¶
func PositionMS() int64
func RemoveFavorite ¶
func RemoveFromPlaylist ¶
func RenamePlaylist ¶
func ReplayGain ¶
func ReplayGain() bool
func SearchPodcasts ¶
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
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
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 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 TogglePause ¶
func TogglePause()
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.