eonpatapon / mpDris2

MPRIS V2.1 support for mpd

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

crash when status.time is not an integer

arcresu opened this issue · comments

Whenever I start mpdris2, it crashes with:

Traceback (most recent call last):
  File "/usr/bin/mpDris2", line 1310, in <module>
    mpd_wrapper.run()
  File "/usr/bin/mpDris2", line 279, in run
    if self.my_connect():
  File "/usr/bin/mpDris2", line 354, in my_connect
    self.timer_callback()
  File "/usr/bin/mpDris2", line 442, in timer_callback
    self._update_properties(force=False)
  File "/usr/bin/mpDris2", line 672, in _update_properties
    new_position = int(new_status['time'].split(':')[0])
ValueError: invalid literal for int() with base 10: '149.433715'

It seems that mpd requires integer calues for times, but the particular server I'm using (beets bpd) has a bug (beetbox/beets#2394) where it is returning non-integers. The problem is with the server implementation, however every other mpd client software I've tried has been able to cope with the malformed response from this server.

Perhaps the handling of status fields could be a bit more robust? Changing int() to int(float()) would fix this particular issue, but it could be even more robust than that, and for other fields as well.

Just to let people know. Upstream has fixed the issue so this doesn't need to be implemented.