All pastes #1693871 Raw Edit

t3rmin4t0r

public text v1 · immutable
#1693871 ·published 2009-11-30 13:09 UTC
rendered paste body
import sys,re,os,math,string
import csv

slots = map(lambda x: "-".join([str(x),str(x+1)]),range(11, 20))
halls = ["H1", "H2", "H3"]
days = range(1,6)
wkdays = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
keynotes = {}
colours = {"FOSS WorkOut" : "lightcyan", "FOSS Talk (Main session)": "yellow", "FOSS Workshop": "lightpink", "FOSS Talk (Hacker session)" : "#99FFCC",
"Tech Talk (Hacker Session)" : "lightgreen", "Project of the Day" : "orange", "Keynote" : "#A8A8FF"}

potd_slots = {"2/H3" : "Fedora", "3/H3": "Kde", "4/H2" : "Maemo", "5/H3": "Gnome"}


def load_data():
	reader = csv.reader(open('talks_3.csv'), delimiter=',', quotechar='"')
	#print reader.next()
	data = {}
	potds = {}
	for row in reader:
		#print row
		if(len(row) < 12): 
			sys.stderr.write("Skipping row starting with ... %s" % str(row[:-1]))
			continue
		(id, speaker, city, country, title, type, status, done, slot, reqs, dummy, dummy, mid) = row
		if(slot[-4:] == 'POTD'):
			if not potds.has_key(slot): potds[slot] = [];
			potds[slot].append(row)
		if(slot[-7:] == 'KEYNOTE'):
			keynotes[slot[0]] = row
		if(data.has_key(slot)):
			sys.stderr.write('duplicate slot %s\n' % slot)
		data[slot] = row
	return (data,potds)

(data, potds) = load_data()

header = 0

