mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-23 19:55:38 +01:00
add support for only audio when its one media file
This commit is contained in:
parent
7cdb7f2345
commit
578b7f2754
@ -214,7 +214,7 @@ class HLS(VideoRetriever):
|
||||
if self.audio and not self.config.get("only_video"):
|
||||
# self._download(self.audio, file_name=(copy.copy(self.output), "audio.ts"))
|
||||
self._download(self.audio, True)
|
||||
if not self.config.get("only_audio"):
|
||||
if not self.audio or not self.config.get("only_audio"):
|
||||
self._download(self.url)
|
||||
|
||||
else:
|
||||
|
@ -48,7 +48,7 @@ class postprocess:
|
||||
audio_filename = orig_filename.with_suffix(".m4a")
|
||||
|
||||
cmd = [self.detect]
|
||||
if self.config.get("only_video") or not self.config.get("only_audio"):
|
||||
if self.config.get("only_video") or (not self.config.get("only_audio") or (not self.stream.audio and self.config.get("only_audio"))):
|
||||
cmd += ["-i", str(orig_filename)]
|
||||
if self.stream.audio and self.config.get("only_audio") or not self.config.get("only_video"):
|
||||
cmd += ["-i", str(audio_filename)]
|
||||
@ -62,13 +62,19 @@ class postprocess:
|
||||
logging.info("Merge audio and video into %s", new_name.name)
|
||||
|
||||
tempfile = orig_filename.with_suffix(".temp")
|
||||
arguments = ["-c:v", "copy", "-c:a", "copy", "-f", "matroska" if self.config.get("output_format") == "mkv" else "mp4"]
|
||||
|
||||
arguments = []
|
||||
if self.config.get("only_audio"):
|
||||
arguments += ["-vn"]
|
||||
if self.config.get("only_video"):
|
||||
arguments += ["-an"]
|
||||
arguments += ["-c:v", "copy", "-c:a", "copy", "-f", "matroska" if self.config.get("output_format") == "mkv" else "mp4"]
|
||||
if ext == ".ts":
|
||||
if audiotrack and "aac" in _getcodec(streams, audiotrack):
|
||||
arguments += ["-bsf:a", "aac_adtstoasc"]
|
||||
|
||||
cmd = [self.detect]
|
||||
if self.config.get("only_video") or not self.config.get("only_audio"):
|
||||
if self.config.get("only_video") or (not self.config.get("only_audio") or (not self.stream.audio and self.config.get("only_audio"))):
|
||||
cmd += ["-i", str(orig_filename)]
|
||||
if (self.stream.audio and self.config.get("only_audio")) or (self.stream.audio and not self.config.get("only_video")):
|
||||
cmd += ["-i", str(audio_filename)]
|
||||
@ -116,7 +122,7 @@ class postprocess:
|
||||
return
|
||||
|
||||
logging.info("Merging done, removing old files.")
|
||||
if self.config.get("only_video") or not self.config.get("only_audio"):
|
||||
if self.config.get("only_video") or (not self.config.get("only_audio") or (not self.stream.audio and self.config.get("only_audio"))):
|
||||
os.remove(orig_filename)
|
||||
if (self.stream.audio and self.config.get("only_audio")) or (self.stream.audio and not self.config.get("only_video")):
|
||||
os.remove(audio_filename)
|
||||
|
Loading…
Reference in New Issue
Block a user