diff --git a/TODO.md b/TODO.md index 33e0261..f9d90bf 100755 --- a/TODO.md +++ b/TODO.md @@ -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 diff --git a/mmdc_modules.py b/mmdc_modules.py index 93232cd..a77c850 100644 --- a/mmdc_modules.py +++ b/mmdc_modules.py @@ -13,19 +13,30 @@ def mwsite(host, path): #returns wiki site object site = Site(host, path) return site + + def mw_cats(site, args): #returns pages member of args(categories) last_names = None - for cats in args.category: - for ci, cname in enumerate(cats): - cat = site.Categories[cname] - pages = list(cat.members()) - # for p in pages: - # 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]) + # cats = site.Categories[args.category]#category, 'Graduation_work'] + years = range(2015, int(args.category[0])+1 ) + print 'years:', years + for category in years:#args.category: + print 'cat:', category + cat = site.Categories[category]#, 'Graduation_work'] + print 'site cats:', cat + pages = list(cat.members()) + print 'pages:', 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) return [p.name for p in results] diff --git a/mmdc_wiki2web.py b/mmdc_wiki2web.py index 3a42dbe..c51b9c3 100755 --- a/mmdc_wiki2web.py +++ b/mmdc_wiki2web.py @@ -7,8 +7,20 @@ from mmdc_modules import pandoc2html, parse_work, write_html_file, mw_cats, mw_p from argparse import ArgumentParser 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 ###### +# * from the year set loop through the years between it and 2015 in mw_cats loop [DONE] +# * # * 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.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="*", 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"') args = p.parse_args() print 'args', args -for i in args.category[0]: +for i in args.category: if '20' in i: + global year year = i - -print year + print year ###### # DEFS: create_page create_index ###### 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 for member in memberpages: print member @@ -53,7 +65,7 @@ def create_page(memberpages, mode): articledict[key] = replace_video(articledict['Content']) articledict['Imgs'] = mw_page_imgsurl(site, page, articledict['Thumbnail'] ) - pprint.pprint( articledict) + #pprint.pprint( articledict) page_tree = html5lib.parse(page_template, namespaceHTMLElements=False) page_title = page_tree.find('.//title') page_title.text=articledict['Title']#.decode('utf-8') @@ -82,15 +94,15 @@ def create_page(memberpages, mode): #print figures = page_tree.findall('.//figure') images = page_tree.findall('.//img') - print 'Number of imgs:', len(images) + #print 'Number of imgs:', len(images) if len(figures) > 0: - print 'figures', figures + #print 'figures', figures for figure in figures: img = figure.find('.//img') figcaption = figure.find('.//figcaption') img_src = img.get('src') - print img_src + #print img_src figcaption_text = figcaption.text if figcaption_text == img_src:# remove figcation if == src figure.remove(figcaption) @@ -98,18 +110,19 @@ def create_page(memberpages, mode): src = (('File:'+img_src).capitalize()).decode('utf-8') if src in articledict['Imgs'].keys(): #full-url url = (articledict['Imgs'][src]) - print url + #print url img.set('src', url) else: for img in images: img_src = img.get('src') print img_src src = (('File:'+img_src).capitalize()).decode('utf-8') + pprint.pprint(articledict) if src in articledict['Imgs'].keys(): #full-url url = (articledict['Imgs'][src]) - print url + #print url img.set('src', url) - print ET.tostring(img) + #print ET.tostring(img) img.set('title', (img.get('title').replace('fig:','')) ) # save work page creator = articledict['Creator'].encode('ascii', 'ignore') @@ -137,8 +150,17 @@ def create_index(indexdict): date=indexdict[key]['Date'], thumbnail=(indexdict[key]['Thumbnail']) ) - print '----', indexdict[key]['Title'],indexdict[key]['Path'] - write_html_file(index_tree, './web/{}.html'.format('index')) + #print '----', indexdict[key]['Title'],indexdict[key]['Path'] + 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: print "** New Index Mode **" memberpages=mw_cats(site, args) -# memberpages print 'memberpages:', memberpages indexdict = create_page(memberpages, 'index') create_index(indexdict) diff --git a/web/2016.html b/web/2016.html index 3509b5d..abaf45e 100644 --- a/web/2016.html +++ b/web/2016.html @@ -40,7 +40,13 @@

Graduation Show 2016: Fuzzy Logic

-

17 - 25 June Rotterdam

+

Opening: June 17, 19:00

+

June 18 - June 26 12:00 - 17:00

+ +

Locations:

+

Piet Zwart Institute
Mauritsstraat 36
Rotterdam

+

V2_
Eendrachtsstraat 10
Rotterdam

+

Each year the graduating artists and designers of the Media Design & 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.

@@ -62,11 +68,12 @@

Fuzzy Logic

Graduation Show 2016: Fuzzy Logic

+

Opening: June 17, 19:00
June 18 - June 26
12:00 - 17:00

+

Locations:
+ Piet Zwart Institute
Mauritsstraat 36
Rotterdam +

V2_
Eendrachtsstraat 10
Rotterdam

+ -

Date: 17 - 25 June.
- Opening: Fri. 17 June, 19:00
Location: - Piet Zwart Institute, V2_
-

@@ -81,7 +88,7 @@ -

+
@@ -97,7 +104,7 @@
-
+
@@ -113,11 +120,11 @@ - 21:00 – 22:30 at the Piet Zwart Institute
continuing until Sunday, 26 June, open in both venues Tuesday - Sunday: 12:00 - 17:00

- - +
+

Piet Zwart Institute

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.

http://www.pzwart.nl/

- +

Master Media Design & Communication

The Piet Zwart Institute Master Media Design & Communication is a 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

-
+
+

Piet Zwart Institute Master Media Design and Communication, Willem de Kooning Academy
Rotterdam University of Applied Sciences +

+