if(header):
	print """
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>
  FOSS.IN</title>
<meta name="description" content="Technology for a Free World" />
<meta name="keywords" content="Technology for a Free World" />
<link rel="shortcut icon" type="image/ico" href="http://foss.in/wp-content/themes/wpremix3/favicon.ico" />
<link rel="stylesheet" href="http://foss.in/wp-content/themes/wpremix3/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="http://foss.in/wp-content/themes/wpremix3/css/print.css" type="text/css" media="print" />
<link rel="alternate" type="application/rss+xml" title="FOSS.IN RSS Feed" href="http://foss.in/feed" />
<link rel="alternate" type="application/atom+xml" title="FOSS.IN Atom Feed" href="http://foss.in/feed/atom" />
<link rel="pingback" href="http://foss.in/xmlrpc.php" />
<script type="text/javascript" language="javascript" src="http://foss.in/wp-content/themes/wpremix3/js/hmenu.js"> </script>
<link rel='stylesheet' id='wp-polls-css'  href='http://foss.in/wp-content/plugins/wp-polls/polls-css.css?ver=2.50' type='text/css' media='all' />
<link rel='stylesheet' id='contact-form-7-css'  href='http://foss.in/wp-content/plugins/contact-form-7/stylesheet.css?ver=2.0.6' type='text/css' media='all' />
<script type='text/javascript' src='http://foss.in/wp-includes/js/jquery/jquery.js?ver=1.3.2'></script>
<script type='text/javascript' src='http://foss.in/wp-content/themes/wpremix3/js/faq.js?ver=1'></script>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://foss.in/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://foss.in/wp-includes/wlwmanifest.xml" /> 
<link rel='index' title='FOSS.IN' href='http://foss.in' />
<meta name="generator" content="WordPress 2.8.6" />

<style type="text/css">
 .tcf_input {display:none !important; visibility:hidden !important;}
/* field names */
.contactform label { display:block; }
/* fields */
.contactform input { display:block; width:400px; border:1px blue solid; }
/* message area */
.contactform textarea { display:block; width:400px; height:200px; }
/* ok message */
.contactform_respons { display:block; color:green; font-weight:bold; border: 2px green solid; padding:10px; }
/* error message */
.contactform_error { display:block; color:red; font-weight:bold; border: 2px red solid; padding:10px; }

/* smaller widget form */
.widget .contactform { width:200px; }
.widget .contactform input { width:98%; }
.widget .contactform textarea { width:98%; height:100px; }

</style>
<style type="text/css">
.wp-polls .pollbar {
	margin: 1px;
	font-size: 6px;
	line-height: 8px;
	height: 8px;
	background-image: url('http://foss.in/wp-content/plugins/wp-polls/images/default/pollbg.gif');
	border: 1px solid #c8c8c8;
}
</style>
<link href="http://foss.in/wp-content/themes/wpremix3/style.php" rel="stylesheet" type="text/css" />
</head>
<body>

<div id="wrapper" class="clearfix">

<!--top header starts -->
<div id="header3" >
	  <div class="h_left">
          </div>
        
</div>
     
<!--header end -->

<!--Dropdown navigation -->
<div id="nav">
     <ul id="navmenu-h">
        <li class="page_item page-item-337"><a href="http://foss.in/" title="Home">Home</a></li>
<li class="page_item page-item-2"><a href="http://foss.in/about/about-foss-in" title="About">About</a>
<ul>
	<li class="page_item page-item-1027"><a href="http://foss.in/about/about-foss-in" title="About FOSS.IN">About FOSS.IN</a></li>
	<li class="page_item page-item-1085"><a href="http://foss.in/2009/stats/" title="Delegate Statistics">Delegate Statistics</a>
	<ul>
		<li class="page_item page-item-1077"><a href="http://foss.in/2009/stats/" title="FOSS.IN/2009">FOSS.IN/2009</a></li>
		<li class="page_item page-item-1080"><a href="http://foss.in/2008/stats/" title="FOSS.IN/2008">FOSS.IN/2008</a></li>
	</ul>
</li>
	<li class="page_item page-item-42"><a href="http://foss.in/about/past-speakers" title="Past Speakers">Past Speakers</a></li>
	<li class="page_item page-item-488"><a href="http://foss.in/about/team" title="Team FOSS.IN">Team FOSS.IN</a></li>
	<li class="page_item page-item-1016"><a href="http://foss.in/about/privacy-policy" title="Privacy Policy">Privacy Policy</a></li>
</ul>
</li>
<li class="page_item page-item-315"><a href="http://foss.in/2008/schedules" title="Schedules">Schedules</a>
<ul>
	<li class="page_item page-item-1034"><a href="http://foss.in/schedules/2009" title="2009">2009</a></li>
	<li class="page_item page-item-499"><a href="http://foss.in/2008/schedules" title="2008">2008</a></li>
	<li class="page_item page-item-502"><a href="http://foss.in/2007/schedules" title="2007">2007</a></li>
	<li class="page_item page-item-505"><a href="http://foss.in/2006/schedules" title="2006">2006</a></li>
	<li class="page_item page-item-509"><a href="http://foss.in/2005/schedules" title="2005">2005</a></li>
	<li class="page_item page-item-512"><a href="http://linux-bangalore.org/2004/schedules/" title="2004">2004</a></li>
	<li class="page_item page-item-515"><a href="http://linux-bangalore.org/2003/schedules/" title="2003">2003</a></li>
	<li class="page_item page-item-518"><a href="http://linux-bangalore.org/2002/schedules/" title="2002">2002</a></li>
	<li class="page_item page-item-521"><a href="http://linux-bangalore.org/2001/schedules/" title="2001">2001</a></li>
</ul>
</li>
<li class="page_item page-item-27"><a href="http://foss.in/register/delegate-registration" title="Register">Register</a>
<ul>
	<li class="page_item page-item-137"><a href="http://foss.in/register/delegate-registration" title="Delegate Registration">Delegate Registration</a></li>
	<li class="page_item page-item-1043"><a href="http://foss.in/register/expo" title="Expo Registration">Expo Registration</a>
	<ul>
		<li class="page_item page-item-140"><a href="http://foss.in/register/expo/foss-project-registration" title="FOSS Project Expo">FOSS Project Expo</a></li>
		<li class="page_item page-item-867"><a href="http://foss.in/register/expo/foss-in-expo-registration-commercial" title="Commercial Expo">Commercial Expo</a></li>
	</ul>
</li>
</ul>
</li>
<li class="page_item page-item-385"><a href="http://foss.in/promote" title="Promote">Promote</a>
<ul>
	<li class="page_item page-item-393"><a href="http://foss.in/promote/posters" title="Posters">Posters</a></li>
	<li class="page_item page-item-696"><a href="http://foss.in/promote/banners" title="Banners 2009">Banners 2009</a></li>
</ul>
</li>
<li class="page_item page-item-33"><a href="http://foss.in/sponsors" title="Sponsors">Sponsors</a>
<ul>
	<li class="page_item page-item-673"><a href="/sponsors" title="Sponsoring FOSS.IN">Sponsoring FOSS.IN</a></li>
	<li class="page_item page-item-657"><a href="http://foss.in/sponsors/sponsors-of-fossin2008" title="FOSS.IN/2008">FOSS.IN/2008</a></li>
</ul>
</li>
<li class="page_item page-item-1012"><a href="http://foss.in/info" title="Info">Info</a>
<ul>
	<li class="page_item page-item-1094"><a href="http://foss.in/info/speaker-guide" title="Speaker Guide">Speaker Guide</a></li>
	<li class="page_item page-item-110"><a href="http://foss.in/info/faq" title="FAQ">FAQ</a></li>
	<li class="page_item page-item-96"><a href="http://foss.in/info/event-history" title="Event History">Event History</a></li>
	<li class="page_item page-item-117"><a href="http://foss.in/info/corporate-delegates" title="Corporate Delegates">Corporate Delegates</a></li>
	<li class="page_item page-item-418"><a href="http://foss.in/info/workout-howto" title="WorkOut HowTo">WorkOut HowTo</a></li>
	<li class="page_item page-item-251"><a href="http://foss.in/info/delegate-guide" title="Delegate Guide">Delegate Guide</a></li>
	<li class="page_item page-item-259"><a href="http://foss.in/info/volunteer-guide" title="Volunteer Guide">Volunteer Guide</a></li>
	<li class="page_item page-item-245"><a href="http://foss.in/info/venue-guide" title="Venue Guide">Venue Guide</a></li>
	<li class="page_item page-item-241"><a href="http://foss.in/info/about-bangalore" title="About Bangalore">About Bangalore</a></li>
</ul>
</li>
<li class="page_item page-item-8"><a href="http://foss.in/contact" title="Contact">Contact</a></li>
		
      </ul>
	<div class="rss"><a href="http://foss.in/feed">RSS FEED</a></div>
</div><!--Dropdown navigation #end -->
    
<div id="content-wrap" class="clear">
<div>
"""

