updating all work pages from years between current and 2015

master
Castro0o 7 years ago
parent d6c316462d
commit 1e0a822acb

@ -1,4 +1,23 @@
# Remotes
remote pzi1 ssh://acastro@pzwart1.wdka.hro.nl:/home/acastro/pzimediadesign.nl.git (fetch)
production: pzi2 /var/www/mmdc-site `git pull origin master`
# TODO
## 2015 page
is not being generate. instead 2016 generates it self - FIX
## sustainability
On the long run it would be nice to keep updating the pages, via script
But then, future of the program is uncertain ATM
------------
# pzimediadesign.nl as landing page # pzimediadesign.nl as landing page

@ -13,19 +13,30 @@ def mwsite(host, path): #returns wiki site object
site = Site(host, path) site = Site(host, path)
return site return site
def mw_cats(site, args): #returns pages member of args(categories) def mw_cats(site, args): #returns pages member of args(categories)
last_names = None last_names = None
for cats in args.category: # cats = site.Categories[args.category]#category, 'Graduation_work']
for ci, cname in enumerate(cats): years = range(2015, int(args.category[0])+1 )
cat = site.Categories[cname] print 'years:', years
pages = list(cat.members()) for category in years:#args.category:
# for p in pages: print 'cat:', category
# pages_by_name[p.name] = p cat = site.Categories[category]#, 'Graduation_work']
if last_names == None: print 'site cats:', cat
results = pages pages = list(cat.members())
else: print 'pages:', pages
results = [p for p in pages if p.name in last_names]
last_names = set([p.name for p in pages]) # check whether pages are also part of Category Graduation_work
for p in pages:
p
#pages_by_name[p.name] = p
if last_names == None:
results = pages
else:
results = [p for p in pages if p.name in last_names]
last_names = set([p.name for p in pages])
results = list(results) results = list(results)
return [p.name for p in results] return [p.name for p in results]

