creating pages makeing script

master
Castro0o 10 years ago
parent dc50c39a34
commit 4ff22943b8

@ -1 +1 @@
{"15982": {"Extra": "", "Creator": "Ana Lu\u00edsa Moura", "Thumbnail_url": "http://pzwiki.wdka.nl/mw-mediadesign/images/b/bd/Collage_007_thumbnail.jpg", "Title": "The_Aesthetics_of_Ethics", "Date": "2015", "Thumbnail": "collage_007_thumbnail.jpg"}, "15986": {"Website": "http://joak.nospace.at", "Bio": "My Bio", "Description": "my description", "Creator": "Joseph Knierzinger", "Title": "User:Joak/graduation/catalog1", "Thumbnail_url": "http://pzwiki.wdka.nl/mw-mediadesign/images/1/16/Pointer.gif", "Date": "2015", "Thumbnail": "pointer.gif", "Extra": "my free text"}, "15965": {"Website": "https://en.wikipedia.org/wiki/Luther_Blissett_%28nom_de_plume%29", "Bio": "Luther Blissett is a multiple-use name, an \"open pop star\" informally adopted and shared by hundreds of artists and activists all over Europe and the Americas since 1994. The pseudonym first appeared in Bologna, Italy, in mid-1994, when a number of cultural activists began using it for staging a series of urban and media pranks and to experiment with new forms of authorship and identity. From Bologna the multiple-use name spread to other European cities, such as Rome and London, as well as countries such as Germany, Spain, and Slovenia.[1] Sporadic appearances of Luther Blissett have been also noted in Canada, the United States, and Brazil.", "Description": "this is the description.", "Creator": "Luther Blisset", "Title": "Qq", "Thumbnail_url": "http://pzwiki.wdka.nl/mw-mediadesign/images/thumb/8/85/Luther-blissett-300.jpg/500px-Luther-blissett-300.jpg", "Date": "2015", "Thumbnail": "Luther-blissett-300.jpg", "Extra": "Free text hereWhile the folk heroes of the early-modern period and the nineteenth century served a variety of social and political purposes, the Luther Blissett Project (LBP) were able to utilize the media and communication strategies unavailable to their predecessors. According to Marco Deseriis, the main purpose of the LBP was to create \"a folk hero of the information society\" whereby knowledge workers and immaterial workers could organize and recognize themselves.[5] Thus, rather than being understood only as a media prankster and culture jammer, Luther Blissett became a positive mythic figure that was supposed to embody the very process of community and cross-media storytelling. Roberto Bui\u2014one of the co-founders of the LBP and Wu Ming\u2014explains the function of Luther Blissett and other radical folk heroes as mythmaking or mythopoesis[[File:Quipu.png]][[File:Screen_Shot_2015-03-31_at_11.07.35.png]]"}, "15974": {"Extra": "", "Creator": "JOK", "Thumbnail_url": "http://pzwiki.wdka.nl/mw-mediadesign/images/thumb/a/af/22xxxxx.jpg/500px-22xxxxx.jpg", "Title": "Ahhhh", "Date": "2015", "Thumbnail": "22xxxxx.jpg"}}
{"15982": {"Date": "2015", "Creator": "Ana Lu\u00edsa Moura", "Thumbnail_url": "http://pzwiki.wdka.nl/mw-mediadesign/images/b/bd/Collage_007_thumbnail.jpg", "Thumbnail": "collage_007_thumbnail.jpg", "Title": "The_Aesthetics_of_Ethics"}, "15986": {"Website": "http://joak.nospace.at", "Bio": "My Bio", "Description": "my description", "Creator": "Joseph Knierzinger", "Title": "User:Joak/graduation/catalog1", "Thumbnail_url": "http://pzwiki.wdka.nl/mw-mediadesign/images/1/16/Pointer.gif", "Date": "2015", "Thumbnail": "pointer.gif", "Extra": "my free text"}, "15965": {"Website": "https://en.wikipedia.org/wiki/Luther_Blissett_%28nom_de_plume%29", "Bio": "Luther Blissett is a multiple-use name, an \"open pop star\" informally adopted and shared by hundreds of artists and activists all over Europe and the Americas since 1994. The pseudonym first appeared in Bologna, Italy, in mid-1994, when a number of cultural activists began using it for staging a series of urban and media pranks and to experiment with new forms of authorship and identity. From Bologna the multiple-use name spread to other European cities, such as Rome and London, as well as countries such as Germany, Spain, and Slovenia.[1] Sporadic appearances of Luther Blissett have been also noted in Canada, the United States, and Brazil.", "Description": "this is the description.", "Creator": "Luther Blisset", "Title": "Qq", "Thumbnail_url": "http://pzwiki.wdka.nl/mw-mediadesign/images/thumb/8/85/Luther-blissett-300.jpg/500px-Luther-blissett-300.jpg", "Date": "2015", "Thumbnail": "Luther-blissett-300.jpg", "Extra": "Free text hereWhile the folk heroes of the early-modern period and the nineteenth century served a variety of social and political purposes, the Luther Blissett Project (LBP) were able to utilize the media and communication strategies unavailable to their predecessors. According to Marco Deseriis, the main purpose of the LBP was to create \"a folk hero of the information society\" whereby knowledge workers and immaterial workers could organize and recognize themselves.[5] Thus, rather than being understood only as a media prankster and culture jammer, Luther Blissett became a positive mythic figure that was supposed to embody the very process of community and cross-media storytelling. Roberto Bui\u2014one of the co-founders of the LBP and Wu Ming\u2014explains the function of Luther Blissett and other radical folk heroes as mythmaking or mythopoesis[[File:Quipu.png]][[File:Screen_Shot_2015-03-31_at_11.07.35.png]]"}, "15974": {"Date": "2015", "Creator": "JOK", "Thumbnail_url": "http://pzwiki.wdka.nl/mw-mediadesign/images/thumb/a/af/22xxxxx.jpg/500px-22xxxxx.jpg", "Thumbnail": "22xxxxx.jpg", "Title": "Ahhhh"}, "15999": {"Website": "http://maxdovey.com", "Bio": "My Bio", "Description": "How to be more or less human", "Creator": "Max Dovey", "Title": "User:Max_Dovey/maxgradbio", "Thumbnail_url": "http://pzwiki.wdka.nl/mw-mediadesign/images/1/16/Pointer.gif", "Date": "2015", "Thumbnail": "pointer.gif", "Extra": "A solo performance exploring identity, perception and representation through automatic image analysis software. Software that is used to automatically tag online images is used to direct a live performance. Each scene is performed alongside software that reacts and interprets the performers actions. The performance explores the potential threat of computer vision and automated image perception on the human body. Every movement of the performance is analysed in detail to reductive categorisation."}}

