xbmc-plugin-mpdc icon indicating copy to clipboard operation
xbmc-plugin-mpdc copied to clipboard

ERROR: KeyError: 'volume' on Startup 2.0.8

Open stuckinger opened this issue 5 years ago • 2 comments

Addon shows error without information on startup, telling me to have a look into the logfile:

ERROR: Traceback (most recent call last): ERROR: File "/home/osmc/.kodi/addons/script.mpdc/resources/lib/gui.py", line 219, in _connect ERROR: self._handle_changes(self.client,['mixer','playlist','player','options']) ERROR: File "/home/osmc/.kodi/addons/script.mpdc/resources/lib/gui.py", line 636, in _handle_changes ERROR: self._update_volume(state) ERROR: File "/home/osmc/.kodi/addons/script.mpdc/resources/lib/gui.py", line 610, in _update_volume ERROR: if state['volume']=='-1': ERROR: KeyError: 'volume'

Environment: MPD Client from Repo is 2.0.8 OSMC July 2019 2019.07-1 Linux version 4.14.78-4-osmc (root@vero3-db) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)) #1 SMP PREEMPT Wed Dec 12 17:58:11 UTC 2018 Hardware: RasperryPi 3 B

Anny suggestions?

stuckinger avatar Oct 03 '19 13:10 stuckinger

You could patch /storage/.kodi/addons/script.mpdc/resources/lib/gui.py:

610,616c610,620
                 try:
>                       if state['volume']=='-1':
>                               self.getControl(VOLUME_GROUP).setVisible(False)
>                               self._can_volume=False
>                       else:
>                               self._can_volume=True
>                               self.getControl(VOLUME_GROUP).setVisible(True)
>                               self.getControl(VOLUME_STATUS).setPercent(int(state['volume']))
>                 except:
>                       self.getControl(VOLUME_GROUP).setVisible(False)
>                       self._can_volume=False

The problem is that mpd apparently does not send "volume=-1" anymore when there is no volume parameter anymore. The "except" part handles this, the same way the "if" block does.

bisanz1 avatar Mar 01 '20 08:03 bisanz1

Found at least a 2nd similar code part to be fixed, in order to be able to start the MPD client when mpd is already playing:

866,873c870,880
                         try:
>                               player = xbmc.Player(xbmc.PLAYER_CORE_MPLAYER)
>                               if player.isPlayingVideo():
>                                       return
>                               if player.isPlayingAudio():
>                                       if not player.getPlayingFile() == self.stream_url:
>                                               self._start_media_player()
>                                       else:
>                                               self._start_media_player()
>                         except:
>                                 return

bisanz1 avatar Mar 01 '20 09:03 bisanz1