Skip to content

Commit 819ff8d

Browse files
committed
release 1.0.1
1 parent 8727261 commit 819ff8d

File tree

9 files changed

+52
-45
lines changed

9 files changed

+52
-45
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ sections:
7878
7979
## Usage
8080
```bash
81-
prosopopee.py
82-
prosopopee.py test
83-
prosopopee.py preview
84-
prosopopee.py deploy
85-
prosopopee.py autogen (-d <folder> | --all ) [--force]
86-
prosopopee.py (-h | --help)
87-
prosopopee.py --version
81+
prosopopee
82+
prosopopee test
83+
prosopopee preview
84+
prosopopee deploy
85+
prosopopee autogen (-d <folder> | --all ) [--force]
86+
prosopopee (-h | --help)
87+
prosopopee --version
8888

8989
Options:
9090
test Verify all your yaml data

docs/changelog.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
=========
33

4+
1.0.1 (2020-05-08)
5+
6+
* Fix check date format
7+
* Fix error datetime
8+
* lazyload for video
9+
* add controls on fullscreen video
10+
411
1.0.0 the covid release (2020-04-29)
512

613
* Add automatic generation gallery

prosopopee/autogen.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ def get_exif(filename):
5050

5151
def build_template(folder, force):
5252
files_grabbed = []
53-
gallery_settings = load_settings(folder)
53+
try:
54+
gallery_settings = load_settings(folder)
55+
except FileNotFoundError:
56+
error(False, "Can't open %s/settings.yaml" % folder)
5457
if 'static' not in gallery_settings:
5558
if 'title' and 'date' and 'cover' in gallery_settings:
5659
if 'sections' in gallery_settings and force is not True:

prosopopee/prosopopee.py

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
"""Prosopopee. Static site generator for your story.
44
55
Usage:
6-
prosopopee.py
7-
prosopopee.py test
8-
prosopopee.py preview
9-
prosopopee.py deploy
10-
prosopopee.py autogen (-d <folder> | --all ) [--force]
11-
prosopopee.py (-h | --help)
12-
prosopopee.py --version
6+
prosopopee
7+
prosopopee test
8+
prosopopee preview
9+
prosopopee deploy
10+
prosopopee autogen (-d <folder> | --all ) [--force]
11+
prosopopee (-h | --help)
12+
prosopopee --version
1313
1414
Options:
1515
test Verify all your yaml data
@@ -36,7 +36,6 @@
3636
from .utils import error, warning, okgreen, encrypt, rfc822, load_settings
3737
from .autogen import autogen
3838

39-
import datetime
4039

4140
DEFAULTS = {
4241
"rss": True,
@@ -121,12 +120,10 @@ def ffmpeg(self, source, target, options):
121120

122121
if options.get("resize"):
123122
command = "{binary} {loglevel} -i {source} {resize} -vframes 1 -y {target}".format(**ffmpeg_switches)
124-
print(command)
125-
error(os.system(command) == 0, "%s command failed" % ffmpeg_switches["binary"])
126123
else:
127124
command = "{binary} {loglevel} -i {source} {video} {vbitrate} {other} {audio} {abitrate} {resolution} {format} -y {target}".format(**ffmpeg_switches)
128-
print(command)
129-
error(os.system(command) == 0, "%s command failed" % ffmpeg_switches["binary"])
125+
print(command)
126+
error(os.system(command) == 0, "%s command failed" % ffmpeg_switches["binary"])
130127

131128
CACHE.cache_picture(source, target, options)
132129

@@ -392,12 +389,6 @@ def process_directory(gallery_name, settings, parent_templates, parent_gallery_p
392389
gallery_path = gallery_name
393390

394391
gallery_settings = load_settings(gallery_path)
395-
if gallery_settings.get("date"):
396-
try:
397-
datetime.datetime.strptime(str(gallery_settings.get("date")), '%Y-%m-%d')
398-
except ValueError:
399-
error(False, "Incorrect data format, should be YYYY-MM-DD in %s/settings.yaml" % (gallery_path))
400-
401392
error(isinstance(gallery_settings, dict), "Your %s should be a dict" % gallery_name.joinpath("settings.yaml"))
402393
error(gallery_settings.get("title"), "You should specify a title in %s" % gallery_name.joinpath("settings.yaml"))
403394

@@ -453,7 +444,7 @@ def create_cover(gallery_name, gallery_settings, gallery_path):
453444
cover_image_type = "image"
454445

455446
error(cover_image_path.exists(), "File for %s cover image doesn't exist at "
456-
"%s" % (gallery_name, cover_image_path))
447+
"%s" % (gallery_name, cover_image_path))
457448

458449
gallery_cover = {
459450
"title": gallery_settings["title"],
@@ -509,8 +500,7 @@ def build_gallery(settings, gallery_settings, gallery_path, template):
509500
# Build light mode gallery
510501
if gallery_settings.get("light_mode", False) or (
511502
settings["settings"].get("light_mode", False) and
512-
gallery_settings.get("light_mode") is None
513-
):
503+
gallery_settings.get("light_mode") is None):
514504

515505
# Prepare light mode
516506
Path("build").joinpath(gallery_path, "light").makedirs_p()
@@ -581,7 +571,7 @@ def build_index(settings, galleries_cover, templates, gallery_path='', sub_index
581571

582572

583573
def main():
584-
arguments = docopt(__doc__, version='1.0.0')
574+
arguments = docopt(__doc__, version='1.0.1')
585575
settings = get_settings()
586576

587577
front_page_galleries_cover = []
@@ -610,7 +600,7 @@ def main():
610600

611601
if arguments['deploy']:
612602
error(os.system("which rsync > /dev/null") == 0, "I can't locate the rsync, "
613-
"please install the 'rsync' package.\n")
603+
"please install the 'rsync' package.\n")
614604
error(Path("build").exists(), "Please build the website before launch deployment")
615605

616606
r_dest = settings["settings"]["deploy"]["dest"]

prosopopee/themes/exposure/templates/gallery-index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@
103103

104104
function goFullscreen(id) {
105105
var element = document.getElementById(id);
106+
element.setAttribute("controls", true);
107+
106108
if (element.requestFullscreen) {
107109
element.requestFullscreen();
108110
} else if (element.mozRequestFullScreen) {

prosopopee/themes/exposure/templates/sections/bordered-picture.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
{{ video.copy() }}
99
<section class="bordered-picture baguette" style="position: relative;">
1010
<div class="caption">
11-
<img class="lazy" data-src="{{ video.generate_thumbnail("2000") }}" src="./../static/img/11-14.svg" alt="">
12-
<video class="lazy" id="{{ video }}" onclick="goFullscreen('{{ video }}');" data-poster="{{ video.generate_thumbnail("2000") }}" alt="" autoplay="autoplay" loop="loop" preload="none" muted {% if section.image.controls %}controls="true"{% endif %}>
11+
<img class="lazy" data-src="{{ video.generate_thumbnail("2000") }}" src="./../static/img/11-14.svg" alt="">
12+
<video class="lazy" id="{{ video }}.{{ format }}" onclick="goFullscreen('{{ video }}.{{ format }}');" data-src="{{ video }}.{{ format }}" data-poster="{{ video.generate_thumbnail("2000") }}" alt="" loop="loop" preload="none" autoplay muted {% if video.controls %}controls="true"{% endif %}>
1313
<source src="{{ video }}.{{ format }}" type="video/{{ format }}">
1414
</video>
1515
{% if caption %}

prosopopee/themes/exposure/templates/sections/pictures-group.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
{% else %}
2424
<img class="lazy" data-src="{{ video.generate_thumbnail("600") }}" src="./../static/img/11-14.svg" alt="">
2525
{% endif %}
26-
<video class="lazy" id="{{ video }}" onclick="goFullscreen('{{ video }}');" data-poster="{{ video.generate_thumbnail("600") }}" alt="" loop="loop" preload="none" autoplay muted {% if image.controls %}controls="true"{% endif %}>
27-
<source src="{{ video }}.{{ format }}" type="video/{{ format }}">
26+
<video class="lazy" id="{{ video }}.{{ format }}" onclick="goFullscreen('{{ video }}.{{ format }}');" data-src="{{ video }}.{{ format }}" data-poster="{{ video.generate_thumbnail("600") }}" alt="" loop="loop" preload="none" autoplay muted {% if image.controls %}controls="true"{% endif %}>
27+
<source data-src="{{ video }}.{{ format }}" type="video/{{ format }}">
2828
</video>
2929
{% if caption %}
3030
<div class="caption__overlay">

prosopopee/utils.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
import base64
33

44
from subprocess import check_output
5-
65
from path import Path
7-
8-
from jinja2 import Environment, FileSystemLoader
9-
106
from email.utils import formatdate
11-
from datetime import datetime
12-
137
from builtins import str
14-
158
import ruamel.yaml as yaml
9+
from datetime import datetime
1610

1711
class bcolors:
1812
OKGREEN = '\033[92m'
@@ -39,11 +33,13 @@ def okgreen(logging, ok_message):
3933
sys.stderr.write("%s%s: %s%s" % (bcolors.OKGREEN, logging, bcolors.ENDC, ok_message))
4034
sys.stderr.write("\n")
4135

36+
4237
def makeform(template, settings, gallery_settings):
4338
from_template = template.get_template("form.html")
4439
form = base64.b64encode(from_template.render(settings=settings, gallery=gallery_settings).encode("Utf-8"))
4540
return str(form, 'utf-8')
4641

42+
4743
def encrypt(password, template, gallery_path, settings, gallery_settings):
4844
encrypted_template = template.get_template("encrypted.html")
4945
index_plain = Path("build").joinpath(gallery_path, "index.html")
@@ -56,20 +52,29 @@ def encrypt(password, template, gallery_path, settings, gallery_settings):
5652
).encode("Utf-8")
5753
return html
5854

55+
5956
def rfc822(dt):
6057
epoch = datetime.utcfromtimestamp(0).date()
6158
return formatdate((dt - epoch).total_seconds())
6259

60+
6361
def load_settings(folder):
6462
try:
6563
gallery_settings = yaml.safe_load(open(Path(".").joinpath(folder, "settings.yaml").abspath(), "r"))
6664
except yaml.YAMLError as exc:
6765
if hasattr(exc, 'problem_mark'):
6866
mark = exc.problem_mark
69-
error(False, "There are something wrong in %s/settings.yaml line %s" % (folder ,mark.line))
67+
error(False, "There are something wrong in %s/settings.yaml line %s" % (folder, mark.line))
7068
else:
71-
error(False, "There are something wrong in %s/settings.yaml" % folder)
69+
error(False, "There are something wrong in %s/settings.yaml" % folder)
70+
except ValueError:
71+
error(False, "Incorrect data format, should be YYYY-MM-DD in %s/settings.yaml" % folder)
7272
if gallery_settings is None:
7373
error(False, "The %s/settings.yaml file is empty" % folder)
7474
else:
75+
if gallery_settings.get("date"):
76+
try:
77+
datetime.strptime(str(gallery_settings.get("date")), '%Y-%m-%d')
78+
except ValueError:
79+
error(False, "Incorrect data format, should be YYYY-MM-DD in %s/settings.yaml" % folder)
7580
return gallery_settings

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
long_description = fh.read()
88

99
setup(name='prosopopee',
10-
version='1.0.0',
10+
version='1.0.1',
1111
description='A static website generator that allows you to tell a story with your pictures',
1212
author='Laurent Peuch',
1313
long_description=long_description,

0 commit comments

Comments
 (0)