Update full.py
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Wed, 6 Jul 2022 14:57:44 +0000 (16:57 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Wed, 6 Jul 2022 14:57:44 +0000 (16:57 +0200)
examples/full.py

index 2cf8e3aa88e455a32a779b3dfac257868bbb74ea..c4d62e699026f694acb32b2a521db78b38f1ca55 100644 (file)
@@ -207,8 +207,8 @@ async def main():
         print(f"Got {track_count} tracks ({track_count_lib} in library)")
         radio_count = await mass.music.radio.count(True)
         print(f"Got {radio_count} radio stations in library")
-        playlist_count = await mass.music.playlists.db_items(True)
-        print(f"Got {len(playlist_count)} playlists in library")
+        playlists = await mass.music.playlists.db_items(True)
+        print(f"Got {len(playlists)} playlists in library")
         # register a player
         test_player1 = TestPlayer("test1")
         test_player2 = TestPlayer("test2")
@@ -223,9 +223,8 @@ async def main():
         # we can also send an uri, such as spotify://track/abcdfefgh
         # or database://playlist/1
         # or a list of items
-        if playlist_count > 0:
-            playlist = await mass.music.playlists.get("1", ProviderType.DATABASE)
-            await test_player1.active_queue.play_media(playlist)
+        if len(playlists) > 0:
+            await test_player1.active_queue.play_media(playlists[0])
 
         await asyncio.sleep(3600)