mirror of
https://github.com/simon987/Simple-Incremental-Search-Tool.git
synced 2025-12-14 07:39:05 +00:00
Audio tags in search page and svg thumbnail generation
This commit is contained in:
13
thumbnail.py
13
thumbnail.py
@@ -1,8 +1,8 @@
|
||||
from PIL import Image
|
||||
import os
|
||||
from parsing import ContentMimeGuesser, ExtensionMimeGuesser
|
||||
from multiprocessing import Value
|
||||
import ffmpeg
|
||||
import cairosvg
|
||||
|
||||
|
||||
class ThumbnailGenerator:
|
||||
@@ -17,7 +17,16 @@ class ThumbnailGenerator:
|
||||
if mime is None:
|
||||
return
|
||||
|
||||
if mime.startswith("image"):
|
||||
if mime == "image/svg+xml":
|
||||
|
||||
try:
|
||||
cairosvg.svg2png(url=path, write_to="tmp")
|
||||
self.generate_image("tmp", dest_path)
|
||||
os.remove("tmp")
|
||||
except Exception:
|
||||
print("Couldn't make thumbnail for " + path)
|
||||
|
||||
elif mime.startswith("image"):
|
||||
|
||||
try:
|
||||
self.generate_image(path, dest_path)
|
||||
|
||||
Reference in New Issue
Block a user