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'] %} -
+