• HTML generator

    From Neil Williams@1:2320/100 to All on Thu Aug 30 12:29:02 2001

    I have a pet ARexx project I'm working on. To liven the echo up, I'm going to share the progress with you :)

    Every time my computer dials the Internet, one of the things it does it grab some webcam images from the accommodation site I stay at in University (http://www.welcomebangor.co.uk/). One is a view of a road leading into part of
    the site, and the other is above the bar in the site's pub. This is reasonably
    easy to do, even with simple dupe checking:

    (Excuse the stupidly long repeated paths - I haven't cleaned the code up yet. In your own scripts, "call pragma 'Directory','Disk:ImageDir'" would help as would variables)


    /* Webcams: grab, date, store. */
    address command "delete quiet work:graphics/pics/Cams/Ffridd/road.tmp work:graphics/pics/Cams/Ffridd/bar.tmp"
    address command "Work:comms/HTTPResume/HTTPResume http://www.welcomebangor.co.uk/webcam/webcam.jpg work:graphics/pics/Cams/Ffridd/road.tmp attempts 1"
    address command "Work:comms/HTTPResume/HTTPResume http://www.welcomebangor.co.uk/webcam/webcam2.jpg work:graphics/pics/Cams/Ffridd/bar.tmp attempts 1"

    barsize = word( statef('work:graphics/pics/Cams/Ffridd/bar.tmp'), 2 )
    roadsize = word( statef('work:graphics/pics/Cams/Ffridd/road.tmp'), 2 )

    /* First, store Bar image
    ft = 'Bar.'|| date(S)
    fn = 'Bar.'|| date(S) ||'.0'
    do while exists( 'Work:Graphics/Pics/Cams/Ffridd/'||fn||'.jpg' )
    if word( statef( 'Work:Graphics/Pics/Cams/Ffridd/'||fn||'.jpg' ), 2 ) = barsize then do
    say '* Duplicate picture'

    fn = ft || '.' || n

    if newpic = 1 then do
    address command 'Copy work:graphics/pics/Cams/Ffridd/bar.tmp to Work:Graphics/Pics/Cams/Ffridd/'|| fn ||'.jpg CLONE'

    (Etc. for road picture).


    HTTPresume is a really useful program - it's got an excellent command line interface :)

    The script grabs at least one image every day. In each day, we compare the size
    of files we have - if two JPEGs of the same scene are the same size, they are almost certain to be the same image (out of term time, the cams aren't updated very often). I haven't worked out an easy way to compare against the images of the previous days yet.

    The result is something like this. I have two unique images from yesterday, but
    this webcam hasn't been updated yet today.

    Road.20010829.0.jpg 12574 ----rwed Yesterday 02:58:18
    Road.20010829.1.jpg 14106 ----rwed Yesterday 18:12:14
    Road.20010830.0.jpg 14106 ----rwed Today 02:58:47

    So far, so good! Every thing works automatically without problems. During term time, the problem of not having duplicate checking over more than one day shouldn't be a problem.

    The next steps in this are:

    * Move the webcam code out of my mail poll script, and instead have it launched seperately when I go online. The new script would do this:

    while online
    grab images
    store images
    delay 1 minute

    Why? The bar webcam should be updated live when the pub is open, and I'll have my computer dial up between 10pm and 11pm or some such times.

    * Build a website from the images automatically. My BBS computer is at home, I'll be in uni, and there's little point grabbing these images if I'm not going
    to do something interesting with them :)

    This is the most complex part of the task. The ARexx script must be able to build a website (a "site" not just "webpage") on its own, correctly presenting ordered tables of images, perhaps a week on a page, and an index to these subpages. It's also got to upload these files by FTP.

    To Be Continued!

    [On a political note, there had better be ARexx in OS4+.]

    Neil Williams, neil@zeusdev.co.uk - ICQ UINs: 18223711 & 116110052
    FidoNet 2:442/107.0 - Part time BBS: telnet:tkgbbs.darktech.org
    --- Zeus BBS 1.5
    # Origin: Killing^Ground . 22:00 - 08:00 . +44 [0]1978 751393 (2:442/107.0)
    * Origin: LiveWire BBS - Synchronet - LiveWireBBS.com (1:2320/100)