diff --git a/prosopopee/prosopopee.py b/prosopopee/prosopopee.py index 6499e61..93899be 100644 --- a/prosopopee/prosopopee.py +++ b/prosopopee/prosopopee.py @@ -16,6 +16,7 @@ Options: import os import shutil import socketserver +import subprocess import http.server import ruamel.yaml as yaml @@ -139,6 +140,17 @@ class Video(object): return thumbnail_name + @property + def ratio(self): + if self.options["binary"] == "ffmpeg": + binary = "ffprobe" + else: + binary = "avprobe" + command = binary + " -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 " + self.base_dir.joinpath(self.name) + out = subprocess.check_output(command.split()) + width,height = out.split(',') + return float(width) / int(height) + def __repr__(self): return self.name @@ -266,6 +278,13 @@ class Image(object): return thumbnail_name + @property + def ratio(self): + command = "gm identify -format %w,%h " + self.base_dir.joinpath(self.name) + out = subprocess.check_output(command.split()) + width,height = out.split(',') + return float(width) / int(height) + def __repr__(self): return self.name diff --git a/prosopopee/themes/exposure/templates/sections/pictures-group.html b/prosopopee/themes/exposure/templates/sections/pictures-group.html index 3fb624b..2b22b65 100644 --- a/prosopopee/themes/exposure/templates/sections/pictures-group.html +++ b/prosopopee/themes/exposure/templates/sections/pictures-group.html @@ -5,12 +5,19 @@ {% for line in section.images %}