Moved while loops to separate functions.
This commit is contained in:
parent
ee7908538f
commit
465286fd3c
42
adl.py
42
adl.py
@ -311,20 +311,7 @@ def argument_parser():
|
|||||||
|
|
||||||
return (player, provider, show, episode, account, download, msg)
|
return (player, provider, show, episode, account, download, msg)
|
||||||
|
|
||||||
def main():
|
def specific_show_loop(show, msg, download, provider, player):
|
||||||
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 == "":
|
|
||||||
while True:
|
while True:
|
||||||
# choose what to do with the choosen anime
|
# choose what to do with the choosen anime
|
||||||
action = choose_episode_specific_show()
|
action = choose_episode_specific_show()
|
||||||
@ -348,7 +335,8 @@ def main():
|
|||||||
# skip the anime
|
# skip the anime
|
||||||
elif action == "s" or action == "S":
|
elif action == "s" or action == "S":
|
||||||
exit_adl()
|
exit_adl()
|
||||||
else:
|
|
||||||
|
def main_loop(retrieve, account, msg, download,provider,player):
|
||||||
# main loop
|
# main loop
|
||||||
while True:
|
while True:
|
||||||
# retrieving the list on start
|
# retrieving the list on start
|
||||||
@ -445,7 +433,31 @@ def main():
|
|||||||
else:
|
else:
|
||||||
exit_ask()
|
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()
|
exit_adl()
|
||||||
|
|
||||||
|
# run only if runned directly
|
||||||
if __name__ == "__main__" :
|
if __name__ == "__main__" :
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user