|
|
Line 14: |
Line 14: |
| ==2012/2013== | | ==2012/2013== |
|
| |
|
| '''First Trimester''' | | '''[[/trimester1 | First Trimester]]''' |
|
| |
|
| [[/trimester1 | Trimester Report]]
| |
|
| |
|
| ==prototype for random torrent==
| | '''[[/trimestert2 | Second Trimester]]''' |
| can be dumped into a hmtm file as a test
| |
| touch test.html
| |
| python random_torrent.py > test.html
| |
| | |
| <source lang=python>
| |
| #!/usr/bin/python
| |
| # encoding: utf-8
| |
| | |
| # NEEDS to be chmod+x read_torrent.py
| |
| | |
| import cgi #for the cgi
| |
| import cgitb; cgitb.enable()
| |
| import lxml.etree, os
| |
| from random import choice
| |
| | |
| #choose a fild from the xml folder
| |
| path = "/home/andre/Documents/PZI/torrent/xml/"
| |
| dir_files = os.listdir(path)
| |
| f = "xml/" + choice(dir_files)
| |
| #print 'file', f
| |
| #print
| |
| | |
| doc = lxml.etree.parse(f)# parse the data
| |
| #print 'lxml obj', doc #print the lxml object
| |
| #print lxml.etree.tostring(doc)# print the whole content
| |
| | |
| nodes = doc.xpath("//torrent")
| |
| | |
| t_choice = choice(nodes)
| |
| | |
| t_info = []
| |
| for children in t_choice:
| |
| p = children.text
| |
| t_info.append(p)
| |
| | |
| #print t_info
| |
| #id t_info[0]
| |
| #title
| |
| #magnet
| |
| | |
| | |
| print "Content-type: text/html"
| |
| print
| |
| print "<html><head><title>RANDOM TORRENT</title></head><body><h3>ID: %s</h3><h3>TITLE: %s</h3><h3>MAGNET: %s</h3></body></html>" % (t_info[0], t_info[1], t_info[2])
| |
| | |
| </source>
| |
| | |
| '''Second Trimester'''
| |
|
| |
|
| Thematic: [http://pzwart3.wdka.hro.nl/emo/User:Marlon Media–object] | | Thematic: [http://pzwart3.wdka.hro.nl/emo/User:Marlon Media–object] |