Moved while loops to separate functions.

This commit is contained in:
CronyAkatsuki 2021-10-31 21:33:39 +01:00
parent ee7908538f
commit 465286fd3c

42
adl.py
View File

@ -311,20 +311,7 @@ def argument_parser():
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
if not show == "" and not episode == 0:
watch(show, str(episode), download, provider, player)
elif not show == "":
def specific_show_loop(show, msg, download, provider, player):
while True:
# choose what to do with the choosen anime
action = choose_episode_specific_show()
@ -348,7 +335,8 @@ def main():
# skip the anime
elif action == "s" or action == "S":
exit_adl()
else:
def main_loop(retrieve, account, msg, download,provider,player):
# main loop
while True:
# retrieving the list on start
@ -445,7 +433,31 @@ def main():
else:
exit_ask()
def main():
signal.signal(signal.SIGINT, interupt_command)
# setup env variables for better readability of outputs
os.environ['LINES'] = '25'
os.environ['COLUMNS'] = '120'
# get argument parametes
(player, provider, show, episode, account, download, msg) = argument_parser()
# retrieve the trackma list on run
retrieve = True
if not show == "" and not episode == 0:
# watching just a specific show and episode only
watch(show, str(episode), download, provider, player)
elif not show == "":
# choose want to do with a specific show
specific_show_loop(show, msg, download, provider, player)
else:
# main loop that connets with your list with trackma
main_loop(retrieve, account, msg, download,provider,player)
exit_adl()
# run only if runned directly
if __name__ == "__main__" :
main()