Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 37 lines 1.1 kB view raw
1"""04 — Queue management. 2 3Show the current queue, then insert tracks from the first album in the library 4at the end of the queue. 5 6 uv run python examples/04_queue_management.py 7""" 8 9from __future__ import annotations 10 11import asyncio 12 13from _client import create_client # type: ignore[import-not-found] 14 15from rockbox_sdk import InsertPosition 16 17 18async def main() -> None: 19 async with create_client() as client: 20 queue = await client.playlist.current() 21 print(f"Queue has {queue.amount} tracks (index {queue.index}):") 22 for i, t in enumerate(queue.tracks[:5]): 23 marker = "" if i == queue.index else " " 24 print(f" {marker} {i:>3} {t.title}{t.artist}") 25 if queue.amount > 5: 26 print(f" … and {queue.amount - 5} more") 27 28 albums = await client.library.albums() 29 if albums: 30 album = albums[0] 31 print(f"\nAppending album: {album.title}{album.artist}") 32 await client.playlist.insert_album(album.id, InsertPosition.LAST) 33 print("→ done") 34 35 36if __name__ == "__main__": 37 asyncio.run(main())