Hotstar fix for track selection

This commit is contained in:
chu23465 2025-04-29 09:04:01 +05:30
parent bbdcbb64b6
commit 5ca267d05f

View File

@ -260,7 +260,8 @@ async def m3u8dl(uri, out, track, headers=None, proxy=None):
"--thread-count", "96", "--thread-count", "96",
"--download-retry-count", "20", "--download-retry-count", "20",
"--ffmpeg-binary-path", f'"{ffmpeg_binary}"', "--ffmpeg-binary-path", f'"{ffmpeg_binary}"',
"--binary-merge" "--binary-merge",
"-M", "format=mp4"
] ]
if headers and track.source == "HS": if headers and track.source == "HS":
arguments.extend(["--header", f'"Cookie:{headers["cookie"].replace(" ", "")}"']) arguments.extend(["--header", f'"Cookie:{headers["cookie"].replace(" ", "")}"'])
@ -275,15 +276,13 @@ async def m3u8dl(uri, out, track, headers=None, proxy=None):
if not ("linux" in platform): if not ("linux" in platform):
arguments.extend(["--http-request-timeout", "8"]) arguments.extend(["--http-request-timeout", "8"])
if track.__class__.__name__ == "VideoTrack": if track.__class__.__name__ == "VideoTrack":
from vinetrimmer.objects.tracks import Track if track.height:
if track.height and not (track.descriptor == Track.Descriptor.M3U):
arguments.extend([ arguments.extend([
"-sv", f"res='{track.height}*':codec='{track.codec}':for=best" "-sv", f"res='{track.height}*':codec='{track.codec}':for=best",
]) ])
else: else:
arguments.extend([ arguments.extend([
"-sv", "best", "-sv", "best",
"-M", "format=mp4"
]) ])
arguments.extend([ arguments.extend([
@ -317,4 +316,11 @@ async def m3u8dl(uri, out, track, headers=None, proxy=None):
else: else:
p = subprocess.run(shlex.split(arg_str), check=True) p = subprocess.run(shlex.split(arg_str), check=True)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
raise ValueError("N_m3u8DL-RE failed too many times, aborting") arg_str.replace(f"res='{track.height}*':codec='{track.codec}':for=", "")
try:
if "win" in platform:
p = subprocess.run(arg_str, check=True)
else:
p = subprocess.run(shlex.split(arg_str), check=True)
except:
raise ValueError("N_m3u8DL-RE failed too many times, aborting")