This bug report came in via Fedora's Abrt reporting system. The pertinent details:
Truncated backtrace:
mpDris2:734:_update_properties:TypeError: 'bool' object is not subscriptable
Traceback (most recent call last):
File "/usr/bin/mpDris2", line 454, in timer_callback
self._update_properties(force=False)
File "/usr/bin/mpDris2", line 734, in _update_properties
if old_status['state'] != new_status['state']:
TypeError: 'bool' object is not subscriptable
Local variables in innermost frame:
self: <__main__.MPDWrapper object at 0x7f365b81ba50>
force: False
old_status: False
old_position: 228.723
old_time: 1580885354
new_status: {'volume': '40', 'repeat': '0', 'random': '1', 'single': '0', 'consume': '0', 'playlist': '2', 'playlistlength': '13080', 'mixrampdb': '0.000000', 'state': 'pause', 'song': '10067', 'songid': '10068', 'time': '229:240', 'elapsed': '228.723', 'bitrate': '320', 'duration': '239.647', 'audio': '44100:24:2', 'nextsong': '8546', 'nextsongid': '8547'}
new_time: 1580885355
new_position: 228.723
This seems to happen because _update_properties sets self._status to the value of new_statusbefore checking that new_status is valid. Then, on the next iteration, old_status is set to the value of self._status, which contains merely False.
This PR updates the order of operations so that self._status is updated with the value of new_statusonly if new_status does not evaluate to False.
Bah!! I just realized I should've moved that debug log after the new_status check, since now it's actually logging the old status. I'll submit another PR. :laughing:
This bug report came in via Fedora's Abrt reporting system. The pertinent details:
This seems to happen because
_update_properties
setsself._status
to the value ofnew_status
before checking thatnew_status
is valid. Then, on the next iteration,old_status
is set to the value ofself._status
, which contains merelyFalse
.This PR updates the order of operations so that
self._status
is updated with the value ofnew_status
only ifnew_status
does not evaluate toFalse
.