[libimdb-commit] CVS: web generate.pl,NONE,1.1
Status: Pre-Alpha
Brought to you by:
jveldhuis
|
From: Jerry V. <jve...@us...> - 2003-06-16 03:43:44
|
Update of /cvsroot/libimdb/web In directory sc8-pr-cvs1:/tmp/cvs-serv5254 Added Files: generate.pl Log Message: initial checkin --- NEW FILE: generate.pl --- #!/usr/bin/perl -w # # $id: $ # # This may have been pretty silly down the road but I wanted to # try and make it easy to add/sub content to the web pages without # too much work. # use strict; my $header=q| <?xml version="1.0" encoding="iso-8859-1"?> <!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" xml:lang="en" lang="en"> <head> <title>LibIMDB - imdb.com plain-text interface toolbox</title> <link rel="stylesheet" type="text/css" href="inc/style.css" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="description" content="libimdb - dealing with those damn list files." /> <meta name="keywords" content="libimdb, imdb.com, plain-text, interface, cross-platform, Linux, Windows, free, software, download" /> </head> <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#000099" alink="#ff0000"> |; my $logoBar=q| <td colspan="2" class="logobar"> <a href="http://libimdb.sourceforge.net/"> <img src="inc/title.jpg" class="logo" alt="LibIMDB: dealing with those damn list files." border="0" /> </a> </td> <td> @@SOURCEFORCE_LINK@@ </td> |; my $footer=q| <hr noshade="noshade" size="1" /> <small> Please report any web page problems or glaring spelling errors to:@@WEBMASTER_EMAIL@@ </small> </body> </html> |; my $navigation=q| <div class="navigation"> <br /><strong><a href="index.html">LibIMDB Home</a></strong><br /> <a href="about.html#about">About</a><br /> <a href="http://sourceforge.net/projects/libimdb">Project Page</a><br /> <a href="download.html#download">Download</a><br /> <a href="screenshots.html#screenshots">Screenshots</a><br /> <a href="reviews.html#reviews">Reviews</a><br /> <a href="news.html#news">News</a><br /> <a href="license.html#license">License</a><br /> <br /><strong><a href="support.html#support">Support</a></strong><br /> <a href="support.html#support">Get Help</a><br /> <a href="http://sourceforge.net/mail/?group_id=@@SOURCEFORGE_GROUP_ID@@">Mailing Lists</a><br /> <a href="apidocs.html#apidocs">User's Manual</a><br /> <a href="faq.html#faq">FAQ</a><br /> <a href="http://sourceforge.net/tracker/?group_id=@@SOURCEFORGE_GROUP_ID@@&atid=544493">Report a Bug</a><br /> <a href="contribute.html#contribute">Suggest Ideas</a><br /> <br /> </div> |; my %content; $content{index}=q! <a name="index"></a> <h2>LibIMDB</h2> <p>LibIMDB is a set of tools/libraries for managing, parsing and indexing 'plain text' data files from imdb.com. We prefer to refer to these as the imdb list files or just 'list' files. First beta release will include a C library interface to parsing a couple of the list files.</p> <p>(see <a href="http://www.imdb.com/interfaces">www.imdb.com/interfaces</a>). </p> <dl> <dt><strong>Similar Projects</strong></dt> <dd>Alternative Movie Database - <a href="http://www.steffensiebert.de/amdb/">amdb</a></dd> <dd>Wim Mortier's <a href="http://home.planetinternet.be/%7Eic521102/">SyncIMDB</a></dd> <dd>Thorsten M. Wahl's <a href="http://www.amdbfront.com/">AMDbFront and JMDb</a></dd> </dt> </dl> !; $content{download}=q| <a name="downloads"></a> <h2>Downloads</h2> <p>Downloads are made available <a href="http://sourceforge.net/project/showfiles.php?group_id=@@SOURCEFORGE_GROUP_ID@@">here</a>.</p> |; $content{screenshots}=q| <a name="screenshots"></a> <h2>Screenshots</h2> <p>still working on these, but don't expect much</p> |; $content{reviews}=q| <a name="reviews"></a> <h2>Reviews</h2> <p>Ya, like someone would actually find this project useful :)</p> |; $content{about}=q| <a name="about"></a> <h2>About LibIMDB</h2> <p>Not sure what we want here yet.</p> |; $content{news}=q| <a name="news"></a> <h2>News</h2> <p>Beta release is coming...</p> |; $content{license}=q| <a name="license"></a> <h2>License</h2> <p>Instead of making this a GPL project and restricting its use in most cases making it completely useless, why don't you just let me know if you like it and buy me a beer sometime.</p> |; $content{support}=q| <a name="support"></a> <h2>Support</h2> <p>The best way to get support is to subscribe and submit a question to one of the mailing lists.</p> <p>Try looking <a href="http://sourceforge.net/mail/?group_id=@@SOURCEFORGE_GROUP_ID@@">here</a>.</p |; $content{apidocs}=q| <a name="apidocs"></a> <h2>Api Documentation</h2> <p>There will probably be a couple of api layers to use.</p> <p>coming soon...</p |; $content{faq}=q| <a name="faq"></a> <h2>Frequently Asked Questions</h2> <p>None yet.</p> |; $content{contribute}=q| <a name="contribute"></a> <h2>Contributing</h2> <p>Got an idea ? Post to one of the mailing lists and we'll listen.</p> |; sub expandVars($) { my $str=shift; my %vars; $vars{SOURCEFORGE_GROUP_ID}=q|75597|; $vars{SOURCEFORCE_LINK}=q|<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=@@SOURCEFORGE_GROUP_ID@@&type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" class="swish"/></a>|; $vars{WEBMASTER_EMAIL}=q|<a href="mailto:jve...@sf...">jve...@sf...</a>|; # substitute our magic allowable references until. # allow imbedded references by substituting imbedded variables until nothing matches my $subs=1; while ($subs != 0) { $subs=0; for my $key (keys %vars) { if ( $str=~s/\@\@$key\@\@/$vars{$key}/g ) { $subs++; } } } if ( $str=~m/(\@\@[^\s]+\@\@)/o ) { warn "variable $1 not expanded"; } return($str); } my $dest=shift; if ( !$dest || ! -d $dest ) { print STDERR "usage: $0 <dest-dir>"; print STDERR "<dest-dir> must exist"; exit(1); } if ( ! -d "inc" ) { die "directory ./inc:$!"; } if ( ! -d "$dest/inc" ) { mkdir("$dest/inc", 0777) || die "mkdir $dest/inc:$!"; } for my $file ('inc/title.jpg', 'inc/style.css') { print "copying $file..\n"; open(IFD, "< $file") || die "$file:$!"; open(OFD, "> $dest/$file") || die "$dest/$file:$!"; undef($/); while(<IFD>) { print OFD; } close(IFD); close(OFD); } for my $file (qw/index download screenshots reviews about news license support apidocs faq contribute/) { print "generating $dest/$file.html..\n"; open(FD, "> $dest/$file.html") || die "$dest/$file.html:$!"; print FD expandVars($header); print FD q|<table border="0" width="100%" cellspacing="0" cellpadding="0">|."\n"; print FD "<tr>".expandVars($logoBar)."</tr>\n"; print FD "<tr>\n"; print FD q|<td class="navbar" valign="top" bgcolor="#b0d0b0" width="150">|; print FD q| <div class="navigation">|.expandVars($navigation)."</div>\n"; print FD q| <td valign="top">|."\n"; print FD q| <div class="content">|.expandVars($content{$file})."</div>\n"; print FD " </td>\n"; print FD "</td>\n"; print FD "</tr>\n"; print FD "</table>\n"; print FD expandVars($footer); close(FD); } exit(0); |