chromecast

package module
v0.0.0-...-531a2f0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: MIT Imports: 4 Imported by: 0

README

Build status

go-cast

A command line tool to control Google Chromecast devices.

Installation

Download the latest binaries from: https://github.com/oliverpool/go-chromecast/releases/latest

$ sudo mv cast-my-platform /usr/local/bin/cast
$ sudo chmod +x /usr/local/bin/cast

Usage

$ cast help

Play a media file:

$ cast --name Hifi media play http://url/file.mp3

Stop playback:

$ cast --name Hifi media stop

Set volume:

$ cast --name Hifi volume 0.5

Close app on the Chromecast:

$ cast --name Hifi quit

Bug reports

Please open a github issue including cast version number cast --version.

Pull requests

Pull requests are gratefully received!

  • please 'gofmt' the code.

Credits

Based on go library port by ninjasphere

Documentation

Index

Constants

View Source
const ErrAppNotFound = ErrorString("app not found")

ErrAppNotFound is returned when a given app was not found

Variables

View Source
var Version = "dev" /* passed in by travis build */

Functions

This section is empty.

Types

type AmpController

type AmpController interface {
	Mute(muted bool) error
	SetVolume(level float64) error
	Quit() error
}

type ApplicationSession

type ApplicationSession struct {
	AppID       *string      `json:"appId,omitempty"`
	DisplayName *string      `json:"displayName,omitempty"`
	Namespaces  []*Namespace `json:"namespaces"`
	SessionID   *string      `json:"sessionId,omitempty"`
	StatusText  *string      `json:"statusText,omitempty"`
	TransportId *string      `json:"transportId,omitempty"`
}

type Client

type Client interface {
	Listener
	Sender
	Requester
	Close() error
}

Client interface is too weak

type Device

type Device struct {
	IP         net.IP
	Port       int
	Properties map[string]string
}

func (Device) Addr

func (d Device) Addr() string

func (Device) ID

func (d Device) ID() string

func (Device) Name

func (d Device) Name() string

func (Device) Status

func (d Device) Status() string

func (Device) Type

func (d Device) Type() string

type Envelope

type Envelope struct {
	Source, Destination, Namespace string
}

type ErrorString

type ErrorString string

ErrorString represents some constant errors

func (ErrorString) Error

func (e ErrorString) Error() string

Error returns the underlying error string

type IdentifiablePayload

type IdentifiablePayload interface {
	SetRequestID(uint32)
}

type Launcher

type Launcher interface {
	Launch(appID string) (Status, error)
	Stop() (Status, error)
}

type Listener

type Listener interface {
	Listen(env Envelope, responseType string, ch chan<- []byte)
}

Listener allows to listen to specific messages and forward them (non-blocking) on ch

type Logger

type Logger interface {
	Log(keyvals ...interface{}) error
}

Logger is for structured logging in services (like in https://github.com/go-kit/kit/tree/master/log)

type Namespace

type Namespace struct {
	Name string `json:"name"`
}

type PayloadWithID

type PayloadWithID struct {
	Type      string  `json:"type"`
	RequestID *uint32 `json:"requestId,omitempty"`
}

func (*PayloadWithID) SetRequestID

func (p *PayloadWithID) SetRequestID(id uint32)

type Requester

type Requester interface {
	Request(env Envelope, payload IdentifiablePayload) (<-chan []byte, error)
}

Requester sends a payload and expects one payload as reply

type Scanner

type Scanner interface {
	// Scan scans for chromecast and pushes them onto the results channel (eventually multiple times)
	// It must close the results channel before returning when the ctx is done
	Scan(ctx context.Context, results chan<- *Device) error
}

type Sender

type Sender interface {
	Send(env Envelope, payload interface{}) error
}

Sender sends a payload (without expecting a reply)

type Serializer

type Serializer interface {
	Receive() (Envelope, []byte, error)
	Send(Envelope, []byte) error
}

type Status

type Status struct {
	Applications []*ApplicationSession `json:"applications"`
	Volume       *Volume               `json:"volume,omitempty"`
}

func (Status) AppSupporting

func (st Status) AppSupporting(namespace string) (apps []ApplicationSession)

func (Status) AppWithID

func (st Status) AppWithID(id string) *ApplicationSession

func (Status) FirstDestinationSupporting

func (st Status) FirstDestinationSupporting(namespace string) (string, error)

func (Status) String

func (st Status) String() string

type StatusResponse

type StatusResponse struct {
	Status *Status `json:"status"`
}

type Volume

type Volume struct {
	Level *float64 `json:"level,omitempty"`
	Muted *bool    `json:"muted,omitempty"`
}

Directories

Path Synopsis
cli
cmd
Package discovery is used to discover devices on the network using a provided scanner
Package discovery is used to discover devices on the network using a provided scanner
zeroconf
Package zeroconf provides a Scanner backed by the github.com/grandcat/zeroconf package
Package zeroconf provides a Scanner backed by the github.com/grandcat/zeroconf package
pb
Package pb is a generated protocol buffer package.
Package pb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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