Moved argument parsing to function.

This commit is contained in:
CronyAkatsuki 2021-10-31 21:22:20 +01:00
parent 3f11eb3f59
commit ee7908538f

21
adl.py
View File

@ -17,8 +17,6 @@ def exit_adl():
def interupt_command(signum, frame): def interupt_command(signum, frame):
exit_adl() exit_adl()
# colored print # colored print
def color_print(text): def color_print(text):
print("\033[0;36m" + text + " \033[0m") print("\033[0;36m" + text + " \033[0m")
@ -241,13 +239,7 @@ def choose_episode_specific_show():
color_print(" S - Skip. Exit adl.") color_print(" S - Skip. Exit adl.")
return color_prommpt("Your choice? [A/i/c/s]: ") return color_prommpt("Your choice? [A/i/c/s]: ")
def main(): def argument_parser():
signal.signal(signal.SIGINT, interupt_command)
# setup env variables for better readability of outputs
os.environ['LINES'] = '25'
os.environ['COLUMNS'] = '120'
# argument parser # argument parser
ap = argparse.ArgumentParser() ap = argparse.ArgumentParser()
@ -317,6 +309,17 @@ def main():
print("Py-adl version 1.1") print("Py-adl version 1.1")
sys.exit() sys.exit()
return (player, provider, show, episode, account, download, msg)
def main():
signal.signal(signal.SIGINT, interupt_command)
# setup env variables for better readability of outputs
os.environ['LINES'] = '25'
os.environ['COLUMNS'] = '120'
(player, provider, show, episode, account, download, msg) = argument_parser()
retrieve = True retrieve = True
if not show == "" and not episode == 0: if not show == "" and not episode == 0: