- "status", function(_, result)
- if not self._status or result.state ~= self._status.state then
- self._status = result
- self:update_widget()
- self:popup_oneshot(5)
- end
- end,
- "currentsong", function(_, result)
- if not self._currentsong or result.id ~= self._currentsong.id then
- self._currentsong = result
- self:update_widget()
- self:popup_oneshot(5)
- end
+ "player", function(conn)
+ conn:send("status", function(err, status)
+ local songchanged = self._status.songid ~= status.songid
+ local statechanged = self._status.state ~= status.state
+ self._status = status
+ if not songchanged then
+ self:update_widget()
+ if statechanged then
+ self:popup_oneshot(5)
+ end
+ return
+ end
+
+ conn:send("currentsong", function(_, song)
+ self._currentsong = song
+ conn:albumart(song.file, function(_, art)
+ self._albumart = art
+ self:update_widget()
+ self:popup_oneshot(5)
+ end)
+ end)
+ end)