nph-putpic.cgi 0100755 0047110 0047040 00000005705 06502241514 013362 0 ustar plegris fbuser #!/usr/local/bin/tclsh
###########################################################
#PUTPIC.CGI BY PIERRE-MIKAEL LEGRIS #
# #
#MUST BE USED WITH PUSH.CGI #
###########################################################
if {[info commands "unsupported0"] == "unsupported0"} {
rename unsupported0 copychannel
}
if {[info commands "copychannel"] == ""} {
proc copychannel {in out} {
fcopy $in $out
}
}
###########################
proc putpic { path } {
global copychannel bound
set in [open $path]
puts "Content-Type: image/gif"
puts "Content-Length: [file size $path]"
puts ""
fconfigure $in -translation binary
fconfigure stdout -translation binary
copychannel $in stdout
close $in
puts "\n--apa"
exec sleep 1
}
###########################
set date_list ""
proc tri_picts {} {
global date_list picta pict_path
set picts [glob $pict_path]
set picta(0) "0"
foreach pict $picts {
set pict_date [file mtime $pict]
set date_list "$date_list $pict_date"
set same_date [array get picta "$pict_date"]
if {$same_date != "" } {
set picta($pict_date) "$picta($pict_date) $pict"
} else {
set picta($pict_date) "$pict"
}
}
set date_list [lsort -integer $date_list]
}
###########################
proc seq_pict {d_deb d_fin ssleep} {
global date_list ofile picta
set previous_date 0
foreach date_value $date_list {
if {($date_value >= $d_deb) && ($date_value <= $d_fin)} {
if {$date_value != $previous_date} {
set ofile [array get picta "$date_value"]
foreach pfile [lindex $ofile 1] {
#puts "
[clock format [lindex $ofile 0]]"
#puts "$pfile"
putpic $pfile
exec sleep $ssleep
}
}
set previous_date $date_value
}
}
}
############################
proc live_pict {ssleep} {
global date_list ofile picta
set newest_date 0
set ofile ""
set newest_file ""
set loop_forever 1
while {$loop_forever} {
tri_picts
foreach date_value $date_list {
if {$date_value > $newest_date} {
set newest_date $date_value
set ofile [array get picta "$date_value"]
set ofile [lindex [lindex $ofile 1] 0]
}
}
if {$newest_file != $ofile} {
set newest_file $ofile
putpic $newest_file
}
exec sleep $ssleep
}
}
##################
puts "HTTP/1.0 200 OK"
puts "Content-type: multipart/x-mixed-replace;boundary=apa\n"
puts "\n--apa"
#puts "Content-type: text/html\n\n
"
####################
#set argv "Visite/ jpg live 1"
set path [lindex $argv 0]
set type_of_pict [lindex $argv 1]
set pict_path "$path*.$type_of_pict"
tri_picts
set type [lindex $argv 2]
set ssleep [lindex $argv 3]
if {$type == "seq"} {
set d_deb [lindex $argv 4]
set d_fin [lindex $argv 5]
seq_pict $d_deb $d_fin $ssleep
} else {
live_pict $ssleep
}
#puts "$pict_path
$type
$ssleep
$d_deb
$d_fin
"
push.cgi 0100755 0047110 0047040 00000013171 07117702731 012254 0 ustar plegris fbuser #!/usr/local/bin/tclsh
set infos { \
############################################################
# PUSH.CGI V1 WRITEN BY PIERRE-MIKAEL LEGRIS #
# IN TCL SCRIPT #
# Create animations using multipart/x-mixed-replace #
# The animation is based on the access time of files #
# This program is designed to be used with a camera that #
# Would be able to store pictures in a folder #
# #
# The program parse this folder and give 3 choices #
# 1 - View a sequence a determinate from a date to another #
# On the animation part, choose the START date #
# The STOP Date and the time to wait between pictures #
# 2 - View images when they arrive in the folder #
# If you choose the Live button you'll see the last #
# image which arrived in the folder "Images". As I'm #
# not updating images you won't see any animation ;-) #
# 3 - View a determinate picture #
# #
# push.cgi MUST be used with nph-putpic.cgi #
# #
############################################################ }
## Set the path where push.cgi can find the pictures
## Must end with "/"
set path "Images/"
## Set the type of picture to display : jpg , gif
set type_of_pict "jpg"
######## Nothing Need to be changed below this line #########
set pict_path "$path*.$type_of_pict"
set date_list ""
### The procedure that parse picts by dates ###
proc tri_picts {} {
global date_list picta pict_path
set picts [glob $pict_path]
set picta(0) "0"
foreach pict $picts {
set pict_date [file mtime $pict]
set date_list "$date_list $pict_date"
set same_date [array get picta "$pict_date"]
if {$same_date != "" } {
set picta($pict_date) "$picta($pict_date) $pict"
} else {
set picta($pict_date) "$pict"
}
}
set date_list [lsort -integer $date_list]
}
### End of tri_picts ###
### Proc which create the default web page ###
proc page_default {} {
global date_list picta
puts "See an animation
"
set previous_date 0
puts "
"
puts "Live
"
puts "
"
puts "See an Image"
set previous_date 0
foreach date_value $rev_date_list {
if {$date_value != $previous_date} {
set ofile [array get picta "$date_value"]
foreach pfile [lindex $ofile 1] {
puts "
[clock format [lindex $ofile 0]]"
puts "$pfile"
}
}
set previous_date $date_value
}
}
### End page_default
### Parse the date sent by the POST method ###
proc convert_time {time} {
set s1 [split $time "+"]
set s3 [split [lindex $s1 3] {}]
proc tcut { pos s3} {
return "[lindex $s3 $pos][lindex $s3 [incr pos]]"
}
set h_m_s "[tcut 0 $s3]:[tcut 5 $s3]:[tcut 10 $s3]"
return [clock scan "[lrange $s1 0 2] $h_m_s [lrange $s1 4 5]" ]
}
### End of convert_time
### Main part of the program ###
#### Web page header
puts "Content-type: text/html\n\n"
puts "PUSH.CGI"
puts ""
puts ""
# parse file by date
tri_picts
if {$env(REQUEST_METHOD) == "GET"} {
puts "PUSH
$infos
"
page_default
} else {
set query [read stdin $env(CONTENT_LENGTH)]
set s_query [split $query "&="]
if {[lindex [split $query "="] 0] == "debut"} {
set d_deb [convert_time [lindex $s_query 1]]
set d_fin [convert_time [lindex $s_query 3]]
set ssleep [lindex $s_query end]
if {$d_deb > $d_fin} {
puts "The starting date must be before the Ending date"
} else {
puts "SEQUENCE
"
puts "From:[clock format $d_deb]
"
puts "To:[clock format $d_fin]
"
puts ""
puts ""
puts ""
}
} else {
set ssleep [expr {[lindex $s_query 1] * 60 + [lindex $s_query 3]}]
puts "LIVE
"
puts "Checking for images every $ssleep seconds"
puts ""
puts ""
puts ""
}
puts "back"
}
puts ""
putpic.cgi 0100755 0047110 0047040 00000005732 06502241173 012600 0 ustar plegris fbuser #!/usr/local/bin/tclsh
###########################################################
#PUTPIC.CGI BY PIERRE-MIKAEL LEGRIS #
# #
#MUST BE USED WITH PUSH.CGI #
###########################################################
if {[info commands "unsupported0"] == "unsupported0"} {
rename unsupported0 copychannel
}
if {[info commands "copychannel"] == ""} {
proc copychannel {in out} {
fcopy $in $out
}
}
###########################
proc putpic { path } {
global copychannel bound
set in [open $path]
puts "Content-Type: image/gif"
puts "Content-Length: [file size $path]"
puts ""
fconfigure $in -translation binary
fconfigure stdout -translation binary
copychannel $in stdout
close $in
puts "\n--apa"
exec sleep 1
}
###########################
set date_list ""
proc tri_picts {} {
global date_list picta pict_path
set picts [glob $pict_path]
set picta(0) "0"
foreach pict $picts {
set pict_date [file mtime $pict]
set date_list "$date_list $pict_date"
set same_date [array get picta "$pict_date"]
if {$same_date != "" } {
set picta($pict_date) "$picta($pict_date) $pict"
} else {
set picta($pict_date) "$pict"
}
}
set date_list [lsort -integer $date_list]
}
###########################
proc seq_pict {d_deb d_fin ssleep} {
global date_list ofile picta
set previous_date 0
foreach date_value $date_list {
if {($date_value >= $d_deb) && ($date_value <= $d_fin)} {
if {$date_value != $previous_date} {
set ofile [array get picta "$date_value"]
foreach pfile [lindex $ofile 1] {
#puts "
[clock format [lindex $ofile 0]]"
#puts "$pfile"
putpic $pfile
exec sleep $ssleep
}
}
set previous_date $date_value
}
}
}
############################
proc live_pict {ssleep} {
global date_list ofile picta
set newest_date 0
set ofile ""
set newest_file ""
set loop_forever 1
while {$loop_forever} {
tri_picts
foreach date_value $date_list {
if {$date_value > $newest_date} {
set newest_date $date_value
set ofile [array get picta "$date_value"]
set ofile [lindex [lindex $ofile 1] 0]
}
}
if {$newest_file != $ofile} {
set newest_file $ofile
putpic $newest_file
exec sleep 5
putpic $newest_file
}
exec sleep $ssleep
}
}
##################
puts "Content-type: multipart/x-mixed-replace;boundary=apa\n"
puts "\n--apa"
#puts "Content-type: text/html\n\n"
####################
#set argv "Visite/ jpg live 1"
set path [lindex $argv 0]
set type_of_pict [lindex $argv 1]
set pict_path "$path*.$type_of_pict"
tri_picts
set type [lindex $argv 2]
set ssleep [lindex $argv 3]
if {$type == "seq"} {
set d_deb [lindex $argv 4]
set d_fin [lindex $argv 5]
seq_pict $d_deb $d_fin $ssleep
} else {
live_pict $ssleep
}
#puts "$pict_path
$type
$ssleep
$d_deb
$d_fin
"
Images/B0.jpg 0100654 0047110 0047040 00000045276 06456001473 012772 0 ustar plegris fbuser JFIF C !"$"$ C @"
} !1AQa"q2#BR$3br
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz
w !1AQaq"2B #3Rbr
$4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ? ^Bޭpǟ;Ǧz./1kjFUsrcC@q$9WV.^( T\u^4>ңDBe?78?qza'zF#Ua@>OYia@QBI+hK&/\Kq烆\Λ
|Mr=jƝ,QjH\Bv8|o~mI:_5<;j:ukOkaW#$/j$xVgO2dB W1sM,OjhiVK{J:Ԟ1j-c3 /A:ΜzHD'$9kJ'tWh߷ n_O5'FR
+xG]A1Iъ?JGr|C` ?Қ|IN8 yLUeiUNX/sS4>yw_q$`#uώ@r 5^;.%Iݴgug