MCPcopy Create free account
hub / github.com/efogdev/mpris-timer / PlayPause

Method PlayPause

internal/core/core.go:224–240  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

222func (p *TimerPlayer) Quit() *dbus.Error { os.Exit(0); return nil }
223
224func (p *TimerPlayer) PlayPause() *dbus.Error {
225 if p.isPaused {
226 p.pausedFor += time.Since(p.pausedAt)
227 } else {
228 p.pausedAt = time.Now()
229 }
230
231 p.isPaused = !p.isPaused
232 p.playbackStatus = map[bool]string{true: "Paused", false: "Playing"}[p.isPaused]
233
234 p.emitPropertiesChanged("org.mpris.MediaPlayer2.Player", map[string]dbus.Variant{
235 "PlaybackStatus": dbus.MakeVariant(p.playbackStatus),
236 })
237
238 p.broadcast()
239 return nil
240}
241
242func (p *TimerPlayer) Previous() *dbus.Error {
243 p.startTime = time.Now()

Callers 1

CreateTrayIconFunction · 0.80

Calls 2

emitPropertiesChangedMethod · 0.95
broadcastMethod · 0.95

Tested by

no test coverage detected