Difference between revisions of "Webcam"
From Baltimore Node Wiki
Jump to navigationJump to searchm |
|||
Line 9: | Line 9: | ||
backup_images.sh : | backup_images.sh : | ||
− | <pre | + | <pre> |
#!/bin/sh | #!/bin/sh | ||
Line 23: | Line 23: | ||
fi | fi | ||
− | + | </pre> | |
makeimagepage.rb: | makeimagepage.rb: | ||
− | <pre | + | <pre> |
#!/usr/bin/env ruby | #!/usr/bin/env ruby | ||
Line 44: | Line 44: | ||
end | end | ||
puts "Linked to: \n* #{out.join("\n")}" | puts "Linked to: \n* #{out.join("\n")}" | ||
− | + | </pre> | |
The directory <code>/home/bnode/baltimorenode.org/public/images/webcam-backup</code> is symbolically linked to <code>/home/bnode/webcam-backup</code>. | The directory <code>/home/bnode/baltimorenode.org/public/images/webcam-backup</code> is symbolically linked to <code>/home/bnode/webcam-backup</code>. |
Revision as of 15:03, 26 August 2009
Phase 1
Phase 2
backup_images.sh :
#!/bin/sh OLDFILE=`md5sum /home/bnode/webcam-backup/$(ls /home/bnode/webcam-backup | tail -n1) | cut -d ' ' -f1` NEWFILE=`md5sum /home/bnode/baltimorenode.org/public/images/webcam.jpg | cut -d ' ' -f1` if [ "$OLDFILE" == "$NEWFILE" ]; then echo "Still the same" else echo "NEW!" cp /home/bnode/baltimorenode.org/public/images/webcam.jpg /home/bnode/webcam-backup/webcam-$(date +%Y%m%d%H%M%S).jpg fi
makeimagepage.rb:
#!/usr/bin/env ruby `touch /home/bnode/baltimorenode.org/public/webcam.html` out = [] File.open("/home/bnode/baltimorenode.org/public/webcam.html", 'w') do |f| f.write("<html><head></head><body>") f.write("<img src='images/webcam.jpg'><br><br>") f.write("<ul><li>") Dir.entries("/home/bnode/webcam-backup").sort.each do |e| next if ['.', '..'].include? e out << "<a href='images/webcam-backup/#{e}'>#{e}</a>" end f.write out.join('</li><li>') f.write("</li></ul></body></html>") end puts "Linked to: \n* #{out.join("\n")}"
The directory /home/bnode/baltimorenode.org/public/images/webcam-backup
is symbolically linked to /home/bnode/webcam-backup
.
Phase 3
Write a Flex/Flash based image browser / replay tool.