Moved argument parsing to function.
This commit is contained in:
parent
3f11eb3f59
commit
ee7908538f
23
adl.py
23
adl.py
@ -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()
|
||||||
|
|
||||||
@ -269,7 +261,7 @@ def main():
|
|||||||
args = vars(ap.parse_args())
|
args = vars(ap.parse_args())
|
||||||
|
|
||||||
# print(args)
|
# print(args)
|
||||||
|
|
||||||
# get player
|
# get player
|
||||||
if args["player"]:
|
if args["player"]:
|
||||||
player = str(args["player"]) # get player from user
|
player = str(args["player"]) # get player from user
|
||||||
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user