diff --git a/cista/preview.py b/cista/preview.py index bf9eb2d..2b20a97 100644 --- a/cista/preview.py +++ b/cista/preview.py @@ -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