formatted code with black

This commit is contained in:
K4YT3X
2020-12-19 18:11:11 -05:00
parent 09345703e6
commit bfda833bcf
14 changed files with 2117 additions and 1090 deletions

View File

@@ -19,30 +19,37 @@ from avalon_framework import Avalon
class Gifski:
def __init__(self, gifski_settings):
self.gifski_settings = gifski_settings
def make_gif(self, upscaled_frames: pathlib.Path, output_path: pathlib.Path, framerate: float, extracted_frame_format: str, output_width: int, output_height: int) -> subprocess.Popen:
def make_gif(
self,
upscaled_frames: pathlib.Path,
output_path: pathlib.Path,
framerate: float,
extracted_frame_format: str,
output_width: int,
output_height: int,
) -> subprocess.Popen:
execute = [
self.gifski_settings['gifski_path'],
'-o',
self.gifski_settings["gifski_path"],
"-o",
output_path,
'--fps',
"--fps",
int(round(framerate, 0)),
'--width',
"--width",
output_width,
'--height',
output_height
"--height",
output_height,
]
# load configurations from config file
execute.extend(self._load_configuration())
# append frames location
execute.extend([upscaled_frames / f'extracted_*.{extracted_frame_format}'])
execute.extend([upscaled_frames / f"extracted_*.{extracted_frame_format}"])
return(self._execute(execute))
return self._execute(execute)
def _load_configuration(self):
@@ -53,13 +60,13 @@ class Gifski:
value = self.gifski_settings[key]
# null or None means that leave this option out (keep default)
if key == 'gifski_path' or value is None or value is False:
if key == "gifski_path" or value is None or value is False:
continue
else:
if len(key) == 1:
configuration.append(f'-{key}')
configuration.append(f"-{key}")
else:
configuration.append(f'--{key}')
configuration.append(f"--{key}")
# true means key is an option
if value is not True:
@@ -70,6 +77,6 @@ class Gifski:
# turn all list elements into string to avoid errors
execute = [str(e) for e in execute]
Avalon.debug_info(f'Executing: {execute}')
Avalon.debug_info(f"Executing: {execute}")
return subprocess.Popen(execute, stdout=sys.stdout, stderr=sys.stderr)