Commit graph

14 commits

Author SHA1 Message Date
Daniel Eklöf
cc654eda57 module/mpd: cleanup 2018-12-28 15:26:22 +01:00
Daniel Eklöf
97b279ff82 module/mpd: don't detach refresh thread
Instead, abort and join previous thread (if any), just before creating
a new one.

Abort/join the last one when destroying the module.

Note: we may end up with a dangling (non-joined) thread for a
while (for example, when state goes from playing -> paused/stopped).

It will however be joined eventually; either when state goes to
'playing' again, or when the module is destroyed.
2018-12-28 14:22:17 +01:00
Daniel Eklöf
cc59593f29 module/mpd: idle mask variable is unused, when we don't debug log 2018-12-28 14:15:03 +01:00
Daniel Eklöf
0103eff3a0 module/mpd: free album/artist/title before replacing them 2018-12-28 14:14:43 +01:00
Daniel Eklöf
64af167d66 module/mpd: disable debug logging 2018-12-28 14:14:21 +01:00
Daniel Eklöf
d8274c2c9c module/mpd: refresh thread only resets refresh_abort_fd if it's "ours"
That is, we only reset it if the module main thread haven't already
done so (and quite possibly created another eventfd).
2018-12-28 14:08:45 +01:00
Daniel Eklöf
b40069616c module/mpd: refresh_abort_fd now uses -1 to indicate there are is no active thread 2018-12-28 14:08:16 +01:00
Daniel Eklöf
ba31a557f5 module/mpd: refresh thread calls bar->refresh() directly
This is possible, since content() now calculates the correct 'elapsed'
time, based on the time the original elapsed value was received from
MPD.
2018-12-28 14:07:06 +01:00
Daniel Eklöf
f74f2ad031 module/mpd: elapsed and duration are now tracked in millseconds 2018-12-28 14:06:13 +01:00
Daniel Eklöf
67bd38f5df module/mpd: implement refresh_in() 2018-12-28 12:47:18 +01:00
Daniel Eklöf
89ebfa0dbb module/mpd: remember *when* the 'elapsed' member was set.
This allows us to update the elapsed field without having to talk to
MPD.

In particular, it fixes a bug where we reported the same elapsed value
when we we're updated due to *other* modules calling bar->refresh().
2018-12-28 12:47:14 +01:00
Daniel Eklöf
904f9ff8e1 tag: all tag constructors must now be passed a module 'owner' 2018-12-28 12:40:41 +01:00
Daniel Eklöf
99008c5ad9 module/mpd: "elapsed" tag is now a realtime tag (when state == playing) 2018-12-27 11:44:46 +01:00
Daniel Eklöf
9a94c9c1f7 module/mpd: monitors MPD 2018-12-27 11:36:38 +01:00