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, 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("-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, ap.add_argument("-a", "--account", required=False,
help="By default trackma will use account 1. Use '-a 2' for example to change trackma account") 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,
@ -17,11 +21,7 @@ ap.add_argument("-r", "--retrieve", required=False, nargs='?', const=True,
args = vars(ap.parse_args()) args = vars(ap.parse_args())
# get account print(args)
if args['account']:
account = str(int(args["account"]) - 1) # take the account from input
else:
account = "0" # default account
# get player # get player
if args["player"]: if args["player"]:
@ -29,6 +29,24 @@ if args["player"]:
else: else:
player = "mpv" # default player 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 # enable downloading
if args["download"]: if args["download"]:
download = True # enable downloading download = True # enable downloading
@ -146,10 +164,15 @@ def get_score(choice):
# watch animes # watch animes
def watch(title, episode): def watch(title, episode):
cmd = 'anime dl "' + title + '" --episodes ' + episode
if not download: if not download:
subprocess.run('anime dl "' + title + '" --episodes ' + episode + ' --play ' + player) cmd += ' --play ' + player
else:
subprocess.run('anime dl "' + title + '" --episodes ' + episode) if not provider == "":
cmd += ' --provider ' + provider
subprocess.run(cmd)
# next episode # next episode
def next_episode(title,episode): def next_episode(title,episode):
@ -281,8 +304,42 @@ 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 def choose_episode_specific_show():
while True: 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 # retrieving the list on start
if retrieve: if retrieve:
retrieve_list() retrieve_list()