Documentation
¶
Index ¶
- Constants
- func List(conn *dbus.Conn) ([]string, error)
- func RegisterNameOwnerChanged(conn *dbus.Conn, ch chan<- *dbus.Signal) (err error)
- func UnregisterNameOwnerChanged(conn *dbus.Conn, ch chan<- *dbus.Signal) (err error)
- type LoopStatus
- type Metadata
- func (md Metadata) Album() (string, error)
- func (md Metadata) AlbumArtist() ([]string, error)
- func (md Metadata) ArtURL() (string, error)
- func (md Metadata) Artist() ([]string, error)
- func (md Metadata) AsText() (string, error)
- func (md Metadata) AudioBPM() (int, error)
- func (md Metadata) AutoRating() (float64, error)
- func (md Metadata) Comment() ([]string, error)
- func (md Metadata) Composer() ([]string, error)
- func (md Metadata) ContentCreated() (time.Time, error)
- func (md Metadata) DiscNumber() (int, error)
- func (md Metadata) Find(key string) (dbus.Variant, bool)
- func (md Metadata) FirstUsed() (time.Time, error)
- func (md Metadata) Genre() ([]string, error)
- func (md Metadata) LastUsed() (time.Time, error)
- func (md Metadata) Length() (int64, error)
- func (md Metadata) Lyricist() ([]string, error)
- func (md Metadata) Title() (string, error)
- func (md Metadata) TrackID() (dbus.ObjectPath, error)
- func (md Metadata) TrackNumber() (int, error)
- func (md Metadata) URL() (string, error)
- func (md Metadata) UseCount() (int, error)
- func (md Metadata) UserRating() (float64, error)
- type PlaybackStatus
- type Player
- func (i *Player) AddTrack(uri string, afterTrack string, setAsCurrent bool) error
- func (i *Player) CanControl() (bool, error)
- func (i *Player) CanEditTracks() (bool, error)
- func (i *Player) CanGoNext() (bool, error)
- func (i *Player) CanGoPrevious() (bool, error)
- func (i *Player) CanPause() (bool, error)
- func (i *Player) CanPlay() (bool, error)
- func (i *Player) CanQuit() (bool, error)
- func (i *Player) CanRaise() (bool, error)
- func (i *Player) CanSeek() (bool, error)
- func (i *Player) CanSetFullscreen() (bool, error)
- func (i *Player) GetDesktopEntry() (string, error)
- func (i *Player) GetFullscreen() (bool, error)
- func (i *Player) GetIdentity() (string, error)
- func (i *Player) GetLoopStatus() (LoopStatus, error)
- func (i *Player) GetMaximumRate() (float64, error)
- func (i *Player) GetMetadata() (Metadata, error)
- func (i *Player) GetMinimumRate() (float64, error)
- func (i *Player) GetName() string
- func (i *Player) GetPlaybackStatus() (PlaybackStatus, error)
- func (i *Player) GetPosition() (int64, error)
- func (i *Player) GetRate() (float64, error)
- func (i *Player) GetShortName() string
- func (i *Player) GetShuffle() (bool, error)
- func (i *Player) GetSupportedMimeTypes() ([]string, error)
- func (i *Player) GetSupportedUriSchemes() ([]string, error)
- func (i *Player) GetTracks() ([]string, error)
- func (i *Player) GetTracksMetadata(tracks []string) ([]Metadata, error)
- func (i *Player) GetVolume() (float64, error)
- func (i *Player) GoTo(trackId string) error
- func (i *Player) HasTrackList() (bool, error)
- func (i *Player) Next() error
- func (i *Player) OpenUri(uri string) error
- func (i *Player) Pause() error
- func (i *Player) Play() error
- func (i *Player) PlayPause() error
- func (i *Player) Previous() error
- func (i *Player) Quit() error
- func (i *Player) Raise() error
- func (i *Player) RegisterSignalReceiver(ch chan<- *dbus.Signal) (err error)
- func (i *Player) RemoveTrack(trackId string) error
- func (i *Player) SeekBy(offset int64) error
- func (i *Player) SetFullscreen(value bool) error
- func (i *Player) SetLoopStatus(loopStatus LoopStatus) error
- func (i *Player) SetPosition(position int64) error
- func (i *Player) SetShuffle(value bool) error
- func (i *Player) SetTrackPosition(trackId dbus.ObjectPath, position int64) error
- func (i *Player) SetVolume(value float64) error
- func (i *Player) Stop() error
- func (i *Player) UnregisterSignalReceiver(ch chan *dbus.Signal) (err error)
- type SignalType
Constants ¶
const ( BaseInterface = "org.mpris.MediaPlayer2" PlayerInterface = "org.mpris.MediaPlayer2.Player" TrackListInterface = "org.mpris.MediaPlayer2.TrackList" PlaylistsInterface = "org.mpris.MediaPlayer2.Playlists" )
DBus consts
Variables ¶
This section is empty.
Functions ¶
func RegisterNameOwnerChanged ¶ added in v1.0.3
Types ¶
type LoopStatus ¶
type LoopStatus string
The status of the player loop. May be "None", "Track" or "Playlist".
const ( LoopNone LoopStatus = "None" LoopTrack LoopStatus = "Track" LoopPlaylist LoopStatus = "Playlist" )
Loop statuses
type Metadata ¶
A representation of MPRIS metadata. See also: https://www.freedesktop.org/wiki/Specifications/mpris-spec/metadata
func (Metadata) AlbumArtist ¶
Returns the album artist(s)
func (Metadata) AutoRating ¶
Returns an automatically-generated rating, based on things such as how often it has been played. This should be in the range 0.0 to 1.0.
func (Metadata) ContentCreated ¶
Returns when the track was created.
func (Metadata) DiscNumber ¶
Returns the disc number on the album that this track is from.
func (Metadata) Length ¶
Returns the duration of the track in microseconds. Why int64 and not uint64: https://www.freedesktop.org/wiki/Specifications/mpris-spec/metadata/#mpris:length
func (Metadata) TrackID ¶
func (md Metadata) TrackID() (dbus.ObjectPath, error)
Returns a unique identity for the track within the context of an MPRIS object (e.g. tracklist).
func (Metadata) TrackNumber ¶
TrackNumber returns the track number on the album disc.
func (Metadata) UserRating ¶
UserRating returns a user-specified rating. This should be in the range 0.0 to 1.0.
type PlaybackStatus ¶
type PlaybackStatus string
The status of the playback. May be "Playing", "Paused" or "Stopped".
const ( PlaybackPlaying PlaybackStatus = "Playing" PlaybackPaused PlaybackStatus = "Paused" PlaybackStopped PlaybackStatus = "Stopped" )
Playback statuses
type Player ¶
type Player struct {
// contains filtered or unexported fields
}
A representation of a MPRIS player.
func (*Player) AddTrack ¶
Adds the specified Uri after a specified track and if it should become current track. See also: https://specifications.freedesktop.org/mpris-spec/latest/Track_List_Interface.html#Method:AddTrack
func (*Player) CanControl ¶
Returns if the player can be controlled by calls. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:CanControl
func (*Player) CanEditTracks ¶
Returns if the track list can be edited by calls. See also: https://specifications.freedesktop.org/mpris-spec/latest/Track_List_Interface.html#Property:CanEditTracks
func (*Player) CanGoNext ¶
Returns if the player can switch to the next track using the Next call. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:CanGoNext
func (*Player) CanGoPrevious ¶
Returns if the player can switch to the previous track using the Previous call. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:CanGoPrevious
func (*Player) CanPause ¶
Returns if the player can be paused by Pause or PlayPause calls. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:CanPause
func (*Player) CanPlay ¶
Returns if the player can be started by Play or PlayPause calls. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:CanPlay
func (*Player) CanQuit ¶
Returns the CanQuit property of the player. See also: https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:CanQuit
func (*Player) CanRaise ¶
Returns the CanRaise property of the player. See also: https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:CanRaise
func (*Player) CanSeek ¶
Returns if the position can be controlled by Seek and SetPosition calls. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:CanSeek
func (*Player) CanSetFullscreen ¶
Added in MPRIS v2.2. Returns the CanSetFullscreen property of the player. See also: https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:CanSetFullscreen
func (*Player) GetDesktopEntry ¶
Returns the DesktopEntry property of the player. See also: https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:DesktopEntry
func (*Player) GetFullscreen ¶
Added in MPRIS v2.2. Returns the Fullscreen property of the player. See also: https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:Fullscreen
func (*Player) GetIdentity ¶
Returns the Identity property, which is the friendly name of the player. See also: https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:Identity
func (*Player) GetLoopStatus ¶
func (i *Player) GetLoopStatus() (LoopStatus, error)
Returns the loop status. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:LoopStatus
func (*Player) GetMaximumRate ¶
Returns the maximum value that Rate can take. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:MaximumRate
func (*Player) GetMetadata ¶
Returns the metadata. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:Metadata
func (*Player) GetMinimumRate ¶
Returns the minimum value that Rate can take. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:MinimumRate
func (*Player) GetPlaybackStatus ¶
func (i *Player) GetPlaybackStatus() (PlaybackStatus, error)
Returns the playback status. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:PlaybackStatus
func (*Player) GetPosition ¶
Returns the currently playing track's position in microseconds. If there isn't any, returns 0. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:Position
func (*Player) GetRate ¶
Returns the current playback rate. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:Rate
func (*Player) GetShortName ¶
Gets the player short name (without the base interface name).
func (*Player) GetShuffle ¶
Returns if shuffle is enabled or not. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:Shuffle
func (*Player) GetSupportedMimeTypes ¶
Returns the SupportedMimeTypes property of the player. See also: https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:SupportedMimeTypes
func (*Player) GetSupportedUriSchemes ¶
Returns the SupportedUriSchemes property of the player. See also: https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:SupportedUriSchemes
func (*Player) GetTracks ¶
Returns the track IDs of the current track list. See also: https://specifications.freedesktop.org/mpris-spec/latest/Track_List_Interface.html#Property:Tracks
func (*Player) GetTracksMetadata ¶
Returns the specified tracks' metadata. See also: https://specifications.freedesktop.org/mpris-spec/latest/Track_List_Interface.html#Method:GetTracksMetadata
func (*Player) GetVolume ¶
Returns the volume. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:Volume
func (*Player) GoTo ¶
Goes to the specified track in the track list. See also: https://specifications.freedesktop.org/mpris-spec/latest/Track_List_Interface.html#Method:GoTo
func (*Player) HasTrackList ¶
Returns the HasTrackList property of the player. See also: https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:HasTrackList
func (*Player) Next ¶
Skips to the next track in the tracklist. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:Next
func (*Player) OpenUri ¶
Opens the Uri for a playback, if supported. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:OpenUri
func (*Player) Pause ¶
Pauses playback. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:Pause
func (*Player) Play ¶
Starts or resumes playback. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:Play
func (*Player) PlayPause ¶
Resumes playback if paused and pauses playback if playing. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:PlayPause
func (*Player) Previous ¶
Skips to the previous track in the tracklist. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:Previous
func (*Player) Quit ¶
Closes the player. See also: https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Method:Quit
func (*Player) Raise ¶
Raises player priority. See also: https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Method:Raise
func (*Player) RegisterSignalReceiver ¶ added in v1.0.2
Registers a new signal receiver channel that will be able to get signals as specified in SignalType definition.
func (*Player) RemoveTrack ¶
Removes the specified track from the track list. See also: https://specifications.freedesktop.org/mpris-spec/latest/Track_List_Interface.html#Method:RemoveTrack
func (*Player) SeekBy ¶
Seeks in the current track position by the specified offset. The offset should be in microseconds. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:Seek
func (*Player) SetFullscreen ¶
Added in MPRIS v2.2. Sets the Fullscreen property of the player. See also: https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:Fullscreen
func (*Player) SetLoopStatus ¶
func (i *Player) SetLoopStatus(loopStatus LoopStatus) error
Sets the loop status to the specified value. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:LoopStatus
func (*Player) SetPosition ¶
Sets the currently playing track's position in microseconds (if there is any). Not to confuse with SetTrackPosition. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:Position
func (*Player) SetShuffle ¶
Sets shuffle on/off. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:Shuffle
func (*Player) SetTrackPosition ¶
func (i *Player) SetTrackPosition(trackId dbus.ObjectPath, position int64) error
Sets the specified track's position in microseconds (if it's playing). Perhaps you would like to use SetPosition instead. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:SetPosition
func (*Player) SetVolume ¶
Sets the volume to the specified value. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Property:Volume
func (*Player) Stop ¶
Stops playback. See also: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Method:Stop
type SignalType ¶ added in v1.0.2
type SignalType string
The type of signal received by channel. May be "PropertiesChanged", "NameOwnerChanged" and "Seeked"
const ( SignalNotSupported SignalType = "" SignalPropertiesChanged SignalType = "PropertiesChanged" SignalNameOwnerChanged SignalType = "NameOwnerChanged" SignalSeeked SignalType = "Seeked" SignalTrackListReplaced SignalType = "TrackListReplaced" SignalTrackAdded SignalType = "TrackAdded" SignalTrackRemoved SignalType = "TrackRemoved" SignalTrackMetadataChanged SignalType = "TrackMetadataChanged" )
Signal types
func GetSignalType ¶ added in v1.0.2
func GetSignalType(signal *dbus.Signal) SignalType
Gets the supported signal type from *dbus.Signal