diff --git a/README.md b/README.md index 7e1a67a..91157a1 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/mirva/mirva.py b/mirva/mirva.py index fc0344b..7c4db91 100755 --- a/mirva/mirva.py +++ b/mirva/mirva.py @@ -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 """
- +
-

{title}

+
{title}
 
{content}
""".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", diff --git a/mirva/resources/style.css b/mirva/resources/style.css index 36aa6aa..2a2ad29 100644 --- a/mirva/resources/style.css +++ b/mirva/resources/style.css @@ -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; } diff --git a/setup.py b/setup.py index bf05e69..20ed7d5 100644 --- a/setup.py +++ b/setup.py @@ -1,18 +1,18 @@ from distutils.core import setup setup( name = 'mirva', - packages = ['mirva'], + packages = ['mirva'], scripts = ['scripts/mirva', ], 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', - keywords = ['album', 'generator', 'javascript'], + download_url = 'https://bitbucket.org/MoonQ/mirva/get/master.zip', + keywords = ['album', 'generator', 'javascript'], classifiers = [], license = 'MIT', )