mirror of
https://github.com/armbian/dl-router.git
synced 2026-01-06 10:32:39 -08:00
Update main.py
Adding command line parameter to set a mirror config file: https://github.com/armbian/dl-router/issues/12
This commit is contained in:
15
app/main.py
15
app/main.py
@@ -13,8 +13,21 @@ from geolite2 import geolite2
|
||||
from download_image_map import Parser
|
||||
from mirror_list import Mirror
|
||||
|
||||
import sys
|
||||
mirror_path="mirrors.yaml"
|
||||
# list of managed options string
|
||||
options=["--mirror-conf"]
|
||||
# look on all provided command line parameters
|
||||
for param in sys.argv[1:]:
|
||||
for opt in options:
|
||||
if param.startswith(opt):
|
||||
if opt=="--mirror-conf":
|
||||
mirror_path=param[len(opt)+1:]
|
||||
else:
|
||||
print("Unhandled option",param)
|
||||
break
|
||||
|
||||
mirror = Mirror()
|
||||
mirror = Mirror(mirror_path)
|
||||
if mirror.mode == "dl_map":
|
||||
parser = Parser('userdata.csv')
|
||||
DL_MAP = parser.parsed_data
|
||||
|
||||
Reference in New Issue
Block a user