Resolved code formatting change requests

This commit is contained in:
ReAnzu 2018-03-07 19:07:41 -06:00
parent 2bb7e62837
commit aae955220b

View file

@ -11,10 +11,6 @@ from szurubooru.func import mime, util
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
_SCALE_FIT_FMT = (
r"scale='{width}:{height}'")
class Image: class Image:
def __init__(self, content: bytes) -> None: def __init__(self, content: bytes) -> None:
self.content = content self.content = content
@ -39,7 +35,8 @@ class Image:
cli = [ cli = [
'-i', '{path}', '-i', '{path}',
'-f', 'image2', '-f', 'image2',
'-filter:v', _SCALE_FIT_FMT.format(width=width, height=height), '-filter:v', "scale='{width}:{height}'".format(
width=width, height=height),
'-map', '0:v:0', '-map', '0:v:0',
'-vframes', '1', '-vframes', '1',
'-vcodec', 'png', '-vcodec', 'png',
@ -82,8 +79,11 @@ class Image:
'-', '-',
]) ])
def _execute(self, cli: List[str], program: str = 'ffmpeg', def _execute(
ignore_error_if_data: bool = False) -> bytes: self,
cli: List[str],
program: str = 'ffmpeg',
ignore_error_if_data: bool = False) -> bytes:
extension = mime.get_extension(mime.get_mime_type(self.content)) extension = mime.get_extension(mime.get_mime_type(self.content))
assert extension assert extension
with util.create_temp_file(suffix='.' + extension) as handle: with util.create_temp_file(suffix='.' + extension) as handle: