#!/usr/bin/perl /home/26774/data/bin/perlwrapper

use CGI;

my $cgi = new CGI();

my $username = $cgi->param('username');

my $artist = $cgi->param('artist') ? 'artists' : 'tags';


print $cgi->header(-status=>404) and exit unless $username =~ /^[A-Za-z0-9\-_\%]+$/ && -e "../data/svgs/$username-$artist.svg";


my $page = <<__FILE__;
<html>
<head>
<title>Wave graph showing $artist for $username</title> 
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
<script type="text/javascript"><!--
            //
                _uacct = "UA-120828-1";
                urchinTracker();
            //--></script>
</head>
<body>
<!-- Start of the TinyLine Applet declaration -->
      <!-- Here is the TinyLine Applet goes:
         code             - the main class to run
         archive          - the archive that holds the applet.
         width and height - the area occupied by the applet
         svgfile          - the name of the applet parameter
         svg/bass2.svgz   - the value of the applet parameter that says what an SVG file to load
      -->
      <applet code="com.tinyline.app.TinyLineApplet" archive="/music/jars/tinyline4web.zip" width="100%" height="100%">
         <param name="svgfile" value="/music/data/svgs/$username-$artist.svg"/>
      </applet>
			<a href="/music/data/svgs/$username-$artist.svg">Original SVG</a>
			<a href="http://www.tinyline.com/">Powered by the Tinyline applet.</a>
<!-- End of the TinyLine Applet declaration -->
</body>
</html>
__FILE__

print $cgi->header('text/html');
print $page;
exit;
