lots of updates

This commit is contained in:
Ville Rantanen
2021-08-20 20:53:01 +03:00
parent db1af48957
commit b606b53a48
4 changed files with 72 additions and 38 deletions

View File

@@ -10,7 +10,9 @@ Use pip or similar to install from source.
ex.
`pip3 install --user --upgrade https://bitbucket.org/MoonQ/mirva/get/tip.tar.gz`
`pip3 install --user --upgrade https://bitbucket.org/MoonQ/mirva/get/master.zip`
or `pipx install https://bitbucket.org/MoonQ/mirva/get/master.zip`
## Usage

View File

@@ -30,6 +30,7 @@ class Mirva:
self.create_posts()
self.write_index()
self.write_mediums()
print("Gallery written.")
def create_config(self):
@@ -41,6 +42,7 @@ class Mirva:
"title": "",
"sub_title": "",
"intro": "",
"image_size": 850
}
config_changed = True
@@ -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">&nbsp;</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;">&nbsp;</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",

View File

@@ -109,10 +109,15 @@ a:hover {
/* Page */
#page {
width: 90vw;
width: calc(100vw - 128px);
margin: 0 auto;
padding: 0px 0px 0px 0px;
}
@media only screen and (max-width: 800px) {
#page {
width: 100vw;
}
}
#page-bgtop {
padding: 20px 0px;
@@ -124,14 +129,14 @@ a:hover {
/* Content */
#content {
width: 90vw;
width: 100%;
padding: 30px 0px 0px 0px;
}
.post {
margin-bottom: 15px;
border-top: lightgray dashed;
padding-top: 5px;
border-top: lightgray dashed 2px;
padding-top: 2px;
}
.post-bgtop {
@@ -154,8 +159,7 @@ a:hover {
}
.post .meta {
/* margin-bottom: 30px;*/
padding: 5px 0px 15px 0px;
padding: 5px 0px 5px 0px;
text-align: center;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
@@ -163,6 +167,7 @@ a:hover {
}
.post .meta .name {
display: inline;
}
.post .meta .posted {
@@ -172,8 +177,7 @@ a:hover {
}
.post .entry {
padding: 0px 0px 20px 0px;
padding-bottom: 20px;
padding: 0px 5px 20px 5px;
text-align: justify;
}
@@ -184,15 +188,20 @@ a:hover {
}
.center {
display: block;
display: table;
text-align: center;
width: 100%;
}
.post_image {
max-height: 95vh;
max-width: 90vw;
max-height: calc(100vh - 60px);
max-width: calc(100vw - 128px);
}
@media only screen and (max-width: 800px) {
.post_image {
max-width: 100vw;
}
}
/* Footer */
#footer {
@@ -221,28 +230,28 @@ a:hover {
/* navi */
.navigation {
height: 20px;
margin-bottom: 5px;
height: 27px;
float: right;
}
@media only screen and (max-width: 800px) {
.navigation {
display: none;
}
}
.navigation_button {
cursor: pointer;
margin-left: 10px;
box-shadow: 4px 4px 5px #888888;
}
.navigation_button:hover {
cursor: pointer;
box-shadow: 2px 2px 2px #888888;
}
@media only screen and (max-width: 800px) {
.navigation_button {
margin-top: 20px;
margin-bottom: 20px;
}
}
.float_up {
float: left;
}
.float_down {
float: right;
float: left;
}

View File

@@ -6,12 +6,12 @@ setup(
],
package_data={'':['resources/*']},
include_package_data=True,
version = '20210819',
version = '20210820',
description = 'A tool to create a web gallery from a folder of images.',
author = 'Ville Rantanen',
author_email = 'ville.q.rantanen@gmail.com',
url = 'https://bitbucket.org/MoonQ/mirva',
download_url = 'https://bitbucket.org/MoonQ/mirva/get/tip.tar.gz',
download_url = 'https://bitbucket.org/MoonQ/mirva/get/master.zip',
keywords = ['album', 'generator', 'javascript'],
classifiers = [],
license = 'MIT',