-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from kpei/amogus
Use o!rdr to render videos
- Loading branch information
Showing
32 changed files
with
330 additions
and
541 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,10 @@ | ||
FROM python:3.8-slim | ||
ENV APT_PKGS build-essential git libavcodec-dev libavformat-dev libfreetype6-dev libjpeg-dev libswscale-dev unzip zlib1g-dev | ||
ENV OSU_SKIN_PATH /home/bot/skin | ||
ENV OSR2MP4_REV fb2c4ccd6236eab8c891d2c2d36eaf08f0005082 | ||
ENV PYTHONPATH /home/bot | ||
RUN \ | ||
useradd --create-home --uid 1000 bot && \ | ||
apt-get update && \ | ||
apt-get --yes install ${APT_PKGS} ffmpeg && \ | ||
rm --recursive --force /var/lib/apt/lists && \ | ||
pip install pillow-simd && \ | ||
git clone https://github.com/uyitroa/osr2mp4-core /tmp/osr2mp4-core && \ | ||
cd /tmp/osr2mp4-core/osr2mp4 && \ | ||
git checkout $OSR2MP4_REV && \ | ||
python install.py && \ | ||
cd ImageProcess/Curves/libcurves && \ | ||
python setup.py build_ext --inplace && \ | ||
cd ../../../VideoProcess/FFmpegWriter && \ | ||
python setup.py build_ext --inplace && \ | ||
mv /tmp/osr2mp4-core/osr2mp4 /home/bot/osr2mp4 && \ | ||
chown --recursive bot /home/bot/osr2mp4 | ||
COPY assets/skin.osk /tmp/skin.osk | ||
RUN useradd --create-home --uid 1000 bot | ||
COPY requirements.txt /tmp/requirements.txt | ||
RUN \ | ||
unzip /tmp/skin.osk -d /home/bot/skin && \ | ||
pip install --requirement /tmp/requirements.txt && \ | ||
apt-get --yes remove ${APT_PKGS} && \ | ||
apt-get --yes autoremove && \ | ||
rm --recursive --force /tmp/* | ||
USER bot | ||
COPY src/ /home/bot/src | ||
CMD [ "tail", "-f", "/dev/null" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .ws import main | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from typing import Any | ||
import socketio | ||
import logging | ||
|
||
from src.worker.cache import is_render_active, set_render_id | ||
|
||
fmt = "%(asctime)s %(levelname)s: %(message)s" | ||
logging.basicConfig(level=logging.INFO, format=fmt) | ||
|
||
sio = socketio.Client(reconnection=True) | ||
|
||
@sio.event | ||
def connect() -> None: | ||
logging.info("o!rdr websocket connected.") | ||
|
||
@sio.event | ||
def disconnect() -> None: | ||
logging.error("o!rdr websocket disconnected.") | ||
|
||
@sio.on("render_done_json") | ||
def on_render_done(data: Any) -> None: | ||
try: | ||
if is_render_active(data["renderID"]): | ||
set_render_id(data["renderID"], data["videoUrl"]) | ||
logging.info(f"Got video url (id:{data['renderID']}) - {data['videoUrl']}") | ||
except Exception: | ||
logging.exception( | ||
f"o!rdr websocket: error handling render finished - data: {data}" | ||
) | ||
|
||
@sio.on("render_failed_json") | ||
def on_render_failed(data: Any) -> None: | ||
try: | ||
if is_render_active(data["renderID"]): | ||
set_render_id(data["renderID"], "failed") | ||
logging.info(f"render {data['renderID']} failed - {data['errorMessage']}") | ||
except Exception: | ||
logging.exception( | ||
f"o!rdr websocket: error handling render failed - data: {data}" | ||
) | ||
|
||
def main() -> None: | ||
sio.connect("https://apis.issou.best", socketio_path="/ordr/ws") | ||
sio.wait() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.