From 1f4a864d594863cf16997c9e89d88db8062bd848 Mon Sep 17 00:00:00 2001 From: Peter Molnar Date: Wed, 10 Apr 2019 09:27:37 +0100 Subject: [PATCH] - url / error cleanup in Home - 'noping' setting to create ping files, but don't actually send webmentions - watermark size back to older setting - changed sharpend in unsharp mask settings - added is_photos setting which applies if all images are photos --- nasg.py | 25 ++++++++++++++------- settings.py | 3 ++- templates/Home.j2.html | 2 +- templates/base.j2.html | 17 ++------------ templates/bye.txt | 20 +++++++++++++++++ templates/style.css | 37 +++++++++++++++++-------------- templates/themeswitcher.js | 45 ++++++++++++++++++++++++++++---------- 7 files changed, 97 insertions(+), 52 deletions(-) create mode 100644 templates/bye.txt diff --git a/nasg.py b/nasg.py index fa545a6..daaff3b 100644 --- a/nasg.py +++ b/nasg.py @@ -244,6 +244,10 @@ class Webmention(object): async def send(self): if self.exists: return + elif settings.args.get('noping'): + self.save("noping entry at %" %(arrow.now())) + return + telegraph_url = 'https://telegraph.p3k.io/webmention' telegraph_params = { 'token': '%s' % (keys.telegraph.get('token')), @@ -1233,7 +1237,7 @@ class WebImage(object): else: exif[ekey] = maybe break - return exif + return struct(exif) def _maybe_watermark(self, img): if not self.is_photo: @@ -1244,14 +1248,12 @@ class WebImage(object): return img with wand.image.Image(filename=wmarkfile) as wmark: + w = self.height * 0.2 + h = wmark.height * (w / wmark.width) if self.width > self.height: - w = self.width * 0.3 - h = wmark.height * (w / wmark.width) x = self.width - w - (self.width * 0.01) y = self.height - h - (self.height * 0.01) else: - w = self.height * 0.24 - h = wmark.height * (w / wmark.width) x = self.width - h - (self.width * 0.01) y = self.height - w - (self.height * 0.01) @@ -1396,9 +1398,9 @@ class WebImage(object): thumb.compression_quality = 88 thumb.unsharp_mask( radius=1, - sigma=0.5, - amount=0.7, - threshold=0.5 + sigma=1, + amount=0.5, + threshold=0.1 ) thumb.format = 'pjpeg' @@ -1650,6 +1652,13 @@ class Category(dict): def sortedkeys(self): return list(sorted(self.keys(), reverse=True)) + @property + def is_photos(self): + r = True + for i in self.values(): + r = r & i.is_photo + return r + @property def is_paginated(self): if self.name in settings.flat: diff --git a/settings.py b/settings.py index 4811e58..9dc2175 100644 --- a/settings.py +++ b/settings.py @@ -182,7 +182,8 @@ _booleanparams = { 'force': 'force rendering HTML', 'nosync': 'skip sync to live server', 'debug': 'set logging to debug level', - 'quiet': 'show only errors' + 'quiet': 'show only errors', + 'noping': 'don\'t send webmentions but save a dummy that it was done' } for k, v in _booleanparams.items(): diff --git a/templates/Home.j2.html b/templates/Home.j2.html index f133c75..971732a 100644 --- a/templates/Home.j2.html +++ b/templates/Home.j2.html @@ -24,7 +24,7 @@ {% for category, post in posts %}

in: - + {{ category.name }} diff --git a/templates/base.j2.html b/templates/base.j2.html index 7cf19c6..f0fc7b3 100644 --- a/templates/base.j2.html +++ b/templates/base.j2.html @@ -50,23 +50,10 @@ -
- +
{% for action in site.potentialAction %} {% if 'SearchAction' == action['@type'] %} -
+