Fix warnings from Ruff and ffmpeg

This commit is contained in:
2025-02-10 20:41:14 +01:00
parent 1ad53240a1
commit 870187e1e4
8 changed files with 100 additions and 1191 deletions

View File

@ -11,8 +11,7 @@ def test_generate_html_for_videos() -> None:
domain: str = os.environ["SERVE_DOMAIN"]
# Remove trailing slash from domain
if domain.endswith("/"):
domain = domain[:-1]
domain = domain.removesuffix("/")
# Delete the old HTML file if it exists
if Path.exists(Path("Uploads/test_video.mp4.html")):

View File

@ -1,6 +1,5 @@
from __future__ import annotations
import imghdr
import os
from pathlib import Path
@ -24,13 +23,11 @@ def test_make_thumbnail() -> None:
domain: str = domain[:-1]
# Remove thumbnail if it exists
if Path.exists(Path(f"{settings.upload_folder}/test.mp4.jpg")):
Path.unlink(Path(f"{settings.upload_folder}/test.mp4.jpg"))
thumbnail_path = Path(f"{settings.upload_folder}/test.mp4.jpg")
if thumbnail_path.exists():
thumbnail_path.unlink()
thumbnail: str = make_thumbnail(TEST_FILE, "test.mp4")
# Check if thumbnail is a jpeg.
assert imghdr.what(f"{settings.upload_folder}/test.mp4.jpg") == "jpeg"
# Check if it returns the correct URL.
assert thumbnail == f"{domain}/test.mp4.jpg"