dealer

package
v0.10.7 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: GPL-3.0 Imports: 18 Imported by: 4 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDealerClosed = errors.New("dealer closed")

Functions

This section is empty.

Types

type Dealer

type Dealer struct {
	// contains filtered or unexported fields
}

func NewDealer

func NewDealer(log librespot.Logger, client *http.Client, dealerAddr librespot.GetAddressFunc, accessToken librespot.GetLogin5TokenFunc) *Dealer

func (*Dealer) Close

func (d *Dealer) Close()

func (*Dealer) Connect

func (d *Dealer) Connect(ctx context.Context) error

func (*Dealer) ReceiveMessage

func (d *Dealer) ReceiveMessage(uriPrefixes ...string) <-chan Message

func (*Dealer) ReceiveRequest

func (d *Dealer) ReceiveRequest(uri string) <-chan Request

type Message

type Message struct {
	Uri     string
	Headers map[string]string
	Payload []byte
}

type RawMessage

type RawMessage struct {
	Type         string            `json:"type"`
	Method       string            `json:"method"`
	Uri          string            `json:"uri"`
	Headers      map[string]string `json:"headers"`
	MessageIdent string            `json:"message_ident"`
	Key          string            `json:"key"`
	Payloads     []interface{}     `json:"payloads"`
	Payload      struct {
		Compressed []byte `json:"compressed"`
	} `json:"payload"`
}

type Reply

type Reply struct {
	Type    string `json:"type"`
	Key     string `json:"key"`
	Payload struct {
		Success bool `json:"success"`
	} `json:"payload"`
}

type Request

type Request struct {
	MessageIdent string
	Payload      RequestPayload
	// contains filtered or unexported fields
}

func (Request) Reply

func (req Request) Reply(success bool)

type RequestPayload

type RequestPayload struct {
	MessageId      uint32 `json:"message_id"`
	SentByDeviceId string `json:"sent_by_device_id"`
	Command        struct {
		Endpoint  string      `json:"endpoint"`
		SessionId string      `json:"session_id"`
		Data      []byte      `json:"data"`
		Value     interface{} `json:"value"`
		Position  int64       `json:"position"`
		Relative  string      `json:"relative"`
		TimerType *struct {
			Type      string `json:"type"`
			DurationS int64  `json:"duration_s"`
		} `json:"timer_type"`
		Context          *connectpb.Context        `json:"context"`
		PlayOrigin       *connectpb.PlayOrigin     `json:"play_origin"`
		Track            *connectpb.ContextTrack   `json:"track"`
		PrevTracks       []*connectpb.ContextTrack `json:"prev_tracks"`
		NextTracks       []*connectpb.ContextTrack `json:"next_tracks"`
		RepeatingTrack   *bool                     `json:"repeating_track"`
		RepeatingContext *bool                     `json:"repeating_context"`
		ShufflingContext *bool                     `json:"shuffling_context"`
		Modes            map[string]string         `json:"modes"`
		LoggingParams    struct {
			CommandInitiatedTime int64    `json:"command_initiated_time"`
			PageInstanceIds      []string `json:"page_instance_ids"`
			InteractionIds       []string `json:"interaction_ids"`
			DeviceIdentifier     string   `json:"device_identifier"`
		} `json:"logging_params"`
		Options struct {
			RestorePaused       string `json:"restore_paused"`
			RestorePosition     string `json:"restore_position"`
			RestoreTrack        string `json:"restore_track"`
			RetainSession       string `json:"retain_session"`
			AlwaysPlaySomething bool   `json:"always_play_something"`
			AllowSeeking        bool   `json:"allow_seeking"`
			SkipTo              struct {
				TrackUid   string `json:"track_uid"`
				TrackUri   string `json:"track_uri"`
				TrackIndex int    `json:"track_index"`
			} `json:"skip_to"`
			InitiallyPaused       bool                                    `json:"initially_paused"`
			SystemInitiated       bool                                    `json:"system_initiated"`
			PlayerOptionsOverride *connectpb.ContextPlayerOptionOverrides `json:"player_options_override"`
			Suppressions          *connectpb.Suppressions                 `json:"suppressions"`
			PrefetchLevel         string                                  `json:"prefetch_level"`
			AudioStream           string                                  `json:"audio_stream"`
			SessionId             string                                  `json:"session_id"`
			License               string                                  `json:"license"`
		} `json:"options"`
		PlayOptions struct {
			OverrideRestrictions bool   `json:"override_restrictions"`
			OnlyForLocalDevice   bool   `json:"only_for_local_device"`
			SystemInitiated      bool   `json:"system_initiated"`
			Reason               string `json:"reason"`
			Operation            string `json:"operation"`
			Trigger              string `json:"trigger"`
		} `json:"play_options"`
		FromDeviceIdentifier string `json:"from_device_identifier"`
	} `json:"command"`

	// RawCommand holds the command object's raw JSON, populated separately
	// from Command above (see handleRequest). Command only exposes the
	// fields we've modeled; a payload field we haven't added yet silently
	// disappears on unmarshal otherwise, which makes an unhandled command's
	// actual shape impossible to inspect from Command alone.
	RawCommand json.RawMessage `json:"-"`
}

Jump to

Keyboard shortcuts

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