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-08-15 11:02:59 +01:00
|
|
|
syncserver = 'liveserver:/web/petermolnar.net/web'
|
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'
|
|
|
|
],
|
|
|
|
'licence': 'by-nc-nd',
|
|
|
|
}
|
|
|
|
|
|
|
|
categorydisplay = {
|
|
|
|
'article': 'flat',
|
|
|
|
'journal': 'flat',
|
|
|
|
'photo': 'gallery',
|
|
|
|
}
|
|
|
|
|
|
|
|
licence = {
|
|
|
|
'article': 'by',
|
|
|
|
'journal': 'by-nc',
|
|
|
|
}
|
|
|
|
|
|
|
|
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-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',
|
|
|
|
'cv': 'https://petermolnar.net/about.html',
|
2018-08-15 11:02:59 +01:00
|
|
|
'contact': {
|
|
|
|
'xmpp': 'xmpp:mail@petermolnar.net',
|
|
|
|
'tumblr': 'https://petermolnarnet.tumblr.com/',
|
|
|
|
'wordpress': 'https://petermolnareu.wordpress.com/',
|
|
|
|
'flickr': 'https://flickr.com/people/petermolnareu',
|
|
|
|
'github': 'https://github.com/petermolnar',
|
2018-10-17 11:38:02 +01:00
|
|
|
'instagram': 'https://www.instagram.com/petermolnarnet/',
|
2018-11-03 09:48:37 +00:00
|
|
|
'twitter': 'https://twitter.com/petermolnar',
|
2018-08-15 11:02:59 +01:00
|
|
|
}
|
2018-07-20 16:47:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
paths = {
|
|
|
|
'content': os.path.join(base, 'content'),
|
2018-08-15 11:02:59 +01:00
|
|
|
'webmentions': os.path.join(base, 'content', 'webmentions'),
|
2018-07-20 16:47:25 +01:00
|
|
|
'tmpl': os.path.join(base, 'nasg', 'templates'),
|
|
|
|
'watermark': os.path.join(base, 'nasg', 'templates', 'watermark.png'),
|
|
|
|
'build': os.path.join(base, 'www'),
|
|
|
|
}
|
|
|
|
|
|
|
|
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',
|
|
|
|
}
|
|
|
|
|
|
|
|
loglevels = {
|
|
|
|
'critical': 50,
|
|
|
|
'error': 40,
|
|
|
|
'warning': 30,
|
|
|
|
'info': 20,
|
|
|
|
'debug': 10
|
|
|
|
}
|
|
|
|
|
|
|
|
_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',
|
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
|
|
|
|
)
|
|
|
|
|
|
|
|
_parser.add_argument(
|
|
|
|
'--loglevel',
|
|
|
|
default='info',
|
|
|
|
help='change loglevel'
|
|
|
|
)
|
|
|
|
|
|
|
|
args = vars(_parser.parse_args())
|
|
|
|
|
2018-08-04 09:30:26 +01:00
|
|
|
loglevel = loglevels.get(args.get('loglevel'))
|
2018-07-20 16:47:25 +01:00
|
|
|
|
2018-08-04 09:30:26 +01:00
|
|
|
logger = logging.getLogger("nasg")
|
|
|
|
logger.setLevel(loglevel)
|
|
|
|
console_handler = logging.StreamHandler()
|
|
|
|
logger.addHandler(console_handler)
|
|
|
|
logging.getLogger('asyncio').setLevel(loglevel)
|