From 5953d7338908cd06c63935767756968f982a76f6 Mon Sep 17 00:00:00 2001 From: Martin Wagner Date: Sat, 19 Dec 2020 00:14:55 +0100 Subject: [PATCH] fixed error in PlaybackControl._refresh_tooltips() --- bin/mpdevil | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bin/mpdevil b/bin/mpdevil index 3d1c1cd..1d46999 100755 --- a/bin/mpdevil +++ b/bin/mpdevil @@ -3010,12 +3010,16 @@ class PlaybackControl(Gtk.ButtonBox): self.pack_start(self._next_button, True, True, 0) def _refresh_tooltips(self, *args): - songs=self._client.wrapped_call("playlistinfo") - song=int(self._client.wrapped_call("status")["song"]) - elapsed=ClientHelper.calc_display_length(songs[:song]) - rest=ClientHelper.calc_display_length(songs[song+1:]) - self._prev_button.set_tooltip_text(_("{titles} titles ({length})").format(titles=song, length=elapsed)) - self._next_button.set_tooltip_text(_("{titles} titles ({length})").format(titles=(len(songs)-(song+1)), length=rest)) + try: + songs=self._client.wrapped_call("playlistinfo") + song=int(self._client.wrapped_call("status")["song"]) + elapsed=ClientHelper.calc_display_length(songs[:song]) + rest=ClientHelper.calc_display_length(songs[song+1:]) + self._prev_button.set_tooltip_text(_("{titles} titles ({length})").format(titles=song, length=elapsed)) + self._next_button.set_tooltip_text(_("{titles} titles ({length})").format(titles=(len(songs)-(song+1)), length=rest)) + except: + self._prev_button.set_tooltip_text("") + self._next_button.set_tooltip_text("") def _on_play_clicked(self, widget): self._client.wrapped_call("toggle_play")