2018-12-03 10:36:10 +00:00
|
|
|
__author__ = "Peter Molnar"
|
2019-01-05 11:55:40 +00:00
|
|
|
__copyright__ = "Copyright 2017-2019, Peter Molnar"
|
2018-12-03 10:36:10 +00:00
|
|
|
__license__ = "apache-2.0"
|
|
|
|
__maintainer__ = "Peter Molnar"
|
|
|
|
__email__ = "mail@petermolnar.net"
|
|
|
|
|
2018-07-20 16:47:25 +01:00
|
|
|
import os
|
|
|
|
import re
|
|
|
|
import argparse
|
|
|
|
import logging
|
|
|
|
|
|
|
|
base = os.path.abspath(os.path.expanduser('~/Projects/petermolnar.net'))
|
2018-11-10 20:49:13 +00:00
|
|
|
syncserver = 'liveserver:/web/petermolnar.net'
|
2018-07-20 16:47:25 +01:00
|
|
|
|
|
|
|
site = {
|
|
|
|
'title': 'Peter Molnar',
|
|
|
|
'url': 'https://petermolnar.net',
|
|
|
|
'domain': 'petermolnar.net',
|
2018-09-04 21:58:25 +01:00
|
|
|
'pagination': 42,
|
2018-07-20 16:47:25 +01:00
|
|
|
'on_front': [
|
|
|
|
'article',
|
|
|
|
'photo',
|
|
|
|
'journal'
|
|
|
|
],
|
2018-11-10 20:49:13 +00:00
|
|
|
'licence': 'CC-BY-NC-ND-4.0',
|
2019-01-21 16:10:27 +00:00
|
|
|
'search': 'https://petermolnar.net/search.php',
|
|
|
|
'favicon': 'https://petermolnar.net/favicon.ico'
|
|
|
|
}
|
|
|
|
|
|
|
|
menu = {
|
|
|
|
'home': {
|
|
|
|
'url': '%s/' % site['url'],
|
|
|
|
'text': 'home',
|
|
|
|
},
|
|
|
|
'photo': {
|
|
|
|
'url': '%s/category/photo/' % site['url'],
|
|
|
|
'text': 'photos',
|
|
|
|
},
|
|
|
|
'journal': {
|
|
|
|
'url': '%s/category/journal/' % site['url'],
|
|
|
|
'text': 'journal',
|
|
|
|
},
|
|
|
|
'article': {
|
|
|
|
'url': '%s/category/article/' % site['url'],
|
|
|
|
'text': 'IT',
|
|
|
|
},
|
|
|
|
'note': {
|
|
|
|
'url': '%s/category/note/' % site['url'],
|
|
|
|
'text': 'notes'
|
|
|
|
},
|
|
|
|
'follow': {
|
|
|
|
'url': '%s/follow/' % site['url'],
|
|
|
|
'text': 'follow'
|
|
|
|
}
|
2018-07-20 16:47:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
categorydisplay = {
|
|
|
|
'article': 'flat',
|
|
|
|
'journal': 'flat',
|
|
|
|
}
|
|
|
|
|
|
|
|
licence = {
|
2018-11-10 20:49:13 +00:00
|
|
|
'article': 'CC-BY-4.0',
|
|
|
|
'journal': 'CC-BY-NC-4.0',
|
2018-07-20 16:47:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
'webmention': 'https://webmention.io/petermolnar.net/webmention',
|
|
|
|
'pingback': 'https://webmention.io/petermolnar.net/xmlrpc',
|
2018-08-15 11:02:59 +01:00
|
|
|
'hub': 'https://petermolnar.superfeedr.com/',
|
|
|
|
'authorization_endpoint': 'https://indieauth.com/auth',
|
|
|
|
'token_endpoint': 'https://tokens.indieauth.com/token',
|
2018-11-10 20:49:13 +00:00
|
|
|
'micropub': 'https://petermolnar.net/micropub.php',
|
|
|
|
'microsub': 'https://aperture.p3k.io/microsub/83'
|
2018-07-20 16:47:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
author = {
|
|
|
|
'name': 'Peter Molnar',
|
|
|
|
'email': 'mail@petermolnar.net',
|
|
|
|
'url': 'https://petermolnar.net/',
|
|
|
|
'avatar': 'https://petermolnar.net/molnar_peter_avatar.jpg',
|
|
|
|
'gpg': 'https://petermolnar.net/pgp.asc',
|
2019-01-21 16:10:27 +00:00
|
|
|
'cv': 'https://petermolnar.net/cv.html',
|
|
|
|
'github': 'https://github.com/petermolnar',
|
|
|
|
'about': 'https://petermolnar.net/about/',
|
|
|
|
'following': 'https://petermolnar.net/following.opml',
|
|
|
|
'tips': {
|
|
|
|
'monzo': {
|
|
|
|
'text': 'Monzo (only in the UK or via Google Pay)',
|
|
|
|
'url': 'https://monzo.me/petermolnar/3'
|
|
|
|
},
|
|
|
|
'paypal': {
|
|
|
|
'text': 'Paypal',
|
|
|
|
'url': 'https://paypal.me/petermolnar/3GBP'
|
|
|
|
}
|
2018-08-15 11:02:59 +01:00
|
|
|
}
|
2018-07-20 16:47:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
paths = {
|
|
|
|
'content': os.path.join(base, 'content'),
|
|
|
|
'tmpl': os.path.join(base, 'nasg', 'templates'),
|
|
|
|
'watermark': os.path.join(base, 'nasg', 'templates', 'watermark.png'),
|
|
|
|
'build': os.path.join(base, 'www'),
|
2018-11-10 20:49:13 +00:00
|
|
|
'queue': os.path.join(base, 'queue'),
|
|
|
|
'remotewww': 'web',
|
|
|
|
'remotequeue': 'queue',
|
|
|
|
'micropub': os.path.join(base, 'content', 'note'),
|
2018-12-27 19:48:06 +00:00
|
|
|
'tmp': os.path.join(base, 'tmp'),
|
2019-01-15 21:28:58 +00:00
|
|
|
'home': os.path.join(base, 'content', 'home', 'index.md'),
|
2018-07-20 16:47:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
photo = {
|
|
|
|
're_author': re.compile(r'(?:P[eé]ter Moln[aá]r)|(?:Moln[aá]r P[eé]ter)|(?:petermolnar\.(?:eu|net))'),
|
|
|
|
'default': 720,
|
|
|
|
'sizes': {
|
|
|
|
#90 = s
|
|
|
|
#360 = m
|
|
|
|
720: '',
|
|
|
|
1280: '_b',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2018-08-15 11:02:59 +01:00
|
|
|
tips = {
|
|
|
|
'paypal': 'https://paypal.me/petermolnar/3GBP',
|
|
|
|
'monzo': 'https://monzo.me/petermolnar/3',
|
|
|
|
}
|
2018-07-20 16:47:25 +01:00
|
|
|
|
|
|
|
dateformat = {
|
2018-07-27 14:55:21 +01:00
|
|
|
'iso': 'YYYY-MM-DDTHH:mm:ssZZ',
|
2018-07-20 16:47:25 +01:00
|
|
|
'display': 'YYYY-MM-DD HH:mm',
|
2018-11-10 20:49:13 +00:00
|
|
|
'fname': 'YYYYMMDDHHmmssZ',
|
2018-07-20 16:47:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
_parser = argparse.ArgumentParser(description='Parameters for NASG')
|
|
|
|
_booleanparams = {
|
|
|
|
'regenerate': 'force downsizing images',
|
|
|
|
'force': 'force rendering HTML',
|
2018-09-04 21:58:25 +01:00
|
|
|
'nosync': 'skip sync to live server',
|
2019-01-15 21:28:58 +00:00
|
|
|
'debug': 'set logging to debug level',
|
|
|
|
'quiet': 'show only errors'
|
2018-07-20 16:47:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for k, v in _booleanparams.items():
|
|
|
|
_parser.add_argument(
|
|
|
|
'--%s' % (k),
|
|
|
|
action='store_true',
|
|
|
|
default=False,
|
|
|
|
help=v
|
|
|
|
)
|
|
|
|
|
|
|
|
args = vars(_parser.parse_args())
|
|
|
|
|
2019-01-15 21:28:58 +00:00
|
|
|
if args.get('debug', False):
|
|
|
|
loglevel = 10
|
|
|
|
elif args.get('quiet', False):
|
|
|
|
loglevel = 40
|
|
|
|
else:
|
|
|
|
loglevel = 20
|
2018-07-20 16:47:25 +01:00
|
|
|
|
2018-11-04 23:27:53 +00:00
|
|
|
logger = logging.getLogger('NASG')
|
2018-08-04 09:30:26 +01:00
|
|
|
logger.setLevel(loglevel)
|
2019-01-15 21:28:58 +00:00
|
|
|
|
2018-08-04 09:30:26 +01:00
|
|
|
console_handler = logging.StreamHandler()
|
2018-11-04 23:27:53 +00:00
|
|
|
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
|
|
console_handler.setFormatter(formatter)
|
2018-08-04 09:30:26 +01:00
|
|
|
logger.addHandler(console_handler)
|
2019-01-15 21:28:58 +00:00
|
|
|
|
2018-08-04 09:30:26 +01:00
|
|
|
logging.getLogger('asyncio').setLevel(loglevel)
|