mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-06 11:35:29 +00:00
add download range
This commit is contained in:
parent
e228254499
commit
9ba3997c40
@ -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)
|
||||
|
@ -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'
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user