preview enabled

master
Castro0o 6 years ago
parent a9a6d7cd72
commit 3c7b8ac30d

@ -23,16 +23,16 @@ from random import shuffle
################
######
# Args
# user_args
####
p = ArgumentParser()
p.add_argument("--host", default="pzwiki.wdka.nl")
p.add_argument("--path", default="/mw-mediadesign/", help="nb: should end with /")
p.add_argument("--category", "-c", nargs="*", help="category to query, use -c foo bar to intersect multiple categories")
p.add_argument("--preview", help='Preview page. Will override category querying. Use: --page "Name Of Wiki Page"')
parser = ArgumentParser()
parser.add_argument("--host", default="pzwiki.wdka.nl")
parser.add_argument("--path", default="/mw-mediadesign/", help="nb: should end with /")
parser.add_argument("--category", "-c", nargs="*", help="category to query, use -c foo bar to intersect multiple categories")
parser.add_argument("--preview", help='Preview page. Will override category querying. Use: --page "Name Of Wiki Page"')
args = p.parse_args()
print 'args', args
user_args = parser.parse_args()
print 'user_args', user_args
######
# DEFS: create_pages create_index
@ -46,6 +46,7 @@ def create_pages(memberpages, mode):
for member in memberpages:
page = mw_page(site, member)
page_text = mw_page_text(site, page)
# import pdb; pdb.set_trace()
articledict = parse_work(site, member, page_text) # create dictionary
# Title, Creator, Date, Website, Thumbnail, Bio, Description, Extra
if len(articledict['Creator'])>0 and len(articledict['Title'])>0 and len(articledict['Thumbnail'])>0:
@ -176,10 +177,14 @@ def create_index(indexdict, year):
#####
# ACTION
#####
site = mwsite(args.host, args.path)
memberpages=mw_cats(site, args)
site = mwsite(user_args.host, user_args.path)
# import pdb; pdb.set_trace()
if user_args.preview:
memberpages=[unicode(user_args.preview)]
else:
memberpages=mw_cats(site, user_args)
# print '\n\nmemberpages:\n\n', memberpages, '\n\n********\n\n' # memberpages include years, from current to 2015
indexdict = create_pages(memberpages, 'index')
indexdict_byyear={year:{} for year in years } # index of all page organized according to year
# indexdict_byyear structure:

Loading…
Cancel
Save