Season range and all download

This commit is contained in:
Fede14 2024-02-27 02:10:21 +01:00
parent fe687daf9d
commit b7afb1ae4f

View File

@ -135,7 +135,7 @@ def dw_single_ep(tv_id, eps, index_ep_select, domain, token, tv_name, season_sel
m3u8_key = get_m3u8_key_ep(json_win_video, json_win_param, tv_name, season_select, index_ep_select+1, eps[index_ep_select]['name'], token_render) m3u8_key = get_m3u8_key_ep(json_win_video, json_win_param, tv_name, season_select, index_ep_select+1, eps[index_ep_select]['name'], token_render)
mp4_name = f"{tv_name.replace('+', '_')}_S{str(season_select)}E{str(index_ep_select+1)}" mp4_name = f"{tv_name.replace('+', '_')}_S{str(season_select)}E{str(index_ep_select+1)}"
mp4_format = mp4_name + ".mp4" mp4_format = f"{mp4_name}.mp4"
mp4_path = os.path.join("videos", mp4_format) mp4_path = os.path.join("videos", mp4_format)
m3u8_url_audio = get_m3u8_playlist(json_win_video, json_win_param, tv_name, season_select, index_ep_select+1, eps[index_ep_select]['name'], token_render) m3u8_url_audio = get_m3u8_playlist(json_win_video, json_win_param, tv_name, season_select, index_ep_select+1, eps[index_ep_select]['name'], token_render)
@ -151,8 +151,9 @@ def main_dw_tv(tv_id, tv_name, version, domain):
num_season_find = get_info_tv(tv_id, tv_name, version, domain) num_season_find = get_info_tv(tv_id, tv_name, version, domain)
console.print(f"[blue]Season find: [red]{num_season_find}") console.print(f"[blue]Season find: [red]{num_season_find}")
season_select = int(msg.ask("\n[green]Insert season number: ")) season_select = str(msg.ask("\n[green]Insert season number: "))
if season_select != "*":
season_select = int(season_select)
if 1 <= season_select <= num_season_find: if 1 <= season_select <= num_season_find:
eps = get_info_season(tv_id, tv_name, domain, version, token, season_select) eps = get_info_season(tv_id, tv_name, domain, version, token, season_select)
@ -185,3 +186,18 @@ def main_dw_tv(tv_id, tv_name, version, domain):
else: else:
console.print("[red]Wrong index for season") console.print("[red]Wrong index for season")
elif "[" in season_select:
start, end = map(int, season_select[1:-1].split('-'))
result = list(range(start, end + 1))
for n_season in result:
eps = get_info_season(tv_id, tv_name, domain, version, token, n_season)
for ep in eps:
dw_single_ep(tv_id, eps, int(ep['n'])-1, domain, token, tv_name, n_season)
print("\n")
else:
for n_season in range(1, num_season_find):
eps = get_info_season(tv_id, tv_name, domain, version, token, n_season)
for ep in eps:
dw_single_ep(tv_id, eps, int(ep['n'])-1, domain, token, tv_name, n_season)
print("\n")