Add command line options to server
parent
dc3a661545
commit
b1a0c62275
|
@ -30,12 +30,36 @@ import threading
|
|||
import errno
|
||||
import time
|
||||
import os
|
||||
import argparse
|
||||
|
||||
|
||||
# Parse command line options
|
||||
parser = argparse.ArgumentParser(description="Run mpv synchronization Server")
|
||||
parser.add_argument(
|
||||
"-i",
|
||||
"--ip",
|
||||
help="Server IP address (default 0.0.0.0)",
|
||||
type=str,
|
||||
required=False,
|
||||
default="0.0.0.0",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-p",
|
||||
"--port",
|
||||
help="Server network port (default 51984)",
|
||||
type=int,
|
||||
required=False,
|
||||
default="51984",
|
||||
)
|
||||
parser.add_argument("-u", "--url", help="URL to play", type=str, required=False)
|
||||
|
||||
args = parser.parse_args()
|
||||
IP = args.ip
|
||||
PORT = args.port
|
||||
URL = args.url
|
||||
|
||||
HEADER_LENGTH = 32
|
||||
|
||||
IP = "0.0.0.0"
|
||||
PORT = 51984
|
||||
FORMAT = "utf-8"
|
||||
DISCONNECT_MESSAGE = "!DISCONNECT"
|
||||
|
||||
|
@ -154,7 +178,7 @@ def main():
|
|||
print(f"Listening for connections on {IP}:{PORT}...")
|
||||
|
||||
readycounter = 0
|
||||
last_video = None
|
||||
last_video = URL
|
||||
while True:
|
||||
read_sockets, _, exception_sockets = select.select(
|
||||
sockets_list, [], sockets_list
|
||||
|
|
Loading…
Reference in New Issue