cli: add function to toggle playback status

This commit is contained in:
Daniel Lovbrotte Olsen 2024-05-19 06:08:18 +02:00
parent 1009b29995
commit 2b8ecf124d
1 changed files with 6 additions and 0 deletions

View File

@ -107,6 +107,12 @@ def pause( api_base: str = DEFAULT_API_BASE ):
api.set_endpoint(api_base) api.set_endpoint(api_base)
rich.print(api.set_playing(False), file=sys.stderr) rich.print(api.set_playing(False), file=sys.stderr)
@cli.command(help="Toggle playback")
def toggle(api_base: str = DEFAULT_API_BASE):
api.set_endpoint(api_base)
playing = api.is_playing()
rich.print(api.set_playing(not playing), file=sys.stderr)
@cli.command(help="Goto next item in playlist") @cli.command(help="Goto next item in playlist")
def skip( api_base: str = DEFAULT_API_BASE ): def skip( api_base: str = DEFAULT_API_BASE ):
api.set_endpoint(api_base) api.set_endpoint(api_base)