From db5e5e16810017c4bf3d70df278974efac1886d3 Mon Sep 17 00:00:00 2001 From: Fabien Danieau Date: Tue, 2 Jan 2024 17:48:27 +0100 Subject: [PATCH 1/2] bug #34: change run_until_complete to run --- src/gst_signalling/utils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gst_signalling/utils.py b/src/gst_signalling/utils.py index b783a06..33f34c8 100644 --- a/src/gst_signalling/utils.py +++ b/src/gst_signalling/utils.py @@ -34,8 +34,7 @@ def on_list(found_producers: Dict[str, Dict[str, str]]) -> None: return producers - loop = asyncio.get_event_loop() - return loop.run_until_complete(get_list()) + return asyncio.run(get_list()) def find_producer_peer_id_by_name(host: str, port: int, name: str) -> str: From b4651de6b38f0b2e61248d00dd956c23e09a46d5 Mon Sep 17 00:00:00 2001 From: Fabien Danieau Date: Tue, 2 Jan 2024 18:18:28 +0100 Subject: [PATCH 2/2] bug #34: fix get_producer_list example --- src/example/get_producer_list.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/example/get_producer_list.py b/src/example/get_producer_list.py index 10f5d33..0a45f37 100644 --- a/src/example/get_producer_list.py +++ b/src/example/get_producer_list.py @@ -1,18 +1,15 @@ import argparse -import asyncio import logging -from gst_signalling import GstSignalling, utils +from gst_signalling import utils -async def get_producer_list(args: argparse.Namespace) -> None: + +def get_producer_list(args: argparse.Namespace) -> None: """Main function.""" if args.verbose: logging.basicConfig(level=logging.DEBUG) - signalling = GstSignalling(host="localhost", port=8443) - await signalling.connect() - - producers = await utils.get_producer_list(signalling) + producers = utils.get_producer_list(args.signalling_host, args.signalling_port) if producers: print("List received, producers:") @@ -21,8 +18,6 @@ async def get_producer_list(args: argparse.Namespace) -> None: else: print("List received, no producers.") - await signalling.close() - def main() -> None: parser = argparse.ArgumentParser(description="Get gstreamer producer list") @@ -31,7 +26,7 @@ def main() -> None: parser.add_argument("--verbose", "-v", action="count") args = parser.parse_args() - asyncio.run(get_producer_list(args)) + get_producer_list(args) if __name__ == "__main__":