Do main function.
()
| 10 | __version__ = xstudio.__version__ |
| 11 | |
| 12 | def control_main(): |
| 13 | """Do main function.""" |
| 14 | retval = 0 |
| 15 | parser = argparse.ArgumentParser( |
| 16 | description=__doc__ + " Controls xstudio.", |
| 17 | formatter_class=argparse.ArgumentDefaultsHelpFormatter |
| 18 | ) |
| 19 | |
| 20 | parser.add_argument( |
| 21 | "-s", "--session", action="store", |
| 22 | type=str, |
| 23 | help="Host name.", |
| 24 | default=None |
| 25 | ) |
| 26 | |
| 27 | parser.add_argument( |
| 28 | "-H", "--host", action="store", |
| 29 | type=str, |
| 30 | help="Host name.", |
| 31 | default=None |
| 32 | ) |
| 33 | |
| 34 | parser.add_argument( |
| 35 | "-p", "--port", action="store", |
| 36 | type=int, |
| 37 | help="Port.", |
| 38 | default=14441 |
| 39 | ) |
| 40 | |
| 41 | parser.add_argument( |
| 42 | "-i", "--info", action="store_true", |
| 43 | help="Print connection info.", |
| 44 | default=False |
| 45 | ) |
| 46 | |
| 47 | parser.add_argument( |
| 48 | "-a", "--add-media", type=str, nargs="*", default=[], |
| 49 | help="Add media." |
| 50 | ) |
| 51 | |
| 52 | parser.add_argument( |
| 53 | "-d", "--debug", action="store_true", |
| 54 | help="More debug info.", |
| 55 | default=False |
| 56 | ) |
| 57 | |
| 58 | args = parser.parse_args() |
| 59 | |
| 60 | if args.session: |
| 61 | m = RemoteSessionManager(remote_session_path()) |
| 62 | s = m.find(args.session) |
| 63 | conn = Connection(debug=args.debug) |
| 64 | conn.connect_remote(s.host(), s.port.port()) |
| 65 | |
| 66 | elif args.host: |
| 67 | conn = Connection(debug=args.debug) |
| 68 | conn.connect_remote(args.host, args.port) |
| 69 | else: |
no test coverage detected