update docs and fix reverse
This commit is contained in:
parent
06e9216972
commit
92b31cda86
@ -5,6 +5,7 @@ Changelog
|
||||
|
||||
* Compatibility python 2 and 3
|
||||
* Possibility to add custom css and js http://prosopopee.readthedocs.io/en/latest/theming.html
|
||||
* Add reverse opion by titoko https://prosopopee.readthedocs.io/en/latest/configuration.html#reverse
|
||||
|
||||
0.5 (2017-06-04)
|
||||
|
||||
|
@ -25,6 +25,7 @@ ____
|
||||
|
||||
It is possible to add a menu to your homepage that links to static pages. To do so, add a `menu` key to your `settings.yaml`, for example::
|
||||
|
||||
title: "About"
|
||||
menu:
|
||||
- about: "About"
|
||||
- first_gallery: "My first gallery"
|
||||
@ -58,13 +59,14 @@ GM
|
||||
|
||||
Currently a `gm` settings key allows to customize the default GraphicsMagick's behavior. It looks like ::
|
||||
|
||||
settings:
|
||||
gm:
|
||||
quality: 75
|
||||
auto-orient: True
|
||||
strip: True
|
||||
resize: 50%
|
||||
progressive: True
|
||||
title: Gallery
|
||||
settings:
|
||||
gm:
|
||||
quality: 75
|
||||
auto-orient: True
|
||||
strip: True
|
||||
resize: 50%
|
||||
progressive: True
|
||||
|
||||
The meaning of the currently supported GraphicsMagick's settings is as follows:
|
||||
|
||||
@ -81,17 +83,18 @@ Video convertor
|
||||
|
||||
Prosopopée can use ffmpeg or libav and if you want you can customize the settings::
|
||||
|
||||
settings:
|
||||
ffmpeg:
|
||||
binary: "ffmpeg",
|
||||
loglevel: "error",
|
||||
format: "webm",
|
||||
resolution: "1280x720",
|
||||
vbitrate: "3900k",
|
||||
abitrate: "100k",
|
||||
audio: "libvorbis",
|
||||
video: "libvpx",
|
||||
other: "-qmin 10 -qmax 42 -maxrate 500k -bufsize 1500k"
|
||||
title: Gallery
|
||||
settings:
|
||||
ffmpeg:
|
||||
binary: "ffmpeg"
|
||||
loglevel: "error"
|
||||
format: "webm"
|
||||
resolution: "1280x720"
|
||||
vbitrate: "3900k"
|
||||
abitrate: "100k"
|
||||
audio: "libvorbis"
|
||||
video: "libvpx"
|
||||
other: "-qmin 10 -qmax 42 -maxrate 500k -bufsize 1500k"
|
||||
|
||||
The meaning of the currently supported FFMEG or LIBAV's settings is as follows :
|
||||
|
||||
@ -103,14 +106,28 @@ The meaning of the currently supported FFMEG or LIBAV's settings is as follows :
|
||||
* `abitrate` Set audio bitrate
|
||||
* `audio` Set the audio codec
|
||||
* `video` Set the video codec
|
||||
* `extension` Set the extension of output file
|
||||
* `other` Set different options if you need more
|
||||
|
||||
example for MP4::
|
||||
|
||||
title: Gallery
|
||||
settings:
|
||||
ffmpeg:
|
||||
binary: "ffmpeg"
|
||||
format: "mp4"
|
||||
audio: "acc"
|
||||
video: "libx264"
|
||||
extension: mp4
|
||||
|
||||
|
||||
|
||||
Light Mode
|
||||
~~~~~~~~~~
|
||||
|
||||
For enabled the light mode::
|
||||
|
||||
title: Gallery
|
||||
settings:
|
||||
light_mode: true
|
||||
|
||||
@ -134,10 +151,10 @@ Prosopopée has a support for various themes. As for now, only 3 themes are avai
|
||||
To specify the theme, add the "theme" key in your "settings" key or your
|
||||
**root** settings.yaml. For example::
|
||||
|
||||
title: My exploration of the outside world
|
||||
sub_title: it's a scary place, don't go there
|
||||
settings:
|
||||
theme: material
|
||||
title: My exploration of the outside world
|
||||
sub_title: it's a scary place, don't go there
|
||||
settings:
|
||||
theme: material
|
||||
|
||||
|
||||
Licence
|
||||
@ -146,9 +163,10 @@ Licence
|
||||
By default Prosopopée use CC-BY-SA for all the content, if you want use a another licence
|
||||
you need add key in **root** settings.yaml. For example::
|
||||
|
||||
licence:
|
||||
name: WTFPL
|
||||
url: "http://www.wtfpl.net/txt/copying/"
|
||||
title: Gallery
|
||||
licence:
|
||||
name: WTFPL
|
||||
url: "http://www.wtfpl.net/txt/copying/"
|
||||
|
||||
Share
|
||||
~~~~~
|
||||
@ -156,16 +174,18 @@ Share
|
||||
If you want enable the share content on social network, add key in **root** settings.yaml. For example:
|
||||
By defaut you can share on facebook, twitter, pinterest, google+::
|
||||
|
||||
share: true
|
||||
url: "http://prosopopee.com"
|
||||
title: Gallery
|
||||
share: true
|
||||
url: "http://prosopopee.com"
|
||||
|
||||
RSS
|
||||
~~~
|
||||
|
||||
For activate the RSS you need add this key in **root** settings.yaml::
|
||||
|
||||
rss: true
|
||||
url: "http://prosopopee.com"
|
||||
title: Gallery
|
||||
rss: true
|
||||
url: "http://prosopopee.com"
|
||||
|
||||
|
||||
Open Graph Meta
|
||||
@ -173,6 +193,8 @@ Open Graph Meta
|
||||
|
||||
For activate the Open Graph Meta you need add this key in **root** settings.yaml::
|
||||
|
||||
title: Sur les chemins
|
||||
settings:
|
||||
og: true
|
||||
|
||||
Optionnal: You need use description and lang key in settings gallery.
|
||||
@ -184,13 +206,27 @@ Deployment
|
||||
|
||||
If you wanna configure the deployement of your website by rsync::
|
||||
|
||||
title: Gallery
|
||||
settings:
|
||||
deploy:
|
||||
ssh: true (optional need for ssh)
|
||||
username: username (optional need for ssh)
|
||||
hostname: server.com (optional need for ssh)
|
||||
dest: /var/www/website/build/
|
||||
others: --delete-afte (optional)
|
||||
|
||||
Reverse
|
||||
~~~~~~~
|
||||
|
||||
Normally Prosopopee build the gallery index in Anti-chronological, if you wanna reverse it::
|
||||
|
||||
settings:
|
||||
deploy:
|
||||
ssh: true (optional need for ssh)
|
||||
username: beudbeud (optional need for ssh)
|
||||
hostname: beudibox.fr (optional need for ssh)
|
||||
dest: /var/www/surleschemins/build/
|
||||
others: --delete-afte (optional)
|
||||
reverse: true
|
||||
|
||||
Is option can be use too in gallery settings if you use multi level gallery::
|
||||
|
||||
title: Multi level gallery
|
||||
reverse: true
|
||||
|
||||
|
||||
Gallery settings.yaml
|
||||
|
@ -267,6 +267,8 @@ class Image(object):
|
||||
def __repr__(self):
|
||||
return self.name
|
||||
|
||||
class TCPServerV4(socketserver.TCPServer):
|
||||
allow_reuse_address = True
|
||||
|
||||
def get_settings():
|
||||
error(Path("settings.yaml").exists(), "I can't find a "
|
||||
@ -476,9 +478,9 @@ def build_gallery(settings, gallery_settings, gallery_path, template):
|
||||
# XXX shouldn't this be a call to build_gallery?
|
||||
# Build light mode gallery
|
||||
if gallery_settings.get("light_mode", False) or (
|
||||
settings["settings"].get("light_mode", False) and
|
||||
gallery_settings.get("light_mode") is None
|
||||
):
|
||||
settings["settings"].get("light_mode", False) and
|
||||
gallery_settings.get("light_mode") is None
|
||||
):
|
||||
|
||||
# Prepare light mode
|
||||
Path("build").joinpath(gallery_path, "light").makedirs_p()
|
||||
@ -512,11 +514,11 @@ def build_gallery(settings, gallery_settings, gallery_path, template):
|
||||
def build_index(settings, galleries_cover, templates, gallery_path='', sub_index=False, gallery_settings={}):
|
||||
index_template = templates.get_template("index.html")
|
||||
|
||||
reverse = gallery_settings.get('reverse', settings.get('reverse', True))
|
||||
reverse = gallery_settings.get('reverse', settings["settings"].get('reverse', False))
|
||||
if reverse:
|
||||
galleries_cover = reversed(sorted([x for x in galleries_cover if x != {}], key=lambda x: x["date"]))
|
||||
else:
|
||||
galleries_cover = sorted([x for x in galleries_cover if x != {}], key=lambda x: x["date"])
|
||||
else:
|
||||
galleries_cover = reversed(sorted([x for x in galleries_cover if x != {}], key=lambda x: x["date"]))
|
||||
|
||||
# this should probably be a factory
|
||||
Image.base_dir = Path(".").joinpath(gallery_path)
|
||||
@ -537,7 +539,7 @@ def build_index(settings, galleries_cover, templates, gallery_path='', sub_index
|
||||
|
||||
|
||||
def main():
|
||||
arguments = docopt(__doc__, version='0.5')
|
||||
arguments = docopt(__doc__, version='0.6')
|
||||
settings = get_settings()
|
||||
|
||||
front_page_galleries_cover = []
|
||||
@ -553,20 +555,18 @@ def main():
|
||||
|
||||
os.chdir('build')
|
||||
handler = http.server.SimpleHTTPRequestHandler
|
||||
httpd = socketserver.TCPServer(("", 9000), handler)
|
||||
|
||||
httpd = TCPServerV4(("", 9000), handler)
|
||||
print('Start server on http://localhost:9000')
|
||||
# gracefully handle interrupt here
|
||||
try:
|
||||
httpd.serve_forever()
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
print('shutdown')
|
||||
httpd.socket.close()
|
||||
print('\nShutdown server')
|
||||
httpd.shutdown()
|
||||
raise
|
||||
|
||||
if arguments['deploy']:
|
||||
error(os.system("which rsync > /dev/null") == 0, "I can't locate the rsync, "
|
||||
"please install the 'rsync' package.\n")
|
||||
"please install the 'rsync' package.\n")
|
||||
error(Path("build").exists(), "Please build the website before launch deployment")
|
||||
|
||||
r_dest = settings["settings"]["deploy"]["dest"]
|
||||
@ -605,7 +605,7 @@ def main():
|
||||
xml = feed_template.render(
|
||||
settings=settings,
|
||||
galleries=reversed(sorted([x for x in front_page_galleries_cover if x != {}], key=lambda x: x["date"]))
|
||||
).encode("Utf-8")
|
||||
).encode("Utf-8")
|
||||
|
||||
open(Path("build").joinpath("feed.xml"), "wb").write(xml)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user