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