diff --git a/prosopopee/prosopopee.py b/prosopopee/prosopopee.py index f8f5d0a..ed84cf7 100644 --- a/prosopopee/prosopopee.py +++ b/prosopopee/prosopopee.py @@ -36,13 +36,14 @@ SETTINGS = { "abitrate": "100k", "audio": "libvorbis", "video": "libvpx", - "other": "-qmin 10 -qmax 42 -maxrate 500k -bufsize 1500k" + "other": "-qmin 10 -qmax 42 -maxrate 500k -bufsize 1500k", + "extension": "webm" }, "ffmpeg_audio": { "binary": "ffmpeg", "loglevel": "error", - "format": "mp3", - "audio": "libmp3lame" + "audio": "libmp3lame", + "extension": "mp3" } } @@ -66,6 +67,10 @@ class Video(object): return self.options["name"] def ffmpeg(self, source, target, options): + if options.get("resize"): + target = target + else: + target = target + "." + options["extension"] if not CACHE.needs_to_be_generated(source, target, options): okgreen("Skipped", source + " is already generated") return @@ -95,6 +100,8 @@ class Video(object): command = "{binary} {loglevel} -i {source} {video} {vbitrate} {other} {audio} {abitrate} {resolution} {format} -y {target}".format(**ffmpeg_switches) print(command) error(os.system(command) == 0, "%s command failed" % ffmpeg_switches["binary"]) + target = target + "." + options["extension"] + print target CACHE.cache_picture(source, target, options) @@ -139,6 +146,7 @@ class Audio(object): return self.options["name"] def ffmpeg(self, source, target, options): + target = target + "." + options["extension"] if not CACHE.needs_to_be_generated(source, target, options): okgreen("Skipped", source + " is already generated") return @@ -148,11 +156,11 @@ class Audio(object): "target": target, "binary": "%s" % options["binary"], "loglevel": "-loglevel %s" % options["loglevel"], - "audio": "-c:a %s" % options["audio"], + "audio": "-c:a %s" % options["audio"] } warning("Generation", source) - + command = "{binary} {loglevel} -i {source} {audio} -y {target}".format(**ffmpeg_switches) print(command) error(os.system(command) == 0, "%s command failed" % ffmpeg_switches["binary"]) @@ -257,6 +265,10 @@ def get_settings(): if key not in settings: settings[key] = value + for key, value in SETTINGS.items(): + if key not in settings: + settings[key] = value + if settings["settings"].get("ffmpeg"): SETTINGS["ffmpeg"].update(settings["settings"]["ffmpeg"]) diff --git a/prosopopee/themes/exposure/templates/gallery-index.html b/prosopopee/themes/exposure/templates/gallery-index.html index 2a4d18f..ae75a7d 100644 --- a/prosopopee/themes/exposure/templates/gallery-index.html +++ b/prosopopee/themes/exposure/templates/gallery-index.html @@ -67,7 +67,7 @@ $('audio').mediaelementplayer({ AndroidUseNativeControls: true }); -var video = $("video.lazy"); +var video = $("video"); video.on('click', function(e){ var vid = video[0]; vid.play(); @@ -82,12 +82,15 @@ video.on('click', function(e){ $(function() { $("img.lazy").lazyload({ + threshold : 400, effect : "fadeIn" }); $("video.lazy").lazyload({ + threshold : 400, effect : "fadeIn" }); $("section.lazy").lazyload({ + threshold : 400, effect : "fadeIn" }); }); @@ -122,7 +125,7 @@ var slowLoad = window.setTimeout( function() { div.appendChild(dismiss_container); html_node.appendChild(div); -}, 1000 ); +}, 10000 ); window.addEventListener( 'load', function() { try { diff --git a/prosopopee/themes/exposure/templates/sections/audio.html b/prosopopee/themes/exposure/templates/sections/audio.html index 42472cb..cf99913 100644 --- a/prosopopee/themes/exposure/templates/sections/audio.html +++ b/prosopopee/themes/exposure/templates/sections/audio.html @@ -1,8 +1,14 @@ {% set audio = Audio(section.image) %} +{% set extension = settings.ffmpeg_audio.extension %} +{% if extension == "mp3" %} +{% set format = "mpeg" %} +{% else %} +{% set format = extension %} +{% endif %} {{ audio.copy() }}

{% if section.title %}{{ section.title }}{% else %}{{ audio }}{% endif %}

-
diff --git a/prosopopee/themes/exposure/templates/sections/bordered-picture.html b/prosopopee/themes/exposure/templates/sections/bordered-picture.html index 2db4a2b..7f7e446 100644 --- a/prosopopee/themes/exposure/templates/sections/bordered-picture.html +++ b/prosopopee/themes/exposure/templates/sections/bordered-picture.html @@ -3,13 +3,14 @@ {% endif %} {% if section.image.type == "video" %} {% set video = Video(section.image) %} + {% set format = settings.ffmpeg.extension %} {% set caption = section.text %} {{ video.copy() }}
{% if caption %}
diff --git a/prosopopee/themes/exposure/templates/sections/full-picture.html b/prosopopee/themes/exposure/templates/sections/full-picture.html index 7b88dc8..d0a96c9 100644 --- a/prosopopee/themes/exposure/templates/sections/full-picture.html +++ b/prosopopee/themes/exposure/templates/sections/full-picture.html @@ -1,4 +1,5 @@ {% if section.image.type == "video" %} +{% set format = settings.ffmpeg.extension %} {% set video = Video(section.image) %} {{ video.copy() }}
@@ -18,7 +19,7 @@
{% endif %}
diff --git a/prosopopee/themes/exposure/templates/sections/pictures-group.html b/prosopopee/themes/exposure/templates/sections/pictures-group.html index 13843ab..1a0fa42 100644 --- a/prosopopee/themes/exposure/templates/sections/pictures-group.html +++ b/prosopopee/themes/exposure/templates/sections/pictures-group.html @@ -9,10 +9,11 @@ {% if image.type == "video" %} {% set caption = image.text %} {% set video = Video(image) %} + {% set format = settings.ffmpeg.extension %} {{ video.copy() }} {% if caption %}
diff --git a/prosopopee/themes/light/templates/sections/audio.html b/prosopopee/themes/light/templates/sections/audio.html index 46a79e3..3d5e200 100644 --- a/prosopopee/themes/light/templates/sections/audio.html +++ b/prosopopee/themes/light/templates/sections/audio.html @@ -1,3 +1,9 @@ +{% set extension = settings.ffmpeg_audio.extension %} +{% if extension == "mp3" %} +{% set format = "mpeg" %} +{% else %} +{% set format = extension %} +{% endif %} {% if settings.settings.light_mode %} {% set pathstatic = ".." %} {% else %} @@ -6,6 +12,6 @@ {% endif %} {% set audio = Audio(section.image) %}

{% if section.title %}{{ section.title }}{% else %}{{ audio }}{% endif %}

-