for d in days:
	print  """
<a name="day%d" />
<p align="left"><h2>%s, %s Dec 2009 : Main Conference</h2></p>
<table border="0" cellpadding="24px" cellspacing="0" style="border: 1px solid; border-collapse: collapse;">
  <tr>
    <th bgcolor="#A8A8FF" width="12%%" style="border: 1px solid;">Time</th>
        <th align="center" width="30%%" bgcolor="#A8A8FF" style="border: 1px solid;">Audi 1</th>
        <th align="center" width="30%%" bgcolor="#A8A8FF" style="border: 1px solid;">Audi 2</th>
        <th align="center" width="30%%" bgcolor="#A8A8FF" style="border: 1px solid;">Audi 3</th>
      </tr>
""" % (d, wkdays[d], d) 
	for s in slots:
   		print """<tr style="height: 25px;" valign="top">
		        <td align="right" valign="top" style="border: 1px solid;"><b>%s:00</b></td>""" % (s[:2])
		for h in halls:
			dh = "%s/%s" % (d,h)
			id = "%s/%s/%s" % (d, h, s)
			if (data.has_key(id)):
				row = data[id]
				(id,speaker, city, country, title, type, status, done, slot, reqs, dummy, dummy, mid) = row
				print """
	<td bgcolor="%s" style="border: 1px solid;"><a href="http://foss.in/2009/schedules/talkdetailspub.php?talkid=%s"><b><font color="black">%s</font></b></a>
          <font size="2"><i>
          <br />%s
          </i></font>
          </td>""" % (colours[type], id, title, speaker)
			elif potd_slots.has_key(dh):
				(name) = potd_slots[dh]
				if(potds.has_key("%s/POTD" % dh)):
					talks = potds["%s/POTD" % (dh)]
					speakers = string.join(map(lambda x:x[1], talks),', ')
				else:
					speakers = "to be announced"
				if(s == '11-12'):
					print """
		<td bgcolor="orange" style="border: 1px solid;" rowspan='2'> <a href='http://foss.in/2009/schedules/talkdetailspub.php?talkid=%s'><b><font color="black">%s - Project of the Day</font></b></a><br/>%s 
			          </td>""" % (name.upper(), name, speakers)
				elif(s == '14-15'):
					print """
		<td bgcolor="orange" style="border: 1px solid;" rowspan='4'><b><font color="black">%s - Project of the Day</font></b><br/>Continued 
			          </td>""" % (name)
				elif(s=='19-20' or s == '20-21'): # not PoTD anymore, so blank it
					print "<td>&nbsp;</td>"
			else:
				if(h == 'H1' and s== '13-14'):
					print "<td colspan='3' align='center' bgcolor='#' border='1px solid'><B>Lunch</b></td>"
				if(h == 'H1' and s== '18-19'):
					if keynotes.has_key(str(d)):
						(id,speaker, city, country, title, type, status, done, slot, reqs, dummy, dummy, mid) = keynotes[str(d)]
						print """
					<td colspan="3" bgcolor="%s" style="border: 1px solid;"><a href="http://foss.in/2009/schedules/talkdetailspub.php?talkid=%s"><b><font color="black">%s</font></b></a>
				          <font size="2"><i>
				          <br />%s
				          </i></font>
				          </td>""" % (colours['Keynote'], id, title, speaker)
					else: 
						print "<td>Keynote</td>"
				elif not (s == '13-14'):
					print "<td>&nbsp;</td>"
		print "</tr>"	
	print "</table>"

