Various build fixes, cleanup and details #6

Merged
leo merged 34 commits from trace into main 2023-11-21 15:32:49 +00:00
Showing only changes of commit 728cd47dca - Show all commits

View File

@ -10,7 +10,6 @@ from wsgiref.handlers import format_date_time
import av
import av.datasets
import fitz # PyMuPDF
from av.streams import SideData
from PIL import Image
from sanic import Blueprint, empty, raw
from sanic.exceptions import NotFound
@ -19,6 +18,8 @@ from sanic.log import logger
from cista import config
from cista.util.filename import sanitize
DISPLAYMATRIX = av.streams.SideData.DISPLAYMATRIX
bp = Blueprint("preview", url_prefix="/preview")
@ -100,7 +101,7 @@ def process_video(path, *, maxsize, quality):
stream = container.streams.video[0]
stream.codec_context.skip_frame = "NONKEY"
stream.codec_context.threads = 1
rot = stream.side_data and stream.side_data.get(SideData.DISPLAYMATRIX) or 0
rot = stream.side_data and stream.side_data.get(DISPLAYMATRIX) or 0
container.seek(container.duration // 8)
img = next(container.decode(stream)).to_image()
del stream