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

Method emitLoop

internal/core/core.go:175–195  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

173}
174
175func (p *TimerPlayer) emitLoop() {
176 var prev *PropsChangedEvent
177
178 for e := range p.emitter {
179 if prev != nil && prev.Img == e.Img && prev.Text == e.Text {
180 continue
181 }
182
183 p.emitPropertiesChanged("org.mpris.MediaPlayer2.Player", map[string]dbus.Variant{
184 "PlaybackStatus": dbus.MakeVariant(p.playbackStatus),
185 "Metadata": dbus.MakeVariant(map[string]dbus.Variant{
186 "mpris:trackid": dbus.MakeVariant(dbus.ObjectPath("/track/1")),
187 "xesam:title": dbus.MakeVariant(p.Name),
188 "xesam:artist": dbus.MakeVariant([]string{e.Text}),
189 "mpris:artUrl": dbus.MakeVariant(e.Img),
190 }),
191 })
192
193 prev = &e
194 }
195}
196
197func (p *TimerPlayer) exportInterfaces() error {
198 if err := p.conn.Export(p, p.objectPath, "org.mpris.MediaPlayer2"); err != nil {

Callers 1

StartMethod · 0.95

Calls 1

emitPropertiesChangedMethod · 0.95

Tested by

no test coverage detected