mirror of
https://codeberg.org/ashley/poke.git
synced 2024-12-26 06:48:39 +01:00
edited cmdline
This commit is contained in:
parent
174e0564a7
commit
e21718181e
1 changed files with 8 additions and 9 deletions
|
@ -57,9 +57,9 @@ async def merge(request: aiohttp.web.Request):
|
||||||
stderr=asyncio.subprocess.PIPE
|
stderr=asyncio.subprocess.PIPE
|
||||||
)
|
)
|
||||||
response = web.StreamResponse(status=206, reason='OK', headers={
|
response = web.StreamResponse(status=206, reason='OK', headers={
|
||||||
'Content-Type': 'video/mp4',
|
'Content-Type': 'application/octet-stream',
|
||||||
'Transfer-Encoding': 'chunked',
|
'Transfer-Encoding': 'chunked',
|
||||||
'Accept-Ranges': 'bytes'
|
'Content-Disposition': 'inline'
|
||||||
})
|
})
|
||||||
await response.prepare(request)
|
await response.prepare(request)
|
||||||
try:
|
try:
|
||||||
|
@ -69,9 +69,10 @@ async def merge(request: aiohttp.web.Request):
|
||||||
break
|
break
|
||||||
await response.write(chunk)
|
await response.write(chunk)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
print(f"Error streaming FFmpeg output: {e}")
|
print(f"Error streaming FFmpeg output: {e}")
|
||||||
finally:
|
#finally:
|
||||||
await response.write_eof()
|
#await response.write_eof()
|
||||||
else:
|
else:
|
||||||
# Likely to be chromium browser, so to avoid browser shitting itself we download file
|
# Likely to be chromium browser, so to avoid browser shitting itself we download file
|
||||||
job_id = f"{request.rel_url.query["id"]}_{request.rel_url.query["audio_itag"]}_{request.rel_url.query["video_itag"]}"
|
job_id = f"{request.rel_url.query["id"]}_{request.rel_url.query["audio_itag"]}_{request.rel_url.query["video_itag"]}"
|
||||||
|
@ -79,11 +80,9 @@ async def merge(request: aiohttp.web.Request):
|
||||||
return web.FileResponse(
|
return web.FileResponse(
|
||||||
path=f"{job_id}.mp4"
|
path=f"{job_id}.mp4"
|
||||||
)
|
)
|
||||||
cmdline = f"ffmpeg -i \"https://eu-proxy.poketube.fun/latest_version?id={video_id}&itag={audio_itag}&local=true\" -i \"https://eu-proxy.poketube.fun/latest_version?id={video_id}&itag={video_itag}&local=true\" -c copy -f mp4 -movflags frag_keyframe+empty_moov {job_id}.mp4"
|
cmdline = f"ffmpeg -i \"https://eu-proxy.poketube.fun/latest_version?id={video_id}&itag={audio_itag}&local=true\" -i \"https://eu-proxy.poketube.fun/latest_version?id={video_id}&itag={video_itag}&local=true\" -c:v copy -f mp4 -movflags frag_keyframe+empty_moov {job_id}.mp4"
|
||||||
process = await asyncio.create_subprocess_shell(
|
process = await asyncio.create_subprocess_shell(
|
||||||
cmdline,
|
cmdline
|
||||||
stdout=asyncio.subprocess.PIPE,
|
|
||||||
stderr=asyncio.subprocess.PIPE
|
|
||||||
)
|
)
|
||||||
await process.wait()
|
await process.wait()
|
||||||
if process.returncode != 0: # Log or handle the error
|
if process.returncode != 0: # Log or handle the error
|
||||||
|
|
Loading…
Reference in a new issue