Documentation
¶
Index ¶
- Constants
- func List(conn *dbus.Conn) ([]string, error)
- func OnSignal(conn *dbus.Conn, ch chan<- *dbus.Signal) error
- type LoopStatus
- type Metadata
- type PlaybackStatus
- type Player
- 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) GetAlbum() (string, error)
- func (i *Player) GetArtURL() (string, error)
- func (i *Player) GetArtist() ([]string, error)
- func (i *Player) GetBaseProperty(property string) (dbus.Variant, error)
- func (i *Player) GetCoverURL() (string, error)deprecated
- func (i *Player) GetDesktopEntry() (string, error)
- func (i *Player) GetFullscreen() (bool, error)
- func (i *Player) GetIdentity() (string, error)
- func (i *Player) GetLength() (time.Duration, 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) GetPlayerProperty(property string) (dbus.Variant, error)
- func (i *Player) GetPlaylistsProperty(property string) (dbus.Variant, error)
- func (i *Player) GetPosition() (time.Duration, error)
- func (i *Player) GetProperty(iface, property string) (dbus.Variant, error)
- func (i *Player) GetRate() (float64, error)
- func (i *Player) GetShuffle() (bool, error)
- func (i *Player) GetSupportedUriSchemes() ([]string, error)
- func (i *Player) GetTitle() (string, error)
- func (i *Player) GetTrackID() (dbus.ObjectPath, error)
- func (i *Player) GetTrackListProperty(property string) (dbus.Variant, error)
- func (i *Player) GetURL() (string, error)
- func (i *Player) GetVolume() (float64, error)
- func (i *Player) HasTrackList() (bool, error)
- func (i *Player) Next() error
- func (i *Player) OnSeeked(ctx context.Context, position chan<- time.Duration) error
- func (i *Player) OnSignal(ch chan<- *dbus.Signal) errordeprecated
- func (i *Player) OpenURI(uri string) error
- func (i *Player) OpenUri(uri string) errordeprecated
- 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) Seek(offset time.Duration) error
- func (i *Player) SetBaseProperty(property string, value any) error
- func (i *Player) SetFullscreen(fullscreen bool) error
- func (i *Player) SetLoopStatus(loopStatus LoopStatus) error
- func (i *Player) SetPlayerProperty(property string, value any) error
- func (i *Player) SetPlaylistsProperty(property string, value any) error
- func (i *Player) SetPosition(position time.Duration) error
- func (i *Player) SetProperty(iface, property string, value any) error
- func (i *Player) SetRate(rate float64) error
- func (i *Player) SetShuffle(value bool) error
- func (i *Player) SetTrackListProperty(property string, value any) error
- func (i *Player) SetTrackPosition(trackID *dbus.ObjectPath, position time.Duration) error
- func (i *Player) SetVolume(volume float64) error
- func (i *Player) Stop() error
- func (i *Player) SupportedMimeTypes() ([]string, error)
Constants ¶
const ( // DBusObjectPath is the root object path for MPRIS-compatible media // players. All MPRIS interfaces are exposed under this path on the D-Bus. DBusObjectPath = "/org/mpris/MediaPlayer2" // PropertiesChangedSignal is the D-Bus signal name emitted when a property // changes on an MPRIS interface. PropertiesChangedSignal = "org.freedesktop.DBus.Properties.PropertiesChanged" // BaseInterface is the main MPRIS interface that provides general // information and capabilities about the media player instance. BaseInterface = "org.mpris.MediaPlayer2" // PlayerInterface defines methods and properties for controlling playback, // such as play, pause, seek, and retrieving track metadata. PlayerInterface = "org.mpris.MediaPlayer2.Player" // TrackListInterface provides access to the list of tracks managed by the // player, allowing navigation, retrieval, and management of track items. TrackListInterface = "org.mpris.MediaPlayer2.TrackList" // PlaylistsInterface defines the MPRIS interface for managing and // activating playlists exposed by the player. PlaylistsInterface = "org.mpris.MediaPlayer2.Playlists" // GetPropertyMethod is the standard D-Bus method used to retrieve the value // of a property from an interface that implements // org.freedesktop.DBus.Properties. GetPropertyMethod = "org.freedesktop.DBus.Properties.Get" // SetPropertyMethod is the standard D-Bus method used to change the value // of a writable property on an interface that implements // org.freedesktop.DBus.Properties. SetPropertyMethod = "org.freedesktop.DBus.Properties.Set" )
const ( // KeyAlbum is the album name. KeyAlbum = "xesam:album" // KeyAlbumArtist is the album artist(s). KeyAlbumArtist = "xesam:albumArtist" // KeyArtist is the track artist(s). KeyArtist = "xesam:artist" // KeyAsText is the text/lyrics of the track. KeyAsText = "xesam:asText" // KeyAudioBPM is the speed of the music in beats per minute. KeyAudioBPM = "xesam:audioBPM" // KeyAutoRating is an automatically generated rating (0.0 to 1.0). KeyAutoRating = "xesam:autoRating" // KeyComment is a social comment about the track. KeyComment = "xesam:comment" // KeyComposer is the track composer(s). KeyComposer = "xesam:composer" // KeyContentCreated is the date/time the content was created. KeyContentCreated = "xesam:contentCreated" // KeyDiscNumber is the disc number on the album. KeyDiscNumber = "xesam:discNumber" // KeyFirstUsed is the date/time the track was first played. KeyFirstUsed = "xesam:firstUsed" // KeyGenre is the genre(s) of the track. KeyGenre = "xesam:genre" // KeyLastUsed is the date/time the track was last played by any user. KeyLastUsed = "xesam:lastUsed" // KeyLastUsedByMe is the date/time the track was last played by the current user. KeyLastUsedByMe = "xesam:lastUsedByMe" // KeyLyricist is the person who wrote the lyrics for the track. KeyLyricist = "xesam:lyricist" // KeyTitle is the item title. KeyTitle = "xesam:title" // KeyTrackNumber is the track number on the album. KeyTrackNumber = "xesam:trackNumber" // KeyURL is the location of the media file. KeyURL = "xesam:url" // KeyUseCount is the number of times the track has been played. KeyUseCount = "xesam:useCount" // KeyUserRating is the user's rating of the track (0.0 to 1.0). KeyUserRating = "xesam:userRating" // KeyTrackID is a unique identity for the track within the context of the playlist. KeyTrackID = "mpris:trackid" // KeyLength is the duration of the track in microseconds. KeyLength = "mpris:length" // KeyArtURL is a URI of some album art designed to represent the track/album. KeyArtURL = "mpris:artUrl" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LoopStatus ¶
type LoopStatus string
LoopStatus represents the loop status of the player. It can be "None", "Track" or "Playlist".
const ( LoopNone LoopStatus = "None" LoopTrack LoopStatus = "Track" LoopPlaylist LoopStatus = "Playlist" )
type Metadata ¶ added in v0.6.0
Metadata represents the metadata of the current track.
type PlaybackStatus ¶
type PlaybackStatus string
PlaybackStatus represents the playback status. It can be "Playing", "Paused" or "Stopped".
const ( PlaybackPlaying PlaybackStatus = "Playing" PlaybackPaused PlaybackStatus = "Paused" PlaybackStopped PlaybackStatus = "Stopped" )
type Player ¶
type Player struct {
// contains filtered or unexported fields
}
Player represents a mpris player.
func (*Player) CanControl ¶ added in v0.5.0
CanControl returns whether the player can be controlled.
func (*Player) CanEditTracks ¶ added in v0.5.0
CanEditTracks returns if player can edit track list
func (*Player) CanGoNext ¶ added in v0.5.0
CanGoNext returns whether the player can skip to the next track.
func (*Player) CanGoPrevious ¶ added in v0.5.0
CanGoPrevious returns whether the player can skip to the previous track.
func (*Player) CanPlay ¶ added in v0.5.0
CanPlay returns whether the player can start or resume playback.
func (*Player) CanSeek ¶ added in v0.5.0
CanSeek returns whether the player can seek within the current track.
func (*Player) CanSetFullscreen ¶ added in v0.7.0
CanSetFullscreen returns whether the player allows changing fullscreen state.
func (*Player) GetArtURL ¶ added in v0.10.0
GetArtURL returns the cover art URL of the current track.
func (*Player) GetBaseProperty ¶ added in v0.6.0
GetBaseProperty returns the prop from the base interface.
func (*Player) GetCoverURL
deprecated
added in
v0.2.0
func (*Player) GetDesktopEntry ¶ added in v0.7.0
GetDesktopEntry returns the desktop entry name of the player.
func (*Player) GetFullscreen ¶ added in v0.7.0
GetFullscreen returns whether the player is in fullscreen mode.
func (*Player) GetIdentity ¶
GetIdentity returns the player identity.
func (*Player) GetLoopStatus ¶
func (i *Player) GetLoopStatus() (LoopStatus, error)
GetLoopStatus returns the current loop status.
func (*Player) GetMaximumRate ¶ added in v0.7.0
GetMaximumRate returns the maximum playback rate.
func (*Player) GetMetadata ¶
GetMetadata returns the current track metadata.
func (*Player) GetMinimumRate ¶ added in v0.7.0
GetMinimumRate returns the minimum playback rate.
func (*Player) GetPlaybackStatus ¶
func (i *Player) GetPlaybackStatus() (PlaybackStatus, error)
GetPlaybackStatus returns the current playback status.
func (*Player) GetPlayerProperty ¶
GetPlayerProperty returns the prop from the player interface.
func (*Player) GetPlaylistsProperty ¶ added in v0.6.0
GetPlaylistsProperty returns the prop from the playlists interface.
func (*Player) GetPosition ¶
GetPosition returns the current playback position.
func (*Player) GetProperty ¶
GetProperty returns the prop in the iface.
func (*Player) GetShuffle ¶
GetShuffle returns true if shuffle mode is enabled, false if playing linearly through a playlist.
func (*Player) GetSupportedUriSchemes ¶ added in v0.7.0
GetSupportedUriSchemes returns the supported URI schemes of the player.
func (*Player) GetTrackID ¶ added in v0.5.0
func (i *Player) GetTrackID() (dbus.ObjectPath, error)
GetTrackID returns track id for player as dbus.ObjectPath
func (*Player) GetTrackListProperty ¶ added in v0.6.0
GetTrackListProperty returns the prop from the tracklist interface.
func (*Player) HasTrackList ¶ added in v0.7.0
HasTrackList returns whether the player has a track list.
func (*Player) OnSeeked ¶ added in v0.7.0
OnSeeked listens for "Seeked" signal and sends the new position as time.Duration to position until ctx is canceled.
func (*Player) PlayPause ¶
PlayPause resumes the current track if it's paused and pauses it if it's playing.
func (*Player) Seek ¶
Seek changes the current track position by the given offset. If the offset is negative, the playback position moves backward.
func (*Player) SetBaseProperty ¶ added in v0.6.0
SetBaseProperty sets the propertyName from the base interface.
func (*Player) SetFullscreen ¶ added in v0.7.0
SetFullscreen sets the fullscreen state of the player.
func (*Player) SetLoopStatus ¶
func (i *Player) SetLoopStatus(loopStatus LoopStatus) error
SetLoopStatus sets the loop status.
func (*Player) SetPlayerProperty ¶
SetPlayerProperty sets the propertyName from the player interface.
func (*Player) SetPlaylistsProperty ¶ added in v0.6.0
SetPlaylistsProperty sets the propertyName from the playlists interface.
func (*Player) SetPosition ¶
SetPosition sets the playback position of the current track.
func (*Player) SetProperty ¶
SetProperty sets the value of a property in the interface.
func (*Player) SetShuffle ¶
SetShuffle sets the shuffle mode.
func (*Player) SetTrackListProperty ¶ added in v0.6.0
SetTrackListProperty sets the propertyName from the tracklist interface.
func (*Player) SetTrackPosition ¶
SetTrackPosition sets the playback position of a specific track.
func (*Player) SupportedMimeTypes ¶ added in v0.7.0
SupportedMimeTypes returns the supported MIME types of the player.