Commit 985a09e6 authored by Neil Gershenfeld's avatar Neil Gershenfeld
Browse files

wip

parent e8952a96
......@@ -3,6 +3,7 @@
// shopcam activity monitor
// Neil Gershenfeld
// 10/5/17
// before running: node make_index.js
// to run: node cams.js
// uses fswebcam for screen capture
// uses convert to make thumbnails
......@@ -34,11 +35,11 @@ function update() {
// name image by month, day, hour, minute
//
var date = new Date()
var month = 1+parseInt(date.getMonth())
var day = 1+parseInt(date.getDay())
var hour = parseInt(date.getHours())
var minute = parseInt(date.getMinutes())
var name = ('0'+month).slice(-2)+'-'+('0'+day).slice(-2)+'-'+('0'+hour).slice(-2)+'-'+('0'+minute).slice(-2)+'.jpg'
var month = ('0'+(1+parseInt(date.getMonth()))).slice(-2)
var day = ('0'+(1+parseInt(date.getDay()))).slice(-2)
var hour = ('0'+date.getHours()).slice(-2)
var minute = ('0'+date.getMinutes()).slice(-2)
var name = month+'-'+day+'-'+hour+'-'+minute+'.jpg'
//
// remove prior image if it exists
//
......@@ -64,19 +65,18 @@ function update() {
// rebuild day's index
//
console.log('index')
execSync("echo '<a href=index/"+
('0'+month).slice(-2)+"-"+('0'+day).slice(-2)+".html>"+
('0'+month).slice(-2)+"-"+('0'+day).slice(-2)+
"</a>' >> newindex.html")
execSync("echo '<html><body>' > index/newindex.html")
execSync('ls images | awk \'/jpg/ { print "<a href=../images/"$1 "><img src=../thumbnails/" $1 "></a>" }\' >> index/newindex.html')
execSync("mv index/newindex.html index/"+
('0'+month).slice(-2)+"-"+('0'+day).slice(-2)+".html")
oldsize = newsize
execSync('ls images | awk \'/^'+month+'-'+day+'/ { print "<a href=../images/"$1 "><img src=../thumbnails/" $1 "></a>" }\' >> index/newindex.html')
execSync("mv index/newindex.html index/"+month+"-"+day+".html")
//
// wait for next image
//
console.log('wait for next image')
oldsize = newsize
}
//
// set one minute update interval
//
update()
setInterval(update,6000)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment