Support custom interface/port in main.py

This commit is contained in:
southerntofu 2021-07-28 19:43:30 -04:00 committed by metalune
parent ba55cfd472
commit 03ddeb2608

13
main.py
View file

@ -3,6 +3,7 @@ from datetime import datetime
from math import ceil
import peertube
import html2text
import sys
h2t = html2text.HTML2Text()
h2t.ignore_links = True
@ -281,7 +282,6 @@ async def video(domain, id):
embed=embed,
)
def build_channel_or_account_name(domain, name):
if '@' in name:
return name
@ -397,4 +397,13 @@ async def video_channels__about(domain, name):
)
if __name__ == "__main__":
app.run()
if len(sys.argv) == 3:
interface = sys.argv[1]
port = sys.argv[2]
elif len(sys.argv) == 2:
interface = "127.0.0.1"
port = sys.argv[1]
else:
interface = "127.0.0.1"
port = "5000"
app.run(host=interface, port=port)