Add a test command to build html without generating media files
This commit is contained in:
parent
def75d1fa5
commit
0854f36c62
@ -3,6 +3,7 @@
|
||||
"""Prosopopee. Static site generator for your story.
|
||||
Usage:
|
||||
prosopopee.py
|
||||
prosopopee.py test
|
||||
prosopopee.py preview
|
||||
prosopopee.py deploy
|
||||
prosopopee.py (-h | --help)
|
||||
@ -33,6 +34,7 @@ DEFAULTS = {
|
||||
"share": False,
|
||||
"settings": {},
|
||||
"show_date": True,
|
||||
"test": False,
|
||||
}
|
||||
|
||||
SETTINGS = {
|
||||
@ -119,6 +121,7 @@ class Video(object):
|
||||
CACHE.cache_picture(source, target, options)
|
||||
|
||||
def copy(self):
|
||||
if not DEFAULTS['test']:
|
||||
source, target = self.base_dir.joinpath(self.name), self.target_dir.joinpath(self.name)
|
||||
options = self.options.copy()
|
||||
self.ffmpeg(source, target, options)
|
||||
@ -126,7 +129,7 @@ class Video(object):
|
||||
|
||||
def generate_thumbnail(self, gm_geometry):
|
||||
thumbnail_name = ".".join(self.name.split(".")[:-1]) + "-%s.jpg" % gm_geometry
|
||||
|
||||
if not DEFAULTS['test']:
|
||||
source, target = self.base_dir.joinpath(self.name), self.target_dir.joinpath(thumbnail_name)
|
||||
|
||||
options = self.options.copy()
|
||||
@ -181,6 +184,7 @@ class Audio(object):
|
||||
CACHE.cache_picture(source, target, options)
|
||||
|
||||
def copy(self):
|
||||
if not DEFAULTS['test']:
|
||||
source, target = self.base_dir.joinpath(self.name), self.target_dir.joinpath(self.name)
|
||||
options = self.options.copy()
|
||||
self.ffmpeg(source, target, options)
|
||||
@ -220,7 +224,7 @@ class Image(object):
|
||||
"resize": "-resize %s" % options["resize"] if options.get("resize", None) is not None else "",
|
||||
"progressive": "-interlace Line" if options.get("progressive", None) is True else ""
|
||||
}
|
||||
|
||||
if not DEFAULTS['test']:
|
||||
command = "gm convert '{source}' {auto-orient} {strip} {progressive} {quality} {resize} '{target}'".format(**gm_switches)
|
||||
warning("Generation", source)
|
||||
|
||||
@ -236,7 +240,7 @@ class Image(object):
|
||||
# if os.path.exists(target) and os.path.getsize(source) == os.path.getsize(target):
|
||||
# print "Skipped %s since the file hasn't been modified based on file size" % source
|
||||
# return ""
|
||||
|
||||
if not DEFAULTS['test']:
|
||||
options = self.options.copy()
|
||||
|
||||
if not options["auto-orient"] and not options["strip"]:
|
||||
@ -252,7 +256,7 @@ class Image(object):
|
||||
|
||||
def generate_thumbnail(self, gm_geometry):
|
||||
thumbnail_name = ".".join(self.name.split(".")[:-1]) + "-" + gm_geometry + "." + self.name.split(".")[-1]
|
||||
|
||||
if not DEFAULTS['test']:
|
||||
source, target = self.base_dir.joinpath(self.name), self.target_dir.joinpath(thumbnail_name)
|
||||
|
||||
options = self.options.copy()
|
||||
@ -565,6 +569,8 @@ def main():
|
||||
error(galleries_dirs, "I can't find at least one directory with a settings.yaml in the current working "
|
||||
"directory (NOT the settings.yaml in your current directory, but one INSIDE A "
|
||||
"DIRECTORY in your current working directory), you don't have any gallery?")
|
||||
if arguments['test']:
|
||||
DEFAULTS['test'] = True
|
||||
|
||||
if arguments['preview']:
|
||||
error(Path("build").exists(), "Please build the website before launch preview")
|
||||
|
Loading…
x
Reference in New Issue
Block a user