@ -58,8 +58,10 @@ def parse_work_page(title, content):
template, extra = (re.findall('\{\{Graduation work\n(.*?)\}\}(.*)', content, re.DOTALL))[0]
# template's key/value pair
keyval = re.findall('\|(.*?)\=(.*?\n)', template, re.DOTALL)
if extra:
extra = ('Extra', extra)
keyval.append(extra)
checkkeys = [keyval[i] for i in range(len(keyval)) if keyval[i][0] in mainkeys and len(keyval[i][1])>3] #list mainkeys present, w/ values, in tuples [(key, val),(key, val)...]
if len(checkkeys) == 3 : # checkkeys contains all mainkeys and values
for pair in keyval:
@ -126,7 +128,19 @@ json.dump(allworks, json_allworks )
'''
Title
{{Graduation_work
|Description=
|Creator=
|Date=
|Bio=
|Thumbnail=
|Website=
}}
Description=
Extra=
'''

@ -7,10 +7,14 @@
import xml.etree.ElementTree as ET
import html5lib, urllib2, json, pprint, re
import subprocess, shlex
#import mmdc_create_json import api_thumb_url
json_allworks_file = open('allworks_mmdc.json', 'r') # save json
json_allworks = json.loads(json_allworks_file.read())
pages_path = 'web/work'
def pandoc2html(mw_content):
if mw_content:
mw_content = mw_content.encode('utf-8')
@ -22,23 +26,62 @@ def pandoc2html(mw_content):
html = (p2.communicate())[0]
return html
def create_workpage( work_dict, work_key):
# Content from json_allworks
thumb = work_dict['Thumbnail_url']
date = work_dict['Date']
title = (work_dict['Title']).replace('_', ' ')
creator = work_dict['Creator']
website = work_dict['Website'] if 'Website' in work_dict.keys() else ''
description = pandoc2html( work_dict['Description'] if 'Description' in work_dict.keys() else '' )
extra = pandoc2html( work_dict['Extra'] if 'Extra' in work_dict.keys() else '')
print 'Graduation_work:', title, 'by', creator
print 'Description:', description
print 'Extra:', extra
print '----------------------'
#def generate_xml():
def create_workpage( allworks_dict, work_key): # replace text content in dict with html nodes, holding the content
for key in allworks_dict.keys():
print key
if key in ['Description', 'Extra']: #need conversion to html, dealing:imgs,<gallery>, vimeo/youtube
allworks_dict[key] = pandoc2html( allworks_dict[key] if key in allworks_dict.keys() else '' ) # convert to HTML
htmlnode = ET.fromstring(allworks_dict[key]) # make them into node
elif key in ['Website']:
htmlnode = ET.Element('a', attrib={'href': allworks_dict[key], 'id':key})
htmlnode.text = allworks_dict[key]
elif key in ['Title']:
htmlnode = ET.Element('h1', attrib={'id': key})
htmlnode.text
elif key in ['Creator', 'Date', 'Bio']:
htmlnode = ET.Element('p', attrib={'id': key})
htmlnode.text
elif key in ['Thumbnail_url']:
htmlnode = ET.Element('img', attrib={'src': allworks_dict[key], 'id': key})
else:
htmlnode = None
# remove keys with None value?
print htmlnode
allworks_dict[key] = htmlnode
allworks_dict.pop('Thumbnail', None) #remove thumnail
pprint.pprint(allworks_dict)
# #p
# elif key in ['Thumbnail_url']:
# #<img>
# else:
# generate_xml()
# work_dict[key] = allworks_dict[key] if key in allworks_dict.keys() else ''
# print work_dict
for key in json_allworks.keys():
graduation_work=json_allworks[key]
create_workpage(graduation_work, key )
print graduation_work['Creator']
# pprint.pprint(graduation_work)
# purge graduation_work from keys with empty vals
# for key in graduation_work:
# if graduation_work[key] in [None, '']:
# print graduation_work
create_workpage(graduation_work, key )
print '----------'

Loading…
Cancel
Save