avoid hanging on metadata error

This commit is contained in:
piotr
2023-12-01 02:47:03 +01:00
parent 451028508a
commit 77d6d7fb8f
2 changed files with 4 additions and 3 deletions

View File

@@ -825,7 +825,7 @@ class SinkBox(Gtk.Box):
def switch_sink(self, w, e, sink):
if commands["pactl"]:
print("Sink: '{}'".format(sink))
eprint("Sink: '{}'".format(sink))
subprocess.Popen('exec pactl set-default-sink "{}"'.format(sink), shell=True)
else:
eprint("Couldn't switch sinks, 'pactl' (libpulse) not found")

View File

@@ -95,7 +95,8 @@ class Playerctl(Gtk.EventBox):
player.connect('playback-status', self.on_playback_status))
# Manually set the initial state
self.on_metadata(player, player.props.metadata)
# self.on_metadata(player, player.props.metadata)
self.on_metadata(player, [])
def deinit_player(self):
if self.player:
@@ -129,7 +130,7 @@ class Playerctl(Gtk.EventBox):
def on_metadata(self, player, metadata):
try:
cover_url = metadata["mpris:artUrl"]
except KeyError:
except: # used to be on KeyError, but actual error is 'mpris:artUrl' for some reason (playerctl bug?)
cover_url = ""
if cover_url != self.old_cover_url: