8000 Library function to listen to player names appearing and vanishing · Issue #100 · altdesktop/playerctl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content {"props":{"docsUrl":"https://docs.github.com/get-started/accessibility/keyboard-shortcuts"}}
Library function to listen to player names appearing and vanishing #100
Closed
@acrisci

Description

@acrisci

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()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0