@ -7,8 +7,20 @@ from mmdc_modules import pandoc2html, parse_work, write_html_file, mw_cats, mw_p
from argparse import ArgumentParser from argparse import ArgumentParser
from random import shuffle from random import shuffle
### WORKINGS ####
# * each year has its own html template in YYYY-template.html
# * the --category provides the year. I.e. 2017
#
# *
#
#
################
### TO DO ###### ### TO DO ######
# * from the year set loop through the years between it and 2015 in mw_cats loop [DONE]
# *
# * For different user categories serve different templates # * For different user categories serve different templates
# * how & why are years and works mixed??
######### #########
##### #####
@ -17,24 +29,24 @@ from random import shuffle
p = ArgumentParser() p = ArgumentParser()
p.add_argument("--host", default="pzwiki.wdka.nl") p.add_argument("--host", default="pzwiki.wdka.nl")
p.add_argument("--path", default="/mw-mediadesign/", help="nb: should end with /") p.add_argument("--path", default="/mw-mediadesign/", help="nb: should end with /")
p.add_argument("--category", "-c", nargs="*", default=[["2017", "Graduation_work"]], action="append", help="category to query, use -c foo -c bar to intersect multiple categories") p.add_argument("--category", "-c", nargs="*", default=["2017"], 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"') p.add_argument("--preview", help='Preview page. Will override category querying. Use: --page "Name Of Wiki Page"')
args = p.parse_args() args = p.parse_args()
print 'args', args print 'args', args
for i in args.category[0]: for i in args.category:
if '20' in i: if '20' in i:
global year
year = i year = i
print year
print year
###### ######
# DEFS: create_page create_index # DEFS: create_page create_index
###### ######
def create_page(memberpages, mode): def create_page(memberpages, mode):
page_template = open("./{}-template.html".format(year), "r") page_template = open("./{}-template.html".format(year), "r") # a template for each year
indexdict = {} #parent dict: contains articledict instances indexdict = {} #parent dict: contains articledict instances
for member in memberpages: for member in memberpages:
print member print member
@ -53,7 +65,7 @@ def create_page(memberpages, mode):
articledict[key] = replace_video(articledict['Content']) articledict[key] = replace_video(articledict['Content'])
articledict['Imgs'] = mw_page_imgsurl(site, page, articledict['Thumbnail'] ) articledict['Imgs'] = mw_page_imgsurl(site, page, articledict['Thumbnail'] )
pprint.pprint( articledict) #pprint.pprint( articledict)
page_tree = html5lib.parse(page_template, namespaceHTMLElements=False) page_tree = html5lib.parse(page_template, namespaceHTMLElements=False)
page_title = page_tree.find('.//title') page_title = page_tree.find('.//title')
page_title.text=articledict['Title']#.decode('utf-8') page_title.text=articledict['Title']#.decode('utf-8')
@ -82,15 +94,15 @@ def create_page(memberpages, mode):
#print #print
figures = page_tree.findall('.//figure') figures = page_tree.findall('.//figure')
images = page_tree.findall('.//img') images = page_tree.findall('.//img')
print 'Number of imgs:', len(images) #print 'Number of imgs:', len(images)
if len(figures) > 0: if len(figures) > 0:
print 'figures', figures #print 'figures', figures
for figure in figures: for figure in figures:
img = figure.find('.//img') img = figure.find('.//img')
figcaption = figure.find('.//figcaption') figcaption = figure.find('.//figcaption')
img_src = img.get('src') img_src = img.get('src')
print img_src #print img_src
figcaption_text = figcaption.text figcaption_text = figcaption.text
if figcaption_text == img_src:# remove figcation if == src if figcaption_text == img_src:# remove figcation if == src
figure.remove(figcaption) figure.remove(figcaption)
@ -98,18 +110,19 @@ def create_page(memberpages, mode):
src = (('File:'+img_src).capitalize()).decode('utf-8') src = (('File:'+img_src).capitalize()).decode('utf-8')
if src in articledict['Imgs'].keys(): #full-url if src in articledict['Imgs'].keys(): #full-url
url = (articledict['Imgs'][src]) url = (articledict['Imgs'][src])
print url #print url
img.set('src', url) img.set('src', url)
else: else:
for img in images: for img in images:
img_src = img.get('src') img_src = img.get('src')
print img_src print img_src
src = (('File:'+img_src).capitalize()).decode('utf-8') src = (('File:'+img_src).capitalize()).decode('utf-8')
pprint.pprint(articledict)
if src in articledict['Imgs'].keys(): #full-url if src in articledict['Imgs'].keys(): #full-url
url = (articledict['Imgs'][src]) url = (articledict['Imgs'][src])
print url #print url
img.set('src', url) img.set('src', url)
print ET.tostring(img) #print ET.tostring(img)
img.set('title', (img.get('title').replace('fig:','')) ) img.set('title', (img.get('title').replace('fig:','')) )
# save work page # save work page
creator = articledict['Creator'].encode('ascii', 'ignore') creator = articledict['Creator'].encode('ascii', 'ignore')
@ -137,8 +150,17 @@ def create_index(indexdict):
date=indexdict[key]['Date'], date=indexdict[key]['Date'],
thumbnail=(indexdict[key]['Thumbnail']) thumbnail=(indexdict[key]['Thumbnail'])
) )
print '----', indexdict[key]['Title'],indexdict[key]['Path'] #print '----', indexdict[key]['Title'],indexdict[key]['Path']
write_html_file(index_tree, './web/{}.html'.format('index')) indexfile_year = './web/{}.html'.format(year)
indexfile = './web/index.html'
print indexfile_year
write_html_file(index_tree, indexfile_year)
# only for last year
write_html_file(index_tree, indexfile)
##### #####
@ -155,7 +177,6 @@ if args.preview is not None:
else: else:
print "** New Index Mode **" print "** New Index Mode **"
memberpages=mw_cats(site, args) memberpages=mw_cats(site, args)
# memberpages
print 'memberpages:', memberpages print 'memberpages:', memberpages
indexdict = create_page(memberpages, 'index') indexdict = create_page(memberpages, 'index')
create_index(indexdict) create_index(indexdict)

