|
|
@ -2,7 +2,7 @@ import os, json, sys, urllib
|
|
|
|
from mwclient import Site
|
|
|
|
from mwclient import Site
|
|
|
|
from pprint import pprint
|
|
|
|
from pprint import pprint
|
|
|
|
from jinja2 import Template
|
|
|
|
from jinja2 import Template
|
|
|
|
from functions import pandoc, page_props, unpack_response
|
|
|
|
from functions import pandoc, page_props, unpack_response, clean_dir
|
|
|
|
|
|
|
|
|
|
|
|
from functions import Colors
|
|
|
|
from functions import Colors
|
|
|
|
import argparse
|
|
|
|
import argparse
|
|
|
@ -48,13 +48,14 @@ if args.dry is True:
|
|
|
|
|
|
|
|
|
|
|
|
site = Site(host=args.host, path=args.path)
|
|
|
|
site = Site(host=args.host, path=args.path)
|
|
|
|
|
|
|
|
|
|
|
|
wd = os.path.dirname(os.path.abspath(__file__)) # working directory
|
|
|
|
wd = os.path.dirname(os.path.abspath(__file__)) # working directory
|
|
|
|
imgdir = os.path.join(wd, 'images')
|
|
|
|
imgdir = os.path.join(wd, 'images')
|
|
|
|
imgsjson_fn = os.path.join(wd, 'images.json')
|
|
|
|
imgsjson_fn = os.path.join(wd, 'images.json')
|
|
|
|
with open(imgsjson_fn, 'r') as imgsjson_file:
|
|
|
|
with open(imgsjson_fn, 'r') as imgsjson_file:
|
|
|
|
images_info = json.load(imgsjson_file)
|
|
|
|
images_info = json.load(imgsjson_file)
|
|
|
|
static_html = os.path.join(wd, 'static_html')
|
|
|
|
static_html = os.path.join(wd, 'static_html')
|
|
|
|
os.makedirs(static_html, exist_ok=True) # create images/ dir
|
|
|
|
os.makedirs(static_html, exist_ok=True) # create static_html/ dir
|
|
|
|
|
|
|
|
clean_dir(static_html) # if static_html exists and has files or dirs: clean it
|
|
|
|
|
|
|
|
|
|
|
|
with open(os.path.join(wd, 'login.txt'), 'r') as login: # read login user & pwd
|
|
|
|
with open(os.path.join(wd, 'login.txt'), 'r') as login: # read login user & pwd
|
|
|
|
loginlines = login.read()
|
|
|
|
loginlines = login.read()
|
|
|
@ -104,7 +105,6 @@ for answer in site.ask(query):
|
|
|
|
# print(pub_html, '\n')
|
|
|
|
# print(pub_html, '\n')
|
|
|
|
pub_parts_html = '' # Reset pub_parts_html
|
|
|
|
pub_parts_html = '' # Reset pub_parts_html
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: queries without Part?
|
|
|
|
|
|
|
|
# TODO: include Creator Property value
|
|
|
|
# TODO: include Creator Property value
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: address Dates:
|
|
|
|
# TODO: address Dates:
|
|
|
|