diff --git a/.travis.yml b/.travis.yml index eb8bf92..d284246 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ sudo: required -dist: trusty +dist: xenial language: python install: - sudo apt-get install graphicsmagick libav-tools -y diff --git a/prosopopee/prosopopee.py b/prosopopee/prosopopee.py index 6499e61..319e868 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.decode("utf-8").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.decode("utf-8").split(',') + return float(width) / int(height) + def __repr__(self): return self.name @@ -521,7 +540,7 @@ def build_gallery(settings, gallery_settings, gallery_path, template): if gallery_settings.get("password") or settings.get("password"): from_template = light_templates.get_template("form.html") html = encrypt(password, light_templates, gallery_light_path, settings, gallery_settings) - + open(Path("build").joinpath(gallery_light_path, "index.html"), "wb").write(html) 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 %}