diff --git a/Src/Api/tv.py b/Src/Api/tv.py index f764621..f600fbe 100644 --- a/Src/Api/tv.py +++ b/Src/Api/tv.py @@ -145,15 +145,26 @@ def main_dw_tv(tv_id, tv_name, version, domain): for ep in eps: console.print(f"[green]Ep: [blue]{ep['n']} [green]=> [purple]{ep['name']}") - index_ep_select = str(msg.ask("\n[green]Insert ep [red]number [green]or [red](*) [green]to download all ep: ")) + index_ep_select = str(msg.ask("\n[green]Insert ep [red]number [yellow]or [red](*) [green]to download all ep [yellow]or [red][1-2] [green]for a range of ep: ")) - if index_ep_select != "*": + # Download range [] + if "[" in index_ep_select: + start, end = map(int, index_ep_select[1:-1].split('-')) + result = list(range(start, end + 1)) + + for n_randge_ep in result: + index_ep_select = int(n_randge_ep) + dw_single_ep(tv_id, eps, n_randge_ep-1, domain, token, tv_name, season_select) + + # Download single ep + elif index_ep_select != "*": if 1 <= int(index_ep_select) <= len(eps): index_ep_select = int(index_ep_select) - 1 dw_single_ep(tv_id, eps, index_ep_select, domain, token, tv_name, season_select) else: console.print("[red]Wrong index for ep") + # Download all else: for ep in eps: dw_single_ep(tv_id, eps, int(ep['n'])-1, domain, token, tv_name, season_select) diff --git a/Src/Upload/__version__.py b/Src/Upload/__version__.py index 0c908d8..d172986 100644 --- a/Src/Upload/__version__.py +++ b/Src/Upload/__version__.py @@ -1,5 +1,5 @@ __title__ = 'Streaming_community' -__version__ = 'v0.8.2' +__version__ = 'v0.8.3' __author__ = 'Ghost6446' __description__ = 'A command-line program to download film' __license__ = 'MIT License' diff --git a/Src/Util/FFmpeg/m3u8.py b/Src/Util/FFmpeg/m3u8.py index e9b7e86..da52157 100644 --- a/Src/Util/FFmpeg/m3u8.py +++ b/Src/Util/FFmpeg/m3u8.py @@ -178,24 +178,13 @@ class M3U8Downloader: self.join_audio() def join_audio(self): - command = [ - "ffmpeg", - "-y", - "-i", self.video_path, - "-i", self.audio_path, - "-c", "copy", - "-map", "0:v:0", - "-map", "1:a:0", - "-shortest", - "-strict", "experimental", - self.video_path + ".mp4" - ] - + output_path = self.video_path + ".mp4" try: - out = subprocess.run(command, check=True, stderr=subprocess.PIPE) - console.print("\n[green]Merge completed successfully.") - except subprocess.CalledProcessError as e: - print("ffmpeg output:", e.stderr.decode()) + video_stream = ffmpeg.input(self.video_path) + audio_stream = ffmpeg.input(self.audio_path) + ffmpeg.output(video_stream, audio_stream, output_path, vcodec="copy", acodec="copy").global_args('-map', '0:v:0', '-map', '1:a:0', '-shortest', '-strict', 'experimental').run(overwrite_output=True) + except ffmpeg.Error as e: + print("ffmpeg error:", e.stderr) os.remove(self.video_path) os.remove(self.audio_path) diff --git a/run.py b/run.py index 89eefb2..ce6ca7b 100644 --- a/run.py +++ b/run.py @@ -10,10 +10,7 @@ from Src.Upload.update import main_update from Src.Util.FFmpeg.installer import check_ffmpeg from Src.Util.Helper.os import remove_folder -# General import -import sys - - +# [ main ] def initialize(): remove_folder("tmp")