Documentation ¶
Overview ¶
Package media provides an i3bar module for an MPRIS-compatible media player.
Index ¶
- Constants
- type AutoModule
- type Info
- func (i Info) Connected() bool
- func (i Info) Next()
- func (i Info) Pause()
- func (i Info) Paused() bool
- func (i Info) Play()
- func (i Info) PlayPause()
- func (i Info) Playing() bool
- func (i Info) Position() time.Duration
- func (i Info) Previous()
- func (i Info) Seek(offset time.Duration)
- func (i Info) Stop()
- func (i Info) Stopped() bool
- func (i Info) TruncatedPosition(unit string) string
- type Module
- type PlaybackStatus
Constants ¶
const ( // Disconnected when the player is not running. Disconnected = PlaybackStatus("") // Playing when the player is actively playing a track. Playing = PlaybackStatus("Playing") // Paused when some media is selected but paused. Paused = PlaybackStatus("Paused") // Stopped when no media is selected or playing. Stopped = PlaybackStatus("Stopped") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutoModule ¶
type AutoModule struct {
// contains filtered or unexported fields
}
AutoModule is a media module that automatically switches to the newest media player seen on D-Bus.
func Auto ¶
func Auto(excluding ...string) *AutoModule
Auto constructs an instance of the media module that shows the most recently connected player (based on D-Bus name acquisition). It can optionally ignore one or more named players from this detection.
func (*AutoModule) Output ¶
func (m *AutoModule) Output(outputFunc func(Info) bar.Output) *AutoModule
Output configures a module to display the output of a user-defined function.
func (*AutoModule) RepeatingOutput ¶
func (m *AutoModule) RepeatingOutput(outputFunc func(Info) bar.Output) *AutoModule
RepeatingOutput configures a module to display the output of a user-defined function, automatically repeating it every second while playing.
func (*AutoModule) Stream ¶
func (m *AutoModule) Stream(s bar.Sink)
Stream starts the module and the D-Bus listener for media player name acquisitions and releases.
type Info ¶
type Info struct { PlayerName string PlaybackStatus PlaybackStatus Shuffle bool // From Metadata Length time.Duration Title string Artist string Album string AlbumArtist string // Although ArtURL cannot be used in the module output, it can still be // used for notifications or colour extraction. ArtURL string // contains filtered or unexported fields }
Info represents the current information from the media player.
func (Info) Connected ¶
Connected returns true if the media player is connected.
func (Info) Pause ¶
func (i Info) Pause()
Pause pauses the current track, keeping the current playback position.
func (Info) Paused ¶
Paused returns true if the media player is connected and paused.
func (Info) Playing ¶
Playing returns true if the media player is connected and playing media.
func (Info) Position ¶
Position computes the current track position based on the last update from the media player.
func (Info) Seek ¶
Seek seeks to the given position within the currently playing track.
func (Info) Stopped ¶
Stopped returns true if the media player is connected but stopped.
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module represents a bar.Module that displays media information from an MPRIS-compatible media player.
func New ¶
New constructs an instance of the media module for the given player.
func (*Module) Output ¶
Output configures a module to display the output of a user-defined function.
func (*Module) Player ¶
Player sets the name of the player to track. This will disconnect the module from the previous player.
func (*Module) RepeatingOutput ¶
RepeatingOutput configures a module to display the output of a user-defined function, automatically repeating it every second while playing.