mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
server/images: restore ffmepg swf handling
This commit is contained in:
@ -33,9 +33,6 @@ class Image:
|
||||
def __init__(self, content: bytes) -> None:
|
||||
self.content = content
|
||||
self._reload_info()
|
||||
if self.info["format"]["format_name"] == "swf":
|
||||
self.content = self.swf_to_png()
|
||||
self._reload_info()
|
||||
|
||||
@property
|
||||
def width(self) -> int:
|
||||
@ -72,7 +69,11 @@ class Image:
|
||||
"png",
|
||||
"-",
|
||||
]
|
||||
if seek and "duration" in self.info["format"]:
|
||||
if (
|
||||
seek
|
||||
and "duration" in self.info["format"]
|
||||
and self.info["format"]["format_name"] != "swf"
|
||||
):
|
||||
duration = float(self.info["format"]["duration"])
|
||||
if duration > 3:
|
||||
cli = [
|
||||
@ -85,19 +86,6 @@ class Image:
|
||||
self.content = content
|
||||
self._reload_info()
|
||||
|
||||
def swf_to_png(self) -> bytes:
|
||||
return self._execute(
|
||||
[
|
||||
"--silent",
|
||||
"-g",
|
||||
"gl",
|
||||
"--",
|
||||
"{path}",
|
||||
"-",
|
||||
],
|
||||
program="exporter",
|
||||
)
|
||||
|
||||
def to_png(self) -> bytes:
|
||||
return self._execute(
|
||||
[
|
||||
@ -329,7 +317,7 @@ class Image:
|
||||
)
|
||||
assert "format" in self.info
|
||||
assert "streams" in self.info
|
||||
if len(self.info["streams"]) < 1 and self.info["format"]["format_name"] != "swf":
|
||||
if len(self.info["streams"]) < 1:
|
||||
logger.warning("The video contains no video streams.")
|
||||
raise errors.ProcessingError(
|
||||
"The video contains no video streams."
|
||||
|
Reference in New Issue
Block a user