mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 12:05:35 +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:
|
for ep in eps:
|
||||||
console.print(f"[green]Ep: [blue]{ep['n']} [green]=> [purple]{ep['name']}")
|
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):
|
if 1 <= int(index_ep_select) <= len(eps):
|
||||||
index_ep_select = int(index_ep_select) - 1
|
index_ep_select = int(index_ep_select) - 1
|
||||||
dw_single_ep(tv_id, eps, index_ep_select, domain, token, tv_name, season_select)
|
dw_single_ep(tv_id, eps, index_ep_select, domain, token, tv_name, season_select)
|
||||||
else:
|
else:
|
||||||
console.print("[red]Wrong index for ep")
|
console.print("[red]Wrong index for ep")
|
||||||
|
|
||||||
|
# Download all
|
||||||
else:
|
else:
|
||||||
for ep in eps:
|
for ep in eps:
|
||||||
dw_single_ep(tv_id, eps, int(ep['n'])-1, domain, token, tv_name, season_select)
|
dw_single_ep(tv_id, eps, int(ep['n'])-1, domain, token, tv_name, season_select)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
__title__ = 'Streaming_community'
|
__title__ = 'Streaming_community'
|
||||||
__version__ = 'v0.8.2'
|
__version__ = 'v0.8.3'
|
||||||
__author__ = 'Ghost6446'
|
__author__ = 'Ghost6446'
|
||||||
__description__ = 'A command-line program to download film'
|
__description__ = 'A command-line program to download film'
|
||||||
__license__ = 'MIT License'
|
__license__ = 'MIT License'
|
||||||
|
@ -178,24 +178,13 @@ class M3U8Downloader:
|
|||||||
self.join_audio()
|
self.join_audio()
|
||||||
|
|
||||||
def join_audio(self):
|
def join_audio(self):
|
||||||
command = [
|
output_path = self.video_path + ".mp4"
|
||||||
"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"
|
|
||||||
]
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
out = subprocess.run(command, check=True, stderr=subprocess.PIPE)
|
video_stream = ffmpeg.input(self.video_path)
|
||||||
console.print("\n[green]Merge completed successfully.")
|
audio_stream = ffmpeg.input(self.audio_path)
|
||||||
except subprocess.CalledProcessError as e:
|
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)
|
||||||
print("ffmpeg output:", e.stderr.decode())
|
except ffmpeg.Error as e:
|
||||||
|
print("ffmpeg error:", e.stderr)
|
||||||
|
|
||||||
os.remove(self.video_path)
|
os.remove(self.video_path)
|
||||||
os.remove(self.audio_path)
|
os.remove(self.audio_path)
|
||||||
|
5
run.py
5
run.py
@ -10,10 +10,7 @@ from Src.Upload.update import main_update
|
|||||||
from Src.Util.FFmpeg.installer import check_ffmpeg
|
from Src.Util.FFmpeg.installer import check_ffmpeg
|
||||||
from Src.Util.Helper.os import remove_folder
|
from Src.Util.Helper.os import remove_folder
|
||||||
|
|
||||||
# General import
|
# [ main ]
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def initialize():
|
def initialize():
|
||||||
|
|
||||||
remove_folder("tmp")
|
remove_folder("tmp")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user