Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import requests
|
|
| 2 |
import tempfile
|
| 3 |
import os
|
| 4 |
import shutil
|
| 5 |
-
import cv2
|
| 6 |
import subprocess
|
| 7 |
from fastapi import FastAPI, BackgroundTasks
|
| 8 |
from pydantic import BaseModel
|
|
@@ -110,13 +110,13 @@ def notify_render(anime_id, episode, quality, catbox_url, file_name, status):
|
|
| 110 |
except Exception as e:
|
| 111 |
log(f"⚠️ Render notify failed: {repr(e)}")
|
| 112 |
|
| 113 |
-
BLUR_W =
|
| 114 |
-
BLUR_H =
|
| 115 |
TEXT = "nt-animes"
|
| 116 |
FONT_COLOR = "white"
|
| 117 |
FONT_SIZE = 12
|
| 118 |
TEXT_X = 8
|
| 119 |
-
TEXT_Y =
|
| 120 |
|
| 121 |
def blur_video(input_path: str) -> str:
|
| 122 |
tmp_video = tempfile.mktemp(suffix="_video.mp4")
|
|
@@ -124,7 +124,7 @@ def blur_video(input_path: str) -> str:
|
|
| 124 |
|
| 125 |
# FFmpeg filtergraph: blur + text overlay
|
| 126 |
filter_graph = (
|
| 127 |
-
f"[0:v]crop={BLUR_W}:{BLUR_H}:0:0,boxblur=luma_radius=
|
| 128 |
f"[0:v][top]overlay=0:0,"
|
| 129 |
f"drawtext=text={TEXT}:x={TEXT_X}:y={TEXT_Y}:fontcolor={FONT_COLOR}:fontsize={FONT_SIZE}[v]"
|
| 130 |
)
|
|
|
|
| 2 |
import tempfile
|
| 3 |
import os
|
| 4 |
import shutil
|
| 5 |
+
#import cv2
|
| 6 |
import subprocess
|
| 7 |
from fastapi import FastAPI, BackgroundTasks
|
| 8 |
from pydantic import BaseModel
|
|
|
|
| 110 |
except Exception as e:
|
| 111 |
log(f"⚠️ Render notify failed: {repr(e)}")
|
| 112 |
|
| 113 |
+
BLUR_W = 74
|
| 114 |
+
BLUR_H = 17
|
| 115 |
TEXT = "nt-animes"
|
| 116 |
FONT_COLOR = "white"
|
| 117 |
FONT_SIZE = 12
|
| 118 |
TEXT_X = 8
|
| 119 |
+
TEXT_Y = 8
|
| 120 |
|
| 121 |
def blur_video(input_path: str) -> str:
|
| 122 |
tmp_video = tempfile.mktemp(suffix="_video.mp4")
|
|
|
|
| 124 |
|
| 125 |
# FFmpeg filtergraph: blur + text overlay
|
| 126 |
filter_graph = (
|
| 127 |
+
f"[0:v]crop={BLUR_W}:{BLUR_H}:0:0,boxblur=luma_radius=4:luma_power=1:chroma_radius=0[top];"
|
| 128 |
f"[0:v][top]overlay=0:0,"
|
| 129 |
f"drawtext=text={TEXT}:x={TEXT_X}:y={TEXT_Y}:fontcolor={FONT_COLOR}:fontsize={FONT_SIZE}[v]"
|
| 130 |
)
|