From 03ddeb2608f40236da45cc8771d57d8d4d5c7854 Mon Sep 17 00:00:00 2001 From: southerntofu Date: Wed, 28 Jul 2021 19:43:30 -0400 Subject: [PATCH] Support custom interface/port in main.py --- main.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index be65f29..8f9961c 100644 --- a/main.py +++ b/main.py @@ -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)