@ -40,7 +40,13 @@
<img src="http://pzwiki.wdka.nl/mw-mediadesign/images/9/98/Fuzzylogic.png"> <img src="http://pzwiki.wdka.nl/mw-mediadesign/images/9/98/Fuzzylogic.png">
<h1>Graduation Show 2016: <i>Fuzzy Logic</i></h1> <h1>Graduation Show 2016: <i>Fuzzy Logic</i></h1>
<h1 class="highlight">17 - 25 June Rotterdam</h1> <h1>Opening: June 17, 19:00</h1>
<h1>June 18 - June 26 12:00 - 17:00</h1>
<p>Locations:</p>
<p><a href="http://pzwart.nl/">Piet Zwart Institute</a><br>Mauritsstraat 36<br>Rotterdam</p>
<p><a href="http://v2.nl/">V2_</a><br>Eendrachtsstraat 10<br>Rotterdam</p>
<p>Each year the graduating artists and designers of the Media Design &amp; Communication Department Piet Zwart Institute celebrate their graduation by creating an event: an exhibition, lectures, publications and performances to represent as fully as possible the diverse range of practices encompassed by the practice-based research undertaken in the department.</p> <p>Each year the graduating artists and designers of the Media Design &amp; Communication Department Piet Zwart Institute celebrate their graduation by creating an event: an exhibition, lectures, publications and performances to represent as fully as possible the diverse range of practices encompassed by the practice-based research undertaken in the department.</p>
<p> <p>
@ -62,11 +68,12 @@
<div id="sideBarDescInfo"><p>Fuzzy Logic</p> </div> <div id="sideBarDescInfo"><p>Fuzzy Logic</p> </div>
<div id="sideBarDescInner"> <div id="sideBarDescInner">
<p class="hightlightSidebar">Graduation Show 2016: Fuzzy Logic</p> <p class="hightlightSidebar">Graduation Show 2016: Fuzzy Logic</p>
<p>Opening: June 17, 19:00<br>June 18 - June 26<br>12:00 - 17:00</p>
<p>Locations:<br>
<a href="http://pzwart.nl/">Piet Zwart Institute</a><br>Mauritsstraat 36<br>Rotterdam
<br><br><a href="http://v2.nl/">V2_</a><br>Eendrachtsstraat 10<br>Rotterdam</p>
<!--p&amp;gt;(Text on Gradshow 2015)&amp;lt;/p--> <!--p&amp;gt;(Text on Gradshow 2015)&amp;lt;/p-->
<p class="hightlightSidebar">Date: 17 - 25 June.<br>
Opening: Fri. 17 June, 19:00<br>Location:
<a href="http://pzwart.nl/">Piet Zwart Institute</a>, <a href="http://v2.nl/">V2_</a><br>
</p><p>
<!-- &lt;a&gt; &lt;a href="works/2015-Mihail_Bakalov.html"&gt;Mihail Bakalov (BG)&lt;/a&gt; &lt;br&gt; --> <!-- &lt;a&gt; &lt;a href="works/2015-Mihail_Bakalov.html"&gt;Mihail Bakalov (BG)&lt;/a&gt; &lt;br&gt; -->
<!-- &lt;a href="works/2015-ehCaetano.html"&gt;Caetano Carvalho (BR)&lt;/a&gt; &lt;br&gt; --> <!-- &lt;a href="works/2015-ehCaetano.html"&gt;Caetano Carvalho (BR)&lt;/a&gt; &lt;br&gt; -->
@ -81,7 +88,7 @@
<!-- &lt;a href="works/2015-Nikos_Voyiatzis.html"&gt;Nikos Voyiatzis (GR)&lt;/a&gt;&lt;br&gt; --> <!-- &lt;a href="works/2015-Nikos_Voyiatzis.html"&gt;Nikos Voyiatzis (GR)&lt;/a&gt;&lt;br&gt; -->
<!-- &lt;a href="works/2015-Joseph_Knierzinger.html"&gt;Joseph Knierzinger (AT)&lt;/a&gt;&lt;br&gt; --> <!-- &lt;a href="works/2015-Joseph_Knierzinger.html"&gt;Joseph Knierzinger (AT)&lt;/a&gt;&lt;br&gt; -->
<!-- &lt;a href="works/2015-Mathijs_van_Oosterhoudt.html"&gt;Mathijs van Oosterhoudt (NL)&lt;/a&gt; --> <!-- &lt;a href="works/2015-Mathijs_van_Oosterhoudt.html"&gt;Mathijs van Oosterhoudt (NL)&lt;/a&gt; -->
</p>
</div> </div>
</div> </div>
</div> </div>
@ -97,7 +104,7 @@
<div class="isotope"> <!-- Maybe sould aslo have have--> <div class="isotope"> <!-- Maybe sould aslo have have-->
<div class="grid-sizer"></div> <div class="grid-sizer"></div>
<div class="item" data-creator="Manetta Berends" data-date="2016" data-title="I-could-have-written-that" id="I-could-have-written-that"><a class="work" href="works/2016-Manetta_Berends.html"><img class="work" src="https://pzwiki.wdka.nl/mw-mediadesign/images/2/2f/I-could-have-written-that_these-are-the-words_mb.png"></a></div><div class="item" data-creator="Solange Frankort" data-date="2016" data-title="The Limejuice Mystery" id="The Limejuice Mystery"><a class="work" href="works/2016-Solange_Frankort.html"><img class="work" src="https://pzwiki.wdka.nl/mw-mediadesign/images/0/04/LimeJuiceMystery.gif"></a></div><div class="item" data-creator="Joana Chicau" data-date="2016" data-title="WebPage Act l, ll, lll" id="WebPage Act l, ll, lll"><a class="work" href="works/2016-Joana_Chicau.html"><img class="work" src="https://pzwiki.wdka.nl/mw-mediadesign/images/4/4b/JoanaChicau_pic.jpg"></a></div><div class="item" data-creator="Cihad Caner" data-date="2016" data-title="Abstract Violence" id="Abstract Violence"><a class="work" href="works/2016-Cihad_Caner.html"><img class="work" src="https://pzwiki.wdka.nl/mw-mediadesign/images/2/2e/Rrr.jpg"></a></div><div class="item" data-creator="Ruben van de Ven" data-date="2016" data-title="Choose how you feel; you have seven options" id="Choose how you feel; you have seven options"><a class="work" href="works/2016-Ruben_van_de_Ven.html"><img class="work" src="https://pzwiki.wdka.nl/mw-mediadesign/images/d/d0/RubenBioPic.jpg"></a></div><div class="item" data-creator="Benjamin Li" data-date="2016" data-title="In Search of Perfect Orange" id="In Search of Perfect Orange"><a class="work" href="works/2016-Benjamin_Li.html"><img class="work" src="https://pzwiki.wdka.nl/mw-mediadesign/images/8/89/Still_video.jpg"></a></div><div class="item" data-creator="Thomas Walskaar" data-date="2016" data-title="My Hard-Drive Died Along With My Heart" id="My Hard-Drive Died Along With My Heart"><a class="work" href="works/2016-Thomas_Walskaar.html"><img class="work" src="https://pzwiki.wdka.nl/mw-mediadesign/images/8/89/FrontMYHHD.jpg"></a></div><div class="item" data-creator="Cristina Lavinia Cochior" data-date="2016" data-title="In The Company Of Bots" id="In The Company Of Bots"><a class="work" href="works/2016-Cristina_Lavinia_Cochior.html"><img class="work" src="https://pzwiki.wdka.nl/mw-mediadesign/images/2/2f/ChenzwBot.png"></a></div><div class="item" data-creator="Julie Boschat Thorez" data-date="2016" data-title="LIAPO" id="LIAPO"><a class="work" href="works/2016-Julie_Boschat_Thorez.html"><img class="work" src="https://pzwiki.wdka.nl/mw-mediadesign/images/9/94/Liapo.jpg"></a></div><div class="item" data-creator="Lucas Battich" data-date="2016" data-title="Progressive movement towards concrete creation" id="Progressive movement towards concrete creation"><a class="work" href="works/2016-Lucas_Battich.html"><img class="work" src="https://pzwiki.wdka.nl/mw-mediadesign/images/2/20/Progressive_movement_towards_concrete_creation.jpg"></a></div><div class="item" data-creator="Yuzhen Tang" data-date="2016" data-title="For the Common Good" id="For the Common Good"><a class="work" href="works/2016-Yuzhen_Tang.html"><img class="work" src="https://pzwiki.wdka.nl/mw-mediadesign/images/1/18/For_the_common_good_03_Yuzhen.jpg"></a></div></div> </div>
</div> </div>
<div class="sidebarBorderLeft zwartArea" id="section03"> <div class="sidebarBorderLeft zwartArea" id="section03">
<div class="zwartAreaFull zwartColophon"> <div class="zwartAreaFull zwartColophon">
@ -113,11 +120,11 @@
- 21:00 22:30 at the <a href="http://pzwart.nl/">Piet Zwart Institute</a><br> - 21:00 22:30 at the <a href="http://pzwart.nl/">Piet Zwart Institute</a><br>
continuing until Sunday, 26 June, open in both venues Tuesday - Sunday: 12:00 - 17:00 continuing until Sunday, 26 June, open in both venues Tuesday - Sunday: 12:00 - 17:00
</p> </p>
<br>
<h1>Piet Zwart Institute</h1>
<p> The Piet Zwart Institute houses the international Master programmes of the Willem de Kooning Academy at Hogeschool Rotterdam. Since 1999 it has been dedicated to promoting study and research in the fields of art, design and art education.</p> <p> The Piet Zwart Institute houses the international Master programmes of the Willem de Kooning Academy at Hogeschool Rotterdam. Since 1999 it has been dedicated to promoting study and research in the fields of art, design and art education.</p>
<p><a href="http://www.pzwart.nl/">http://www.pzwart.nl/</a></p> <p><a href="http://www.pzwart.nl/">http://www.pzwart.nl/</a></p>
<br>
<h1>Master Media Design &amp; Communication</h1> <h1>Master Media Design &amp; Communication</h1>
<p>The Piet Zwart Institute Master Media Design &amp; Communication is a <p>The Piet Zwart Institute Master Media Design &amp; Communication is a
research orientated master programme, with a strong emphasis on the research orientated master programme, with a strong emphasis on the
@ -138,11 +145,13 @@ allow students to intensively engage with a particular aspect of the
<div class="project"> <div class="project">
<p><a href="http://www.pzwart.nl/">Master Media Design &amp; Communication</a></p> <p><a href="http://www.pzwart.nl/">Master Media Design &amp; Communication</a></p>
<p><a href="https://lensbased.pzimediadesign.nl/">Lens-Based Media Blog</a></p>
<p><a href="https://xpub.pzimediadesign.nl/">Experimental Publishing Blog</a></p> <p><a href="https://xpub.pzimediadesign.nl/">Experimental Publishing Blog</a></p>
<p><a href="2015.html">Graduation Projects 2015</a></p> <p><a href="2015.html">Graduation Projects 2015</a></p>
</div> </div>
<hr> <hr>
<p>Piet Zwart Institute Master Media Design and Communication, Willem de Kooning Academy<br> Rotterdam University of Applied Sciences
</p>
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save