create a function for anime dl running

This commit is contained in:
CronyAkatsuki 2021-07-10 17:25:43 +02:00
parent 7804ccc29f
commit 9e2ddbe178

33
adl.py
View File

@ -140,6 +140,10 @@ def get_score(choice):
choice = choice[68:71] choice = choice[68:71]
return choice return choice
# watch anime
def watch(cmd):
os.system(cmd)
# next episode # next episode
def next_episode(title,episode): def next_episode(title,episode):
if not download: if not download:
@ -147,7 +151,7 @@ def next_episode(title,episode):
while watch_next: while watch_next:
episode = episode + 1 episode = episode + 1
watch_prompt(title, str(episode)) watch_prompt(title, str(episode))
subprocess.call('anime dl "' + title + '" --episodes ' + str(episode) + ' --play ' + player) watch('anime dl "' + title + '" --episodes ' + str(episode) + ' --play ' + player)
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]: ")
@ -159,23 +163,23 @@ def next_episode(title,episode):
else: else:
episode = episode + 1 episode = episode + 1
watch_prompt(title, str(episode)) watch_prompt(title, str(episode))
subprocess.call('anime dl "' + title + '" --episodes ' + str(episode)) watch('anime dl "' + title + '" --episodes ' + str(episode))
# all from last watched # all from last watched
def all_from_last(title,episode): def all_from_last(title,episode):
watch_prompt(title, str(episode) + " all left episodes") watch_prompt(title, str(episode) + " all left episodes")
if not download: if not download:
subprocess.call('anime dl "' + title + '" --episodes ' + str(episode + 1) + ': --play s' + player) watch('anime dl "' + title + '" --episodes ' + str(episode + 1) + ': --play s' + player)
else: else:
subprocess.call('anime dl "' + title + '" --episodes ' + str(episode + 1) + ':') watch('anime dl "' + title + '" --episodes ' + str(episode + 1) + ':')
# all episode # all episode
def all_episodes(title): def all_episodes(title):
watch_prompt(title, "all") watch_prompt(title, "all")
if not download: if not download:
subprocess.call('anime dl "' + title + '" --episodes 1: --play ' + player) watch('anime dl "' + title + '" --episodes 1: --play ' + player)
else: else:
subprocess.call('anime dl "' + title + '" --episodes 1:') watch('anime dl "' + title + '" --episodes 1:')
# watch from custom range # watch from custom range
def custom_episode_range(title): def custom_episode_range(title):
@ -183,34 +187,34 @@ def custom_episode_range(title):
end = color_prommpt("End of interval?: ") end = color_prommpt("End of interval?: ")
watch_prompt(title, begginig + " to " + end) watch_prompt(title, begginig + " to " + end)
if not download: if not download:
subprocess.call('anime dl "' + title + '" --episodes ' + begginig + ':' + end +' --play ' + player) watch('anime dl "' + title + '" --episodes ' + begginig + ':' + end +' --play ' + player)
else: else:
subprocess.call('anime dl "' + title + '" --episodes ' + begginig + ':' + end) watch('anime dl "' + title + '" --episodes ' + begginig + ':' + end)
# add to last watched m # add to last watched m
def next_plus_n(title, episode, action): def next_plus_n(title, episode, action):
watch_prompt(title, str(episode + int(action))) watch_prompt(title, str(episode + int(action)))
if not download: if not download:
subprocess.call('anime dl "' + title + '" --episodes ' + str(episode + int(action)) + ' --play ' + player) watch('anime dl "' + title + '" --episodes ' + str(episode + int(action)) + ' --play ' + player)
else: else:
subprocess.call('anime dl "' + title + '" --episodes ' + str(episode + int(action))) watch('anime dl "' + title + '" --episodes ' + str(episode + int(action)))
# rewatch current episode # rewatch current episode
def rewatch_episode(title, episode): def rewatch_episode(title, episode):
watch_prompt(title, str(episode)) watch_prompt(title, str(episode))
if not download: if not download:
subprocess.call('anime dl "' + title + '" --episodes ' + str(episode) + ' --play ' + player) watch('anime dl "' + title + '" --episodes ' + str(episode) + ' --play ' + player)
else: else:
subprocess.call('anime dl "' + title + '" --episodes ' + str(episode)) watch('anime dl "' + title + '" --episodes ' + str(episode))
# watch custom episode # watch custom episode
def custom_episode(title): def custom_episode(title):
episode = color_prommpt("Enter custom episode: ") episode = color_prommpt("Enter custom episode: ")
watch_prompt(title, episode) watch_prompt(title, episode)
if not download: if not download:
subprocess.call('anime dl "' + title + '" --episodes ' + episode + ' --play ' + player) watch('anime dl "' + title + '" --episodes ' + episode + ' --play ' + player)
else: else:
subprocess.call('anime dl "' + title + '" --episodes ' + episode) watch('anime dl "' + title + '" --episodes ' + episode)
# update title # update title
def update_title(title, episode): def update_title(title, episode):
@ -287,7 +291,6 @@ def choose_episode():
color_print(" S - Skip. Choose another show.") color_print(" S - Skip. Choose another show.")
return color_prommpt("Your choice? [N/l/a/i/0-9/r/c/u/s]: ") return color_prommpt("Your choice? [N/l/a/i/0-9/r/c/u/s]: ")
# main loop # main loop
while True: while True:
# retrieving the list on start # retrieving the list on start