User:Marlon: Difference between revisions
No edit summary |
Andre Castro (talk | contribs) No edit summary |
||
Line 18: | Line 18: | ||
[[/trimester1 | Trimester Report]] | [[/trimester1 | Trimester Report]] | ||
<source lang=python> | |||
#!/usr/bin/env 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''' | '''Second Trimester''' |
Revision as of 17:13, 18 March 2013
(^○^)オ(^▽^)ハ(^0^)ツ〜!!
while (marlon = happy) {
menno = happy
}
2012/2013
First Trimester
#!/usr/bin/env 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])
Second Trimester
Thematic: Media–object
Reading, Writing & Research Methodologies
Trim I Project descriptions / Annotations / Poster
Trim II Cultural Hegemony