webif/var/mongoose/cgi-bin/browse/download.jim
hummypkg 02f7c5aad9 version 0.7.6
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@449 2a923420-c742-0410-a762-8d5b09965624
2011-10-11 19:51:58 +00:00

42 lines
1005 B
Plaintext
Executable File

#!/mod/bin/jimsh
package require cgi
package require sqlite3
source /mod/var/mongoose/lib/setup
require ts.class
#puts "Content-Type: text/plain\r\n\r\n"
cgi_input
#cgi_dump
set file [cgi_get file "/media/My Video/Chuggington/Hodge_and_the_Chugnav.ts"]
set rfile [file normalize $file]
set ts [ts fetch $file]
# Default to just downloading the raw file.
set url $file
set mime "video/ts"
# Unless the DLNA option is available.
set dlna [$ts dlnaloc]
if {[llength $dlna]} { lassign $dlna url mime }
puts "DLNA: $dlna"
puts "Content-Type: text/plain"
puts "Refresh: 0; url=$url"
puts "Content-length: 0"
puts ""
#puts "Pragma: public"
#puts "Expires: 0"
#puts "Cache-Control: must-revalidate, post-check=0, pre-check=0"
#puts "Content-Type: application/force-download"
#puts "Content-Type: application/download"
#puts "Content-Type: $mime"
#puts "Content-Disposition: attachment; filename=\"[file tail $file]\""
#puts "Content-Transfer-Encoding: binary"
#puts "Content-Length: [file size $rfile]"