lots of updates
This commit is contained in:
@@ -30,9 +30,10 @@ class Mirva:
|
||||
self.create_posts()
|
||||
self.write_index()
|
||||
self.write_mediums()
|
||||
print("Gallery written.")
|
||||
|
||||
def create_config(self):
|
||||
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read(self.config_file)
|
||||
config_changed = False
|
||||
@@ -41,13 +42,14 @@ class Mirva:
|
||||
"title": "",
|
||||
"sub_title": "",
|
||||
"intro": "",
|
||||
"image_size": 850
|
||||
}
|
||||
config_changed = True
|
||||
config_changed = True
|
||||
|
||||
for f in self.file_list:
|
||||
if not f in config:
|
||||
config[f] = {"title": f, "description": ""}
|
||||
config_changed = True
|
||||
config_changed = True
|
||||
|
||||
if config_changed:
|
||||
print("Modified config: {}".format(os.path.join(self.options.folder,self.config_file)))
|
||||
@@ -86,6 +88,10 @@ class Mirva:
|
||||
"--config", default=False, action="store_true", help="Write config and exit"
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--force", default=False, action="store_true", help="Force regeneration of middle sized images"
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"folder",
|
||||
type=str,
|
||||
@@ -193,9 +199,9 @@ function create_button(direction, to) {{
|
||||
|
||||
return """
|
||||
<div class="post">
|
||||
<div class="navigation"></div>
|
||||
<div class="navigation"> </div>
|
||||
<div class=center><a href="{image}"><img class=post_image src=".med/{image}.jpg"></a></div>
|
||||
<p class="meta"><span class="name">{title}</span></p>
|
||||
<div class="meta"><div class="name">{title}</div></div>
|
||||
<div style="clear: both;"> </div>
|
||||
<div class="entry">{content}</div>
|
||||
</div>""".format(
|
||||
@@ -235,14 +241,31 @@ function create_button(direction, to) {{
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# TODO: config image res
|
||||
# TODO opts: force recreation
|
||||
r = 850
|
||||
force = False
|
||||
r = self.config["SITE"].get("image_size", 850)
|
||||
link = str(r).lower() == "link"
|
||||
if link:
|
||||
r = 0
|
||||
|
||||
|
||||
force = self.options.force
|
||||
for f in self.file_list:
|
||||
res = "{:d}x{:d}>".format(r, r)
|
||||
res = "{:d}x{:d}>".format(int(r), int(r))
|
||||
outfile = os.path.join(".med", "{}.jpg".format(f))
|
||||
if not os.path.exists(outfile) or force:
|
||||
if force:
|
||||
try:
|
||||
os.remove(outfile)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
if not os.path.exists(outfile):
|
||||
if link:
|
||||
|
||||
os.symlink(
|
||||
"../{}".format(f),
|
||||
outfile
|
||||
)
|
||||
continue
|
||||
|
||||
convargs = [
|
||||
"convert",
|
||||
"-define",
|
||||
|
||||
Reference in New Issue
Block a user