Redid some if questions
This commit is contained in:
parent
653a85138b
commit
13be5cdfd3
42
adl.py
42
adl.py
@ -48,12 +48,6 @@ if args["retrieve"]:
|
|||||||
else:
|
else:
|
||||||
retrieve = True # retrieve new list
|
retrieve = True # retrieve new list
|
||||||
|
|
||||||
# exit function
|
|
||||||
def exit_adl():
|
|
||||||
fzf_file.close()
|
|
||||||
os.remove(fzf_file_path)
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
# required files
|
# required files
|
||||||
dn = os.path.dirname(os.path.realpath(__file__)) # get current directory of the script
|
dn = os.path.dirname(os.path.realpath(__file__)) # get current directory of the script
|
||||||
good_title = open(dn + "/good_title.txt").readlines() # the list of good titles
|
good_title = open(dn + "/good_title.txt").readlines() # the list of good titles
|
||||||
@ -62,6 +56,17 @@ fzf_file = open(dn + "/fzf.txt", "w+") # temp file for fzf
|
|||||||
fzf_file_path = dn +"/fzf.txt" # path of the temp file
|
fzf_file_path = dn +"/fzf.txt" # path of the temp file
|
||||||
print_fzf_path = "python " + dn + "/print_fzf.py" # print the fzf file
|
print_fzf_path = "python " + dn + "/print_fzf.py" # print the fzf file
|
||||||
|
|
||||||
|
# exit function
|
||||||
|
def exit_adl():
|
||||||
|
fzf_file.close()
|
||||||
|
os.remove(fzf_file_path)
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
def interupt_command(signum, frame):
|
||||||
|
exit_adl()
|
||||||
|
|
||||||
|
signal.signal(signal.SIGINT, interupt_command)
|
||||||
|
|
||||||
# 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")
|
||||||
@ -105,11 +110,9 @@ def exit_ask():
|
|||||||
while True:
|
while True:
|
||||||
subprocess.call("cls", shell=True)
|
subprocess.call("cls", shell=True)
|
||||||
choice = color_prommpt("Want to watch another anime? [Y/n]: ")
|
choice = color_prommpt("Want to watch another anime? [Y/n]: ")
|
||||||
if choice == "":
|
if choice == "N" or choice == "n":
|
||||||
exit_adl()
|
exit_adl()
|
||||||
elif choice == "N" or choice == "n":
|
elif choice == "Y" or choice == "y" or choice == "":
|
||||||
exit_adl()
|
|
||||||
elif choice == "Y" or choice == "y":
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# check for problematic title
|
# check for problematic title
|
||||||
@ -156,7 +159,7 @@ def next_episode(title,episode):
|
|||||||
while True:
|
while True:
|
||||||
color_print("Current watched episode: " + str(episode))
|
color_print("Current watched episode: " + str(episode))
|
||||||
yn = color_prommpt("Wanna watch next episode? [Y/n]: ")
|
yn = color_prommpt("Wanna watch next episode? [Y/n]: ")
|
||||||
if yn == "Y" or yn == "y":
|
if yn == "Y" or yn == "y" or yn == "":
|
||||||
break
|
break
|
||||||
elif yn == "N" or yn == "n":
|
elif yn == "N" or yn == "n":
|
||||||
watch_next = False
|
watch_next = False
|
||||||
@ -244,7 +247,7 @@ def update_question(title, episode, score):
|
|||||||
while True:
|
while True:
|
||||||
color_print("Skipping watching episodes. Modifing entry.")
|
color_print("Skipping watching episodes. Modifing entry.")
|
||||||
choice = color_prommpt("Update episode number or update score [E/s]: ")
|
choice = color_prommpt("Update episode number or update score [E/s]: ")
|
||||||
if choice == "e" or choice == "E":
|
if choice == "e" or choice == "E" or choice == "":
|
||||||
update_title(title, episode)
|
update_title(title, episode)
|
||||||
break
|
break
|
||||||
elif choice == "s" or choice == "S":
|
elif choice == "s" or choice == "S":
|
||||||
@ -258,7 +261,7 @@ def wanna_continu_watch():
|
|||||||
yn = color_prommpt("Wanna continue watching? [Y/n]: ")
|
yn = color_prommpt("Wanna continue watching? [Y/n]: ")
|
||||||
else:
|
else:
|
||||||
yn = color_prommpt("Wanna continue downloading? [Y/n]: ")
|
yn = color_prommpt("Wanna continue downloading? [Y/n]: ")
|
||||||
if yn == "y" or yn == "Y":
|
if yn == "y" or yn == "Y" or yn == "":
|
||||||
return True
|
return True
|
||||||
elif yn == "n" or yn == "N":
|
elif yn == "n" or yn == "N":
|
||||||
return False
|
return False
|
||||||
@ -274,13 +277,9 @@ def wanna_update_title_after_watch(title, episode, score):
|
|||||||
elif yn == "S" or yn == "s":
|
elif yn == "S" or yn == "s":
|
||||||
update_score(title, score)
|
update_score(title, score)
|
||||||
break
|
break
|
||||||
elif yn == "N" or yn == "n":
|
elif yn == "N" or yn == "n" or yn == "":
|
||||||
break
|
break
|
||||||
|
|
||||||
def interupt_command(signum, frame):
|
|
||||||
exit_adl()
|
|
||||||
|
|
||||||
signal.signal(signal.SIGINT, interupt_command)
|
|
||||||
|
|
||||||
# choose what to do with episode
|
# choose what to do with episode
|
||||||
def choose_episode():
|
def choose_episode():
|
||||||
@ -331,12 +330,7 @@ while True:
|
|||||||
# choose what to do with the choosen anime
|
# choose what to do with the choosen anime
|
||||||
action = choose_episode()
|
action = choose_episode()
|
||||||
# watch next episode
|
# watch next episode
|
||||||
if action == "":
|
if action == "n" or action == "N" or action == "":
|
||||||
next_episode(title, episode)
|
|
||||||
wanna_update_title_after_watch(title, episode, score)
|
|
||||||
break
|
|
||||||
# same
|
|
||||||
elif action == "n" or action == "N":
|
|
||||||
next_episode(title, episode)
|
next_episode(title, episode)
|
||||||
wanna_update_title_after_watch(title, episode, score)
|
wanna_update_title_after_watch(title, episode, score)
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user