Commit 92d4314d authored by Neil Gershenfeld's avatar Neil Gershenfeld
Browse files

wip

parent 28037de0
......@@ -15,7 +15,7 @@ var image_width = 1280
var image_height = 1024
var thumbnail_size = 100
var compression = 50
var activity_threshold = 100
var activity_threshold = 250
//
// requires
//
......@@ -48,11 +48,14 @@ function update() {
//
var stats = fs.statSync('image.jpg')
var newsize = stats.size
console.log('old image size: '+oldsize+' new image size: '+newsize)
if (Math.abs(newsize-oldsize) > activity_threshold) {
console.log('activity detected, keep image')
execSync('convert image.jpg -resize '+thumbnail_size+'x'+thumbnail_size+' thumbnails/'+name)
execSync('mv image.jpg images/'+name)
}
else
console.log('no activity detected, delete image')
//
// rebuild index (could be done more efficiently incrementally)
//
......@@ -78,5 +81,5 @@ function update() {
//
// set one minute update interval
//
setInterval(update,60000)
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