Add script to decode JSON SDP.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 1 Jul 2020 17:31:09 +0000 (19:31 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 1 Jul 2020 17:31:09 +0000 (19:31 +0200)
decode-json.py [new file with mode: 0755]

diff --git a/decode-json.py b/decode-json.py
new file mode 100755 (executable)
index 0000000..e5ad717
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/python3
+
+import argparse
+import json
+
+
+def decode_json_files(json_files):
+    for json_file in json_files:
+        print(json_file)
+        with open(json_file) as fp:
+            parsed_json = json.load(fp)
+        sdp = parsed_json['sdp']
+        print(sdp)
+        print()
+
+
+def main():
+    parser = argparse.ArgumentParser(description='Decode SDP JSON')
+    parser.add_argument('json', nargs='+', help='JSON file')
+    args = parser.parse_args()
+    decode_json_files(args.json)
+
+
+if __name__=='__main__':
+    main()