spotify

package module
v0.0.0-...-075b30c Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2015 License: GPL-2.0 Imports: 17 Imported by: 0

README

go.spotify GoDoc Build Status Build status Coverage Status

go.spotify is a set of tools used by cmd/spotifycli in order to control Spotify desktop application and use Web API for searching for artists/albums/tracks.

Installation

In order to install spotifycli application in your environment, Go compiler is required. If environment is configured, please run:

~ $ go get -u github.com/pblaszczyk/go.spotify/cmd/spotifycli
Usage

In order to see available commands please run:

~ $ spotifycli -h

Documentation

Overview

Package spotify provides utilities used to control Spotify desktop application and utilize Spotify Web API.

Index

Constants

This section is empty.

Variables

View Source
var ErrIsRunning = errorf("app is already running")

ErrIsRunning is returned if application is already running.

Functions

func IsEOF

func IsEOF(err error) bool

IsEOF returns a boolean indicating if err is known to be returned when there is no more data to return.

func IsRunning

func IsRunning(err error) bool

IsRunning returns a boolean indicating whether the error is known to report that requested process is already running.

Types

type Album

type Album struct {
	URI     string   // URI is a Spotify URI of the album.
	Name    string   // Name is the name of the album.
	Artists []Artist // Artists is a list of artists of the album.
}

Album is a model for album's data.

type App

type App struct {
	sync.Mutex
	// contains filtered or unexported fields
}

App is a representation of Spotify desktop application.

func NewApp

func NewApp(name string, args ...string) (app *App, err error)

NewApp returns new instance of App.

func (*App) Attach

func (a *App) Attach() (err error)

Attach binds data structure with already running Spotify desktop application.

func (*App) Connected

func (a *App) Connected() (ok bool)

Connected returns a boolean indicating of a is connected to a Spotify instance.

func (*App) Kill

func (a *App) Kill() (err error)

Kill kills Spotify desktop application.

func (*App) Ping

func (a *App) Ping() (err error)

Ping checks if Spotify desktop application is running.

func (*App) Start

func (a *App) Start() (err error)

Start starts Spotify desktop application.

type Artist

type Artist struct {
	URI  string // URI is a Spotify URI of the artist.
	Name string // Name of the artist.
}

Artist is a model for artist's data.

type Dbus

type Dbus struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Dbus is a structure implementing Dbus logic controlling Spotify desktop application.

func NewDbus

func NewDbus() (*Dbus, error)

NewDbus returns a new instance of Dbus.

func (*Dbus) CanControl

func (d *Dbus) CanControl() (bool, error)

CanControl checks if control is available.

func (*Dbus) CanNext

func (d *Dbus) CanNext() (bool, error)

CanNext checks if next is available.

func (*Dbus) CanPlay

func (d *Dbus) CanPlay() (bool, error)

CanPlay returns info if you can play.

func (*Dbus) CanPrev

func (d *Dbus) CanPrev() (bool, error)

CanPrev checks if prev is available.

func (*Dbus) Goto

func (d *Dbus) Goto(offset time.Duration) error

Goto seeks for offset µs.

func (*Dbus) Length

func (d *Dbus) Length() (l time.Duration, err error)

Length returns length of current track.

func (*Dbus) Next

func (d *Dbus) Next() error

Next plays next track.

func (*Dbus) Open

func (d *Dbus) Open(uri URI) error

Open starts playing track with URI.

func (*Dbus) Pause

func (d *Dbus) Pause() error

Pause pauses currently played track.

func (*Dbus) Play

func (d *Dbus) Play() error

Play plays currently active track.

func (*Dbus) Pos

func (d *Dbus) Pos() (time.Duration, error)

Pos returns current position.

func (*Dbus) Prev

func (d *Dbus) Prev() error

Prev plays previous track.

func (*Dbus) Quit

func (d *Dbus) Quit() error

Quit quits Spotify app.

func (*Dbus) Raise

func (d *Dbus) Raise() error

Raise raises Spotify app.

func (*Dbus) SetPos

func (d *Dbus) SetPos(pos time.Duration) error

SetPos goes to specified positionk.

func (*Dbus) Status

func (d *Dbus) Status() (Status, error)

Status returns current status of an app.

func (*Dbus) Stop

func (d *Dbus) Stop() error

Stop stops playing current track.

func (*Dbus) Toggle

func (d *Dbus) Toggle() error

Toggle toggles between play & pause state.

func (*Dbus) Track

func (d *Dbus) Track() (track Track, err error)

Track returns currently played track.

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

Search implements operations for searching through Spotify Web API.

func NewSearch

func NewSearch() *Search

NewSearch returns Search instance.

func (*Search) Album

func (s *Search) Album(name string, c chan<- []Album, errch chan<- error)

Album searches for requested albums. name is the name of searched album, c chan is used to return found albums and err i used to return search errors.

func (*Search) Artist

func (s *Search) Artist(name string, c chan<- []Artist, errch chan<- error)

Artist searches for requested artists. name is the name of searched artist, c chan is used to return found artists and err i used to return search errors.

func (*Search) Track

func (s *Search) Track(name string, c chan<- []Track, errch chan<- error)

Track searches for requested tracks. name is the name of searched track, c chan is used to return found tracks and err i used to return search errors.

type Status

type Status string

Status represents status of Spotify.

const (
	// Playing state.
	Playing Status = "Playing"

	// Paused state.
	Paused Status = "Paused"

	// Stopped state.
	Stopped Status = "Stopped"
)

type Track

type Track struct {
	URI       string   // URI is a Spotify URI of the track.
	Name      string   // Name is the name of the track.
	AlbumURI  string   // AlbumURI is a URI of album containing track.
	AlbumName string   // AlbumName is the name of album containing track.
	Artists   []Artist // Artists is a list of artists of the track.
}