print """
<h2>Colour Codes</h2>
<table border="1" cellpadding="16" cellspacing="4" width="100%">
"""

ck = 0

for c in colours.keys():
	if(ck % 4) == 0: print "<tr>";
	print "<td bgcolor='%s'><b>%s</b></td>" % (colours[c], c)
	ck = ck+1
	if(ck % 4) == 0: print "</tr>";

if (ck % 4):
	while (ck % 4):
		print "<td> &nbsp; </td>"
		ck = ck + 1
	print "</tr>"
print """
</table>
"""

if(header):
	print """
</div>
<!--content-wrap end -->
</div> 

<div id="footer" class="clearfix">
  <div id="footer-in">
  
  	<p>&copy; 2009 FOSS.IN. All rights reserved. - Powered by <a href="http://wordpress.org" target="_blank">WordPress</a>
    </p>

<!--Static Links #start -->
<!-- 
  	 <ul id="flinks">
       <li><a href="http://wpremix.com" title="your link title">Static</a></li>
       <li><a href="http://premiumthemes.net" title="your link title">Links</a></li>
       <li><a href="http://wordpress.org" title="your link title">Here</a></li>
    </ul>
-->
<!--Static Links #end -->
  
    
   </div>  <!--footer-in end-->
</div><!--footer end-->
<script type='text/javascript'>
/* <![CDATA[ */
var pollsL10n = {
	ajax_url: "http://foss.in/wp-content/plugins/wp-polls/wp-polls.php",
	text_wait: "Your last request is still being processed. Please wait a while ...",
	text_valid: "Please choose a valid poll answer.",
	text_multiple: "Maximum number of choices allowed: ",
	show_loading: "1",
	show_fading: "1"
};
/* ]]> */
</script>
<script type='text/javascript' src='http://foss.in/wp-content/plugins/wp-polls/polls-js.js?ver=2.50'></script>

</body>
</html>
"""