From 6ee37168a1f5a3a7bd9e5e471fac9d3ea4269fe3 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 28 Nov 2024 10:49:12 -0600 Subject: [PATCH] Fix ruff formatting on examples/room_example.py (#316) --- examples/room_example.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/examples/room_example.py b/examples/room_example.py index b13cfb07..6e01e89c 100644 --- a/examples/room_example.py +++ b/examples/room_example.py @@ -7,15 +7,16 @@ TOKEN = os.environ.get("LIVEKIT_TOKEN") URL = os.environ.get("LIVEKIT_URL") + async def main(): logging.basicConfig(level=logging.INFO) - logger = logging.getLogger(__name__) room = rtc.Room() @room.on("participant_connected") def on_participant_connected(participant: rtc.RemoteParticipant): logging.info( - "participant connected: %s %s", participant.sid, participant.identity) + "participant connected: %s %s", participant.sid, participant.identity + ) async def receive_frames(stream: rtc.VideoStream): async for frame in stream: @@ -24,7 +25,11 @@ async def receive_frames(stream: rtc.VideoStream): # track_subscribed is emitted whenever the local participant is subscribed to a new track @room.on("track_subscribed") - def on_track_subscribed(track: rtc.Track, publication: rtc.RemoteTrackPublication, participant: rtc.RemoteParticipant): + def on_track_subscribed( + track: rtc.Track, + publication: rtc.RemoteTrackPublication, + participant: rtc.RemoteParticipant, + ): logging.info("track subscribed: %s", publication.sid) if track.kind == rtc.TrackKind.KIND_VIDEO: video_stream = rtc.VideoStream(track) @@ -43,7 +48,8 @@ def on_track_subscribed(track: rtc.Track, publication: rtc.RemoteTrackPublicatio print(f"participant identity: {participant.identity}") print(f"participant name: {participant.name}") print(f"participant kind: {participant.kind}") - print(f"participant track publications: {participant.track_publications}") + print(f"participant track publications: { + participant.track_publications}") for tid, publication in participant.track_publications.items(): print(f"\ttrack id: {tid}") print(f"\t\ttrack publication: {publication}") @@ -52,7 +58,6 @@ def on_track_subscribed(track: rtc.Track, publication: rtc.RemoteTrackPublicatio print(f"\t\ttrack source: {publication.source}") print(f"participant metadata: {participant.metadata}") - if __name__ == "__main__": @@ -62,4 +67,3 @@ def on_track_subscribed(track: rtc.Track, publication: rtc.RemoteTrackPublicatio exit(1) asyncio.run(main()) -