WeatherNews.jl/www
gg1234 2eccd4a454 Align views column to the right 2024-04-23 07:55:36 -07:00
..
caster Identify shows that are live now 2023-09-08 23:33:12 -07:00
css Add Milligram CSS 2023-08-27 13:31:03 -07:00
ranking Add one day to max_jst 2023-09-12 03:33:22 -07:00
segment Identify shows that are live now 2023-09-08 23:33:12 -07:00
xslate Align views column to the right 2024-04-23 07:55:36 -07:00
README.md Document begin and end dates for ranking page 2023-09-12 17:36:07 -07:00
Utils.pm Bump LIVE_SEARCH_LIMIT to 22 2024-03-15 03:10:21 -07:00
WNDB.pm Add a `views` column to the schedule display 2024-04-23 02:17:18 -07:00
index.cgi Identify shows that are live now 2023-09-08 23:33:12 -07:00
vid.cgi Add unfinished video player code #5 2023-09-04 21:04:45 -07:00

README.md

/wn/

a site for querying wn.db

Designing in the context of vern.cc's CGI capabilities

  • Executable scripts anywhere under ~/public_html are run as CGI scripts.
  • If it's named index.cgi, it gets special treatment in that it's the default handler for the directory.

Layout

Header

  • Links to
    • Home
    • Casters
    • Segments
    • Rankings
  • Links to
    • git
    • SQLite Database

/wn/ Home

  • The default page should show a reverse chronological list of shows.
  • There should be a lot of rows before pagination kicks in.

/wn/caster/ List of all casters

?n=$caster

  • List of every appearance of caster n in reverse chronological order
  • Segment distribution (all time)

/wn/segment/ List of all segments

?n=$segment

  • List of every caster who has hosted the show n in reverse chronological order
  • Caster distribution (all time)

/wn/ranking/ Count appearances by caster

?begin=$date1&end=$date2

  • Count appearances by caster between the begin and end dates.

Development

Create config.pl and set appropriate values for base and database.

(
  base     => "/", # base request path for site
  database => '/path/to/wn.db'
)

In the production deployment base is "/wn/", because I didn't want the site to take over /.

Web Server

Then, while in the www directory, run a web server that can run CGI scripts.

thttpd -p 4444 -c '**.cgi'

REPL

Reply is a good Perl REPL. Assuming you've created config.pl, you can start up reply and paste the following code to bootstrap the REPL session into this project.

use DBI;
do "./Utils.pm";
do "./WNDB.pm";
my %config = do "./config.pl";
my $dbh = DBI->connect($config{database});
my ($sql, $do) = sql_fn($dbh);

I wish there were a better way to preload those variables into the REPL session, but it will do for now.

# Example: render the home page from the REPL
my @r = WNDB::schedule_default $sql;
my $html = page(schedule => { base => $config{base}, r => \@r })