This commit is contained in:
Titoko 2016-05-21 10:19:43 +02:00
parent bd8705bd65
commit 34507efe01

View File

@ -211,14 +211,14 @@ def init():
if os.system("which " + conv_video + " > /dev/null") != 0: if os.system("which " + conv_video + " > /dev/null") != 0:
if conv_video == "ffmpeg" and os.system("which avconv > /dev/null") == 0: if conv_video == "ffmpeg" and os.system("which avconv > /dev/null") == 0:
SETTINGS["ffmpeg"]["binary"] = "avconv" SETTINGS["ffmpeg"]["binary"] = "avconv"
warning("Video", "I couldn't locate ffmpeg but I could find avconv, switching to avconv for video conversion") warning("Video", "I couldn't locate ffmpeg but I could find avconv, "
"switching to avconv for video conversion")
else: else:
warning("Video", "I can't locate the " + conv_video + " binary, " warning("Video", "I can't locate the " + conv_video + " binary, "
"please install the '" + conv_video + "' package.\n") "please install the '" + conv_video + "' package.\n")
warning("Video", "I won't be able to encode video and I will stop if I encounter a video to convert") warning("Video", "I won't be able to encode video and I will stop if I encounter a video to convert")
SETTINGS["ffmpeg"] = False SETTINGS["ffmpeg"] = False
error(settings.get("title"), "You need to specify a title in your main settings.yaml") error(settings.get("title"), "You need to specify a title in your main settings.yaml")
if (settings["rss"] or settings["share"]) and not settings.get("url"): if (settings["rss"] or settings["share"]) and not settings.get("url"):
@ -294,7 +294,6 @@ def build_gallery(gallery, settings, templates, parent_galleries=False):
build_index(settings, sub_page_galleries_cover, templates, gallery_path) build_index(settings, sub_page_galleries_cover, templates, gallery_path)
return gallery_cover return gallery_cover
# this should probably be a factory # this should probably be a factory
Image.base_dir = os.path.join(os.getcwd(), gallery_path) Image.base_dir = os.path.join(os.getcwd(), gallery_path)
Image.target_dir = os.path.join(os.getcwd(), "build", gallery_path) Image.target_dir = os.path.join(os.getcwd(), "build", gallery_path)
@ -344,7 +343,8 @@ def main():
front_page_galleries_cover = [] front_page_galleries_cover = []
dirs = filter(lambda x: x not in (".", "..") and os.path.isdir(x) and os.path.exists(os.path.join(os.getcwd(), x, "settings.yaml")), os.listdir(os.getcwd())) dirs = filter(lambda x: x not in (".", "..") and os.path.isdir(x) and
os.path.exists(os.path.join(os.getcwd(), x, "settings.yaml")), os.listdir(os.getcwd()))
error(dirs, "I can't find at least one directory with a settings.yaml in the current working " error(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 (NOT the settings.yaml in your current directory, but one INSIDE A "
@ -356,9 +356,10 @@ def main():
theme = settings["settings"].get("theme", "exposure") theme = settings["settings"].get("theme", "exposure")
theme_path = os.path.exists(os.path.join(os.path.split(os.path.realpath(__file__))[0], "themes", theme)) theme_path = os.path.exists(os.path.join(os.path.split(os.path.realpath(__file__))[0], "themes", theme))
available_themes = theme, "', '".join(os.listdir(os.path.join(os.path.split(os.path.realpath(__file__))[0], "themes"))) available_themes = theme, "', '".join(os.listdir(os.path.join(os.path.split(os.path.realpath(__file__))[0],
"themes")))
error(theme_path, "'%s' is not an existing theme, available themes are '%s'" % (available_themes)) error(theme_path, "'%s' is not an existing theme, available themes are '%s'" % available_themes)
templates_dir = [ templates_dir = [
os.path.realpath(os.path.join(os.getcwd(), "templates")), os.path.realpath(os.path.join(os.getcwd(), "templates")),
@ -366,7 +367,8 @@ def main():
] ]
if theme != "exposure": if theme != "exposure":
templates_dir.append(os.path.join(os.path.split(os.path.realpath(__file__))[0], "themes", "exposure", "templates")) templates_dir.append(os.path.join(os.path.split(os.path.realpath(__file__))[0],
"themes", "exposure", "templates"))
templates = Environment(loader=FileSystemLoader(templates_dir)) templates = Environment(loader=FileSystemLoader(templates_dir))
@ -379,7 +381,8 @@ def main():
if os.path.exists(os.path.join(os.getcwd(), "static")): if os.path.exists(os.path.join(os.getcwd(), "static")):
shutil.copytree(os.path.join(os.getcwd(), "static"), os.path.join(os.getcwd(), "build", "static")) shutil.copytree(os.path.join(os.getcwd(), "static"), os.path.join(os.getcwd(), "build", "static"))
else: else:
shutil.copytree(os.path.join(os.path.split(os.path.realpath(__file__))[0], "themes", theme, "static"), os.path.join(os.getcwd(), "build", "static")) shutil.copytree(os.path.join(os.path.split(os.path.realpath(__file__))[0], "themes", theme, "static"),
os.path.join(os.getcwd(), "build", "static"))
for gallery in dirs: for gallery in dirs:
front_page_galleries_cover.append(build_gallery(gallery, settings, templates)) front_page_galleries_cover.append(build_gallery(gallery, settings, templates))