1
0
Fork 0
WeatherNews.jl/www
gg1234 42bc8e9591 Change header back to "Last Appearance" 2024-05-26 09:38:44 -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 Change header back to "Last Appearance" 2024-05-26 09:38:44 -07:00
README.md Document begin and end dates for ranking page 2023-09-12 17:36:07 -07:00
Utils.pm Add links for popout youtube chat for mpv/vlc users 2024-05-24 17:50:53 -04:00
WNDB.pm Append time zone to be consistent with other datetimes on site 2024-05-25 12:28:38 -07:00
index.cgi Let index.cgi pull in latest appearances 2024-05-24 17:52:50 -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 })