#!/bin/sh

#
# written by / copyright 2006/2007 Holger Levsen <debian@layer-acht.org>
# licenced under GPL
#

#
# WARNING: 
#
# 		this code is an ugly hack :)
#


# grab like this:
#
#dvgrab --size 0 --format qt sun1

TITLE="FOSDEM 2007, Debian Devroom, Brussels, Belgium"
DATE="24th and 25th of February 2007"

SAT[1]=Testing_migration-Luk_Claes
SAT[2]=Mole_-_Infrastructure_for_Managing_Information-Jeroen_Van_Wolffelaar
SAT[3]=Automated_Testing_of_Debian_Package-Lucas_Nussbaum
SAT[4]=Delta_Upgrades_without_rsync-Michael_Vogt+Paul_Sladen
SAT[5]=Open_Source_VoIP_with_Debian-Daniel_Pocock

SUN[1]=Formal_Dependency_Management-Berke_Durak
SUN[2]=Netconf-Martin_Krafft
SUN[3]=Secret_debian_internals-Enrico_Zini
SUN[4]=Kernel_and_d-i_in_lenny_and_beyond-Sven_Luther
SUN[5]=Running_Debian_on_Inexpensive_Network_Storage_Devices-Martin_Michlmayr
SUN[6]=Lets_port_together-Peter_De_Schrijver
SUN[7]=Automating_installations-Frans_Pop
SUN[8]=Debian-Community.org_pre-launch-Holger_Levsen

SATt[1]="Testing migration"
SATt[2]="Mole - Infrastructure for Managing Information"
SATt[3]="Automated Testing of Debian Package"
SATt[4]="Delta Upgrades without rsync"
SATt[5]="Open Source VoIP with Debian"

SUNt[1]="Formal Dependency Management"
SUNt[2]="Netconf"
SUNt[3]="Secret debian internals"
SUNt[4]="Kernel and d-i in lenny and beyond"
SUNt[5]="Running Debian on Inexpensive Network Storage Devices"
SUNt[6]="Lets port together"
SUNt[7]="Automating installations"
SUNt[8]="Debian-Community.org pre-launch"

SATa[1]="Luk Claes"
SATa[2]="Jeroen van Wolffelaar"
SATa[3]="Lucas Nussbaum"
SATa[4]="Michael Vogt and Paul Sladen"
SATa[5]="Daniel Pocock"

SUNa[1]="Berke Durak"
SUNa[2]="Martin Krafft"
SUNa[3]="Enrico Zini"
SUNa[4]="Sven Luther"
SUNa[5]="Martin Michlmayr"
SUNa[6]="Peter de Schrijver"
SUNa[7]="Frans Pop"
SUNa[8]="Holger Levsen"


FORMAT="avi"

#
# rename to better filenames
#
CDIR=`pwd`
cd ../rawdv
for i in `seq 1 ${#SAT[*]}` ; do 
	mv sat${i}.$FORMAT ${SAT[i]}.$FORMAT
done

for i in `seq 1 ${#SUN[*]}` ; do 
	mv sun${i}.$FORMAT ${SUN[i]}.$FORMAT
done
cd $CDIR

#
# create slides directories
#
mkdir -p slides
cd slides
for i in `seq 1 ${#SAT[*]}` ; do 
	mkdir -p ${SAT[i]}
done

for i in `seq 1 ${#SUN[*]}` ; do 
	mkdir -p ${SUN[i]}
done
cd $CDIR


filesize() {
  ls -lah $file 2>/dev/null| cut -d' ' -f6 
}

cat > index.html << EOF
<html>
<head><title>$TITLE</title></head>
<body>
<div align="center"><h1>$TITLE</h1><h2>$DATE</h2></div>
<p>
<i>ToDo: netconf and formal dependency management talks not available as ogg theora, publish xvids like they are now?, publish mpeg1 files, collect all slides, create dvd...</i>
</p>
<p>
The videos are licenced under this <a href="http://meetings-archive.debian.net/pub/debian-meetings/LICENCE">licence</a>, the licence for the slides is included in the slides themselves.
<br />
<h2>Saturday</h2>
<table border="1">

EOF

{
echo "<tr><th>Title</th><th>Author</th><th>low quality</th><th>good quality</th><th>Slides</th></tr>"
for i in `seq 1 ${#SAT[*]}` ; do 
	echo "  <tr><td>${SATt[i]}</td><td>${SATa[i]}</td>"
	file=ogg_theora/360x288/${SAT[i]}.ogg
	echo "    <td><a href=\"$file\">ogg theora "
	filesize
	echo "</a></td>"
	file=ogg_theora/720x576/${SAT[i]}.ogg
	echo "    <td><a href=\"$file\">ogg theora "
	filesize
#	echo ")</td>"
#	file=mpeg/360x288/${SAT[i]}.mpeg
#	echo "    <td><a href=\"$file\">mpeg</a> (low quality,"
#	filesize
#	echo ")</td>"
#	file=mpeg/720x576/${SAT[i]}.mpeg
#	echo "    <td><a href=\"$file\">mpeg</a> (good quality,"
#	filesize
	echo "</a>, "
	file=xvid/${SAT[i]}_xvid.avi
	echo "    <a href=\"$file\">xvid "
	filesize
	echo "</a></td><td>"
	slides=slides/${SAT[i]}/
	if [ `ls $slides|wc -l` != "0" ] ; then 
		echo "<a href=\"$slides\">download</a></td>"
	else 
		echo "not available"
	fi
	echo "  </tr>"
done
echo "</table><h2>Sunday</h2><table border=\"1\">"
echo "<tr><th>Title</th><th>Author</th><th>low quality</th><th>good quality</th><th>Slides</th></tr>"
for i in `seq 1 ${#SUN[*]}` ; do 
	echo "  <tr><td>${SUNt[i]}</td><td>${SUNa[i]}</td>"
	file=ogg_theora/360x288/${SUN[i]}.ogg
	echo "    <td><a href=\"$file\">ogg theora "
	filesize
	echo "</a></td>"
	file=ogg_theora/720x576/${SUN[i]}.ogg
	echo "    <td><a href=\"$file\">ogg theora "
	filesize
#	echo ")</td>"
#	file=mpeg/360x288/${SUN[i]}.mpeg
#	echo "    <td><a href=\"$file\">mpeg</a> (low quality,"
#	filesize
#	echo ")</td>"
#	file=mpeg/720x576/${SUN[i]}.mpeg
#	echo "    <td><a href=\"$file\">mpeg</a> (good quality,"
#	filesize
	echo "</a>, "
	file=xvid/${SUN[i]}_xvid.avi
	echo "    <a href=\"$file\">xvid "
	filesize
	echo "</a></td><td>"
	slides=slides/${SUN[i]}/
	if [ `ls $slides|wc -l` != "0" ] ; then 
		echo "<a href=\"$slides\">download</a></td>"
	else 
		echo "not available"
	fi
	echo "  </tr>"
done
} >> index.html

cat >> index.html << EOF
</table>
<!-- p><div align="center"><img src="image.jpg" border="0" /></div></p -->
<p><a href="scripts/">Scripts</a> to encode the videos and create this page.</p>
</body>
</html>
EOF

