mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 07:38:24 +01:00
nothing more
This commit is contained in:
parent
6826788925
commit
08271eb2b4
1 changed files with 11 additions and 10 deletions
|
@ -5,6 +5,7 @@ import string
|
|||
import os
|
||||
import random
|
||||
import subprocess
|
||||
from aiohttp.web import Response, FileResponse
|
||||
|
||||
app = web.Application()
|
||||
app.router._frozen = False
|
||||
|
@ -31,20 +32,20 @@ async def merge(request):
|
|||
if not video_itag.isdigit():
|
||||
print(f"Video itag {video_itag} flagged as invalid, dropping request")
|
||||
return
|
||||
if os.path.isfile(f"done.{job_id}"):
|
||||
if os.path.isfile(f"{job_id}.mp4"):
|
||||
return web.FileResponse(
|
||||
path=f"output.{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 {video_id}.mp4"
|
||||
proc_ffmpeg = await asyncio.create_subprocess_shell(
|
||||
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 output.{job_id}.mp4"
|
||||
)
|
||||
await proc_ffmpeg.wait()
|
||||
f = open(f"done.{job_id}", "a")
|
||||
f.write(":3")
|
||||
f.close()
|
||||
return web.FileResponse(
|
||||
path=f"output.{job_id}.mp4"
|
||||
cmdline,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE
|
||||
)
|
||||
print(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 -")
|
||||
stdout, stderr = await proc_ffmpeg.communicate()
|
||||
response = FileResponse(f"{video_id}.mp4")
|
||||
return response
|
||||
|
||||
async def ping(request):
|
||||
return web.Response(body='{"success": true}', content_type="application/json")
|
||||
|
|
Loading…
Reference in a new issue