Track is a model for track's data.

func (Track) String

func (t Track) String() string

String implements `Stringer`.

type URI

type URI string

URI is a type representing Spotify URI.

Directories

Path Synopsis
Godeps
_workspace/src/github.com/guelfey/go.dbus
Package dbus implements bindings to the D-Bus message bus system.
Package dbus implements bindings to the D-Bus message bus system.
_workspace/src/github.com/guelfey/go.dbus/introspect
Package introspect provides some utilities for dealing with the DBus introspection format.
Package introspect provides some utilities for dealing with the DBus introspection format.
_workspace/src/github.com/guelfey/go.dbus/prop
Package prop provides the Properties struct which can be used to implement org.freedesktop.DBus.Properties.
Package prop provides the Properties struct which can be used to implement org.freedesktop.DBus.Properties.
_workspace/src/github.com/pblaszczyk/go.utils
Package utils provide access to utils for: - manipulating environment variables, - frequently used fs operations.
Package utils provide access to utils for: - manipulating environment variables, - frequently used fs operations.
_workspace/src/github.com/rthornton128/goncurses
Package goncurses is a new curses (ncurses) library for the Go programming language.
Package goncurses is a new curses (ncurses) library for the Go programming language.
_workspace/src/github.com/rthornton128/goncurses/examples/acs
An example of using AddChar to show a non-standard character.
An example of using AddChar to show a non-standard character.
_workspace/src/github.com/rthornton128/goncurses/examples/color
Demonstrates some of the color facilities of ncurses
Demonstrates some of the color facilities of ncurses
_workspace/src/github.com/rthornton128/goncurses/examples/concurrency
This example demonstrates using goncurses with Go's built-in concurrency primatives.
This example demonstrates using goncurses with Go's built-in concurrency primatives.
_workspace/src/github.com/rthornton128/goncurses/examples/curs_menu
This example show a basic menu similar to that found in the ncurses * examples from TLDP
This example show a basic menu similar to that found in the ncurses * examples from TLDP
_workspace/src/github.com/rthornton128/goncurses/examples/form
This simple example demonstrates how to implement a form
This simple example demonstrates how to implement a form
_workspace/src/github.com/rthornton128/goncurses/examples/getstr
This example demonstrates reading a string from input, rather than a * single character
This example demonstrates reading a string from input, rather than a * single character
_workspace/src/github.com/rthornton128/goncurses/examples/hello
The classic "Hello, World!" program in Goncurses!
The classic "Hello, World!" program in Goncurses!
_workspace/src/github.com/rthornton128/goncurses/examples/init
Demonstrates some of the initilization options for ncurses; In gnome, the F1 key launches help, so F2 is tested for instead
Demonstrates some of the initilization options for ncurses; In gnome, the F1 key launches help, so F2 is tested for instead
_workspace/src/github.com/rthornton128/goncurses/examples/menu
This example demonstrates the use of the menu library
This example demonstrates the use of the menu library
_workspace/src/github.com/rthornton128/goncurses/examples/menu_mcol
This example shows a basic multi-column menu similar to that found in the * ncurses examples from TLDP
This example shows a basic multi-column menu similar to that found in the * ncurses examples from TLDP
_workspace/src/github.com/rthornton128/goncurses/examples/menu_scroll
This example shows a scrolling menu similar to that found in the ncurses * examples from TLDP
This example shows a scrolling menu similar to that found in the ncurses * examples from TLDP
_workspace/src/github.com/rthornton128/goncurses/examples/menu_subwin
This example show a basic menu similar to that found in the ncurses * examples from TLDP
This example show a basic menu similar to that found in the ncurses * examples from TLDP
_workspace/src/github.com/rthornton128/goncurses/examples/menugrey
This example show a basic menu similar to that found in the ncurses * examples from TLDP
This example show a basic menu similar to that found in the ncurses * examples from TLDP
_workspace/src/github.com/rthornton128/goncurses/examples/menutoggle
This example show a basic menu similar to that found in the ncurses * examples from TLDP
This example show a basic menu similar to that found in the ncurses * examples from TLDP
_workspace/src/github.com/rthornton128/goncurses/examples/mouse
Expanding on the basic menu example, the example demonstrates how you * could possibly utilize the mouse to navigate a menu and select options
Expanding on the basic menu example, the example demonstrates how you * could possibly utilize the mouse to navigate a menu and select options
_workspace/src/github.com/rthornton128/goncurses/examples/newterm
This example demonstrates how one might write to multiple terminals from a single program or redirect output.
This example demonstrates how one might write to multiple terminals from a single program or redirect output.
_workspace/src/github.com/rthornton128/goncurses/examples/pad
A basic example of how to create and display a pad.
A basic example of how to create and display a pad.
A simmple example of how to use panels
_workspace/src/github.com/rthornton128/goncurses/examples/panel2
A slightly more advanced example of how to use the panel routines
A slightly more advanced example of how to use the panel routines
_workspace/src/github.com/rthornton128/goncurses/examples/print
This example demonstrates the use of the print function.
This example demonstrates the use of the print function.
_workspace/src/github.com/rthornton128/goncurses/examples/slk
Demonstarates the use of the SLK Soft-Keys facilities
Demonstarates the use of the SLK Soft-Keys facilities
_workspace/src/github.com/rthornton128/goncurses/examples/starfield
Starfield is a simple Goncurses game demo.
Starfield is a simple Goncurses game demo.
_workspace/src/github.com/rthornton128/goncurses/examples/window
This simple example demonstrates how one might move a window about the * screen.
This simple example demonstrates how one might move a window about the * screen.
cmd

Jump to

Keyboard shortcuts

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