mirror of
https://codeberg.org/ashley/poke.git
synced 2024-12-26 06:08:39 +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 os
|
||||||
import random
|
import random
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from aiohttp.web import Response, FileResponse
|
||||||
|
|
||||||
app = web.Application()
|
app = web.Application()
|
||||||
app.router._frozen = False
|
app.router._frozen = False
|
||||||
|
@ -31,20 +32,20 @@ async def merge(request):
|
||||||
if not video_itag.isdigit():
|
if not video_itag.isdigit():
|
||||||
print(f"Video itag {video_itag} flagged as invalid, dropping request")
|
print(f"Video itag {video_itag} flagged as invalid, dropping request")
|
||||||
return
|
return
|
||||||
if os.path.isfile(f"done.{job_id}"):
|
if os.path.isfile(f"{job_id}.mp4"):
|
||||||
return web.FileResponse(
|
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(
|
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"
|
cmdline,
|
||||||
)
|
stdout=asyncio.subprocess.PIPE,
|
||||||
await proc_ffmpeg.wait()
|
stderr=asyncio.subprocess.PIPE
|
||||||
f = open(f"done.{job_id}", "a")
|
|
||||||
f.write(":3")
|
|
||||||
f.close()
|
|
||||||
return web.FileResponse(
|
|
||||||
path=f"output.{job_id}.mp4"
|
|
||||||
)
|
)
|
||||||
|
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):
|
async def ping(request):
|
||||||
return web.Response(body='{"success": true}', content_type="application/json")
|
return web.Response(body='{"success": true}', content_type="application/json")
|
||||||
|
|
Loading…
Reference in a new issue