diff --git a/nasg.py b/nasg.py index 79600e6..c7e2443 100644 --- a/nasg.py +++ b/nasg.py @@ -564,6 +564,13 @@ class Singular(object): def shortslug(self): return shared.baseN(self.pubtime) + @property + def syndicate(self): + urls = [] + if self.photo and self.photo.is_photo: + urls.append("https://brid.gy/publish/flickr") + return urls + @property def tmplvars(self): # very simple caching because we might use this 4 times: @@ -585,6 +592,7 @@ class Singular(object): 'summary': self.summary, 'replies': self.replies, 'reactions': self.reactions, + 'syndicate': self.syndicate } return self._tmplvars @@ -605,7 +613,8 @@ class Singular(object): with open(o, 'wt') as out: logging.debug('writing file %s' % (o)) out.write(r) - os.utime(o, (self.mtime, self.mtime)) + # use the comment time, not the source file time for this + os.utime(o, (self.stime, self.stime)) def __repr__(self): return "%s/%s" % (self.category, self.fname) @@ -894,10 +903,10 @@ class WebImage(object): if self.meta.get('FileType', 'jpeg').lower() == 'jpeg': thumb.compression_quality = 94 thumb.unsharp_mask( - radius=2, + radius=1, sigma=0.5, amount=0.7, - threshold=0 + threshold=0.5 ) thumb.format = 'pjpeg' @@ -1291,7 +1300,7 @@ def build(): task = loop.create_task(magic.render()) tasks.append(task) - # TODO: send webmentions to any url + # TODO: send webmentions # do all the things! w = asyncio.wait(tasks) diff --git a/shared.py b/shared.py index 8b116ba..6960c13 100644 --- a/shared.py +++ b/shared.py @@ -318,12 +318,22 @@ class TokenDB(object): class SearchDB(object): tmplfile = 'Search.html' + #snowball = '/usr/local/lib/fts5stemmer.so' def __init__(self): self.db = sqlite3.connect( "%s" % config.get('var', 'searchdb') ) + #if os.path.exists(self.snowball): + #self.db.enable_load_extension(True) + #self.db.execute(" load_extension('%s');" % self.snowball) + #self.db.enable_load_extension(False) + + + self.db.execute('PRAGMA auto_vacuum=INCREMENTAL;') + self.db.execute('PRAGMA journal_mode = WAL;') + cursor = self.db.cursor() cursor.execute('''CREATE VIRTUAL TABLE IF NOT EXISTS data USING FTS5( id, @@ -331,7 +341,8 @@ class SearchDB(object): mtime, url, category, - title + title, + tokenize = 'porter' )''') self.db.commit() @@ -541,6 +552,13 @@ def __setup_sitevars(): for o in config.options(sub): SiteVars[section][sub].update({o: config.get(sub, o)}) + # add payment + section = 'payment' + SiteVars.update({section: {}}) + for o in config.options(section): + SiteVars[section].update({o: config.get(section, o)}) + + # push the whole thing into cache return SiteVars diff --git a/templates/Singular.html b/templates/Singular.html index 33ac519..ae77b51 100644 --- a/templates/Singular.html +++ b/templates/Singular.html @@ -18,6 +18,9 @@ {% if 'article' == post.category and post.age >= 2 %}