Added provider and to watch a certain show options

This commit is contained in:
CronyAkatsuki 2021-07-30 20:15:24 +02:00
parent d65f9184c9
commit a37e438210

77
adl.py
View File

@ -6,6 +6,10 @@ ap = argparse.ArgumentParser()
ap.add_argument("-p", "--player", required=False,
help="Define player used for streaming. Ex: \033[0;36mpyadl -p mpv\033[0m")
ap.add_argument("-i", "--provider", required=False,
help="Define provider used for streaming (check \033[0;36m$anime dl --help\033[0m for providers list)")
ap.add_argument("-s", "--show", required=False,
help='Watch custom show. Ep nr optional, careful with the quotes. Ex: \033[0;36m$adl -s "gegege 2018"\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,
@ -17,11 +21,7 @@ ap.add_argument("-r", "--retrieve", required=False, nargs='?', const=True,
args = vars(ap.parse_args())
# get account
if args['account']:
account = str(int(args["account"]) - 1) # take the account from input
else:
account = "0" # default account
print(args)
# get player
if args["player"]:
@ -29,6 +29,24 @@ if args["player"]:
else:
player = "mpv" # default player
# get provider
if args['provider']:
provider = str(args["provider"])
else:
provider = ""
# get show
if args['show']:
show = str(args["show"])
else:
show = ""
# get account
if args['account']:
account = str(int(args["account"]) - 1) # take the account from input
else:
account = "0" # default account
# enable downloading
if args["download"]:
download = True # enable downloading
@ -146,10 +164,15 @@ def get_score(choice):
# watch animes
def watch(title, episode):
cmd = 'anime dl "' + title + '" --episodes ' + episode
if not download:
subprocess.run('anime dl "' + title + '" --episodes ' + episode + ' --play ' + player)
else:
subprocess.run('anime dl "' + title + '" --episodes ' + episode)
cmd += ' --play ' + player
if not provider == "":
cmd += ' --provider ' + provider
subprocess.run(cmd)
# next episode
def next_episode(title,episode):
@ -281,8 +304,42 @@ def choose_episode():
color_print(" S - Skip. Choose another show.")
return color_prommpt("Your choice? [N/l/a/i/0-9/r/c/u/s]: ")
# main loop
while True:
def choose_episode_specific_show():
subprocess.call("cls", shell=True)
color_print("Enter lowercase or uppercase to issue command:")
color_print(" A - All available, from episode 1")
color_print(" I - custom Interval (range) of episodes")
color_print(" C - Custom episode")
color_print(" S - Skip. Exit adl.")
return color_prommpt("Your choice? [A/i/c/s]: ")
if not show == "":
while True:
# choose what to do with the choosen anime
action = choose_episode_specific_show()
if action == "a" or action == "A" or action == "":
all_episodes(show)
exit_adl()
# custom range of episodes
elif action == "i" or action == "I":
custom_episode_range(show)
if wanna_continu_watch():
continue
else:
exit_adl()
# watch custom episode
elif action == "c" or action == "C":
custom_episode(show)
if wanna_continu_watch():
continue
else:
exit_adl()
# skip the anime
elif action == "s" or action == "S":
exit_adl()
else:
# main loop
while True:
# retrieving the list on start
if retrieve:
retrieve_list()