Closed
Description
This is currently done in the cli, but it would be good to have it in the common library to make it more usable for scripts that follow players coming and going. I think this is probably fairly essential to any use case for the library.
It should look something like this (but in C of course):
def on_player_name_appeared(name, data):
# start managing your player here
print('player appeared: {}'.format(name))
def on_player_name_vanished(name, data):
# stop managing your player here
printf('player name vanished: {}'.format(name))
user_data = {}
Playerctl.watch_player_names(on_player_appeared, on_player_vanished, user_data)
GLib.main_loop().run()