Zomeminder Webcams 2.0

Ok, following on from my post yesterday here’s the database table part of my new scripts.

CREATE TABLE `WebCams` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(50) NULL DEFAULT NULL,
`URL` VARCHAR(200) NULL DEFAULT NULL,
`Start` TIME NULL DEFAULT NULL,
`Stop` TIME NULL DEFAULT NULL,
`Refresh` INT(5) NULL DEFAULT NULL,
`Monitor` VARCHAR(1) NULL DEFAULT NULL,
`Enabled` INT(1) NULL DEFAULT NULL,
PRIMARY KEY (`ID`) )
)

I place this under the zoneminder database itself, that way it’s all kept together.
A sample entry would be:-

INSERT INTO `WebCams` (`ID`, `Name`, `URL`, `Start`, `Stop`, `Refresh`, `Monitor`, `Enabled`) VALUES (1, 'Aberystwyth Pier', 'http://www.ceredigion.gov.uk/english/visiting/aber_webcam/img/994.jpg', '00:00:00', '23:59:59', 900, 'A', 1);

Pretty straight forward descriptions for Name, URL, Start & Stop. One thing to note is I made the script to interpret the start and stop so you can start at 10pm and finish at 2am and it will happily work (took a bit for my head to get around it though).
The Refresh column is how often it should grab a new image. I slowed the script down to run a refresh every 60 secs for a few reasons, first not to query the database constantly and 2nd as a safeguard that I can’t hammer any webcams trying to pull too often.
The Monitor I use as A,B,C this will be assigned to the name of what’s downloaded and to the rotate file that you reference in Zoneminder.
Enabled is either 0-No or 1-Yes.

That’s pretty much it. Next bit I’ll post up the actual script.

Leave a Reply

Your email address will not be published. Required fields are marked *