def command_line_run():
// settings to look for
defaults = {"facebook_token": None,
"model_dir": "20170512-110547",
"image_batch": 1000,
"distance": 5}
// check for a config file first
try:
with open("config.txt") as f:
lines = f.readlines()
for line in lines:
my_line_list = line.split(" ")
if my_line_list[0] is "image_batch":
defaults["image_batch"] = int(my_line_list[2])
elif my_line_list[0] is "distance":
defaults["distance"] = int(my_line_list[2])
else:
defaults[my_line_list[0]] = my_line_list[2]
except:
print("No config.txt found")
print("You must create a config.txt file as specified in the README")
// create_new_config = input("Would you like us to create a
// new config.txt file? (y,n) : ")
// if create_new_config == "y" or create_new_config == "Y":
// print("Creating a new config...")
if defaults["facebook_token"] is None:
raise("ERROR: No facebook token in config.txt. You must supply a "
"facebook token in order to use tindetheus!")
// parse the supplied arguments
args = parse_arguments(sys.argv[1:], defaults)
// run the main function with parsed arguments
main(args, defaults["facebook_token"])