Updated watch function
This commit is contained in:
parent
13be5cdfd3
commit
2c688028ce
45
adl.py
45
adl.py
@ -4,10 +4,10 @@ from time import sleep
|
|||||||
# argument parser
|
# argument parser
|
||||||
ap = argparse.ArgumentParser()
|
ap = argparse.ArgumentParser()
|
||||||
|
|
||||||
ap.add_argument("-a", "--account", required=False,
|
|
||||||
help="By default trackma will use account 1. Use '-a 2' for example to change trackma account")
|
|
||||||
ap.add_argument("-p", "--player", required=False,
|
ap.add_argument("-p", "--player", required=False,
|
||||||
help="Define player used for streaming. Ex: \033[0;36mpyadl -p mpv\033[0m")
|
help="Define player used for streaming. Ex: \033[0;36mpyadl -p mpv\033[0m")
|
||||||
|
ap.add_argument("-a", "--account", required=False,
|
||||||
|
help="By default trackma will use account 1. Use '-a 2' for example to change trackma account")
|
||||||
ap.add_argument("-d", "--download", required=False, type=bool, nargs='?', const=True, default=False,
|
ap.add_argument("-d", "--download", required=False, type=bool, nargs='?', const=True, default=False,
|
||||||
help="Download instead of streaming")
|
help="Download instead of streaming")
|
||||||
ap.add_argument("-v", "--version", required=False, nargs='?', const=True,
|
ap.add_argument("-v", "--version", required=False, nargs='?', const=True,
|
||||||
@ -145,8 +145,11 @@ def get_score(choice):
|
|||||||
return choice
|
return choice
|
||||||
|
|
||||||
# watch animes
|
# watch animes
|
||||||
def watch(cmd):
|
def watch(title, episode):
|
||||||
subprocess.run(cmd)
|
if not download:
|
||||||
|
subprocess.run('anime dl "' + title + '" --episodes ' + episode + ' --play ' + player)
|
||||||
|
else:
|
||||||
|
subprocess.run('anime dl "' + title + '" --episodes ' + episode)
|
||||||
|
|
||||||
# next episode
|
# next episode
|
||||||
def next_episode(title,episode):
|
def next_episode(title,episode):
|
||||||
@ -155,7 +158,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))
|
||||||
watch('anime dl "' + title + '" --episodes ' + str(episode) + ' --play ' + player)
|
watch(title, str(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]: ")
|
||||||
@ -167,58 +170,40 @@ def next_episode(title,episode):
|
|||||||
else:
|
else:
|
||||||
episode = episode + 1
|
episode = episode + 1
|
||||||
watch_prompt(title, str(episode))
|
watch_prompt(title, str(episode))
|
||||||
watch('anime dl "' + title + '" --episodes ' + str(episode))
|
watch(title, 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:
|
watch(title, str(episode + 1) + ':')
|
||||||
watch('anime dl "' + title + '" --episodes ' + str(episode + 1) + ': --play s' + player)
|
|
||||||
else:
|
|
||||||
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:
|
watch(title, '1:')
|
||||||
watch('anime dl "' + title + '" --episodes 1: --play ' + player)
|
|
||||||
else:
|
|
||||||
watch('anime dl "' + title + '" --episodes 1:')
|
|
||||||
|
|
||||||
# watch from custom range
|
# watch from custom range
|
||||||
def custom_episode_range(title):
|
def custom_episode_range(title):
|
||||||
begginig = color_prommpt("Beggining of interval?: ")
|
begginig = color_prommpt("Beggining of interval?: ")
|
||||||
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:
|
watch(title, begginig + ':' + end)
|
||||||
watch('anime dl "' + title + '" --episodes ' + begginig + ':' + end +' --play ' + player)
|
|
||||||
else:
|
|
||||||
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:
|
watch(title, str(episode + int(action)) )
|
||||||
watch('anime dl "' + title + '" --episodes ' + str(episode + int(action)) + ' --play ' + player)
|
|
||||||
else:
|
|
||||||
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:
|
watch(title, str(episode))
|
||||||
watch('anime dl "' + title + '" --episodes ' + str(episode) + ' --play ' + player)
|
|
||||||
else:
|
|
||||||
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:
|
watch(title, episode)
|
||||||
watch('anime dl "' + title + '" --episodes ' + episode + ' --play ' + player)
|
|
||||||
else:
|
|
||||||
watch('anime dl "' + title + '" --episodes ' + episode)
|
|
||||||
|
|
||||||
# update title
|
# update title
|
||||||
def update_title(title, episode):
|
def update_title(title, episode):
|
||||||
|
Loading…
Reference in New Issue
Block a user