From 02f7c5aad9b590151139e1cb0f89a666de0764d9 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Tue, 11 Oct 2011 19:51:58 +0000 Subject: [PATCH] version 0.7.6 git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@449 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 2 +- var/mongoose/cgi-bin/browse/download.jim | 24 ++++++++---------------- var/mongoose/cgi-bin/browse/file.jim | 6 ++++++ var/mongoose/cgi-bin/opkg.jim | 1 + var/mongoose/html/lib/topbar.jim | 8 +++++++- var/mongoose/html/lib/topbar.shtml | 8 +++++++- var/mongoose/lib/ts.class | 23 +++++++++++++++++++++++ 7 files changed, 53 insertions(+), 19 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index 146be0c..cfd91f1 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 0.7.5-1 +Version: 0.7.6 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4),jim-oo,jim-pack,service-control,busybox(>=1.18.3-1),lsof,epg(>=1.0.5),hmt(>=1.0.6),ssmtp diff --git a/var/mongoose/cgi-bin/browse/download.jim b/var/mongoose/cgi-bin/browse/download.jim index 32d4eaa..81a8fcf 100755 --- a/var/mongoose/cgi-bin/browse/download.jim +++ b/var/mongoose/cgi-bin/browse/download.jim @@ -10,27 +10,19 @@ require ts.class cgi_input #cgi_dump -set file [dict get $_cgi file] +set file [cgi_get file "/media/My Video/Chuggington/Hodge_and_the_Chugnav.ts"] set rfile [file normalize $file] set ts [ts fetch $file] -set dmsfile /mnt/hd2/dms_cds.db - +# Default to just downloading the raw file. set url $file set mime "video/ts" -if {[file exists $dmsfile]} { - set db [sqlite3.open /mnt/hd2/dms_cds.db] - set muri [$db query " - select tblresource.mimetype, contenturi - from tblresource join tblmedia using (mediaid) - where localurl = '%s'" $rfile] - if {$muri != ""} { - set rec [lindex $muri 0] - set xuri [lindex $rec 3] - set mime [lindex $rec 1] - set url "http://$env(HTTP_HOST):9000/web/$xuri" - } -} + +# 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" diff --git a/var/mongoose/cgi-bin/browse/file.jim b/var/mongoose/cgi-bin/browse/file.jim index 0071290..72b7e3e 100755 --- a/var/mongoose/cgi-bin/browse/file.jim +++ b/var/mongoose/cgi-bin/browse/file.jim @@ -77,6 +77,12 @@ if {$type eq "ts"} { Size $sz +" +set dlna [$ts dlnaloc] +if {[llength $dlna]} { + puts "DLNA URL[lindex $dlna 0]" +} +puts " Flags [$ts get flags] diff --git a/var/mongoose/cgi-bin/opkg.jim b/var/mongoose/cgi-bin/opkg.jim index 4fd4edb..ff036aa 100755 --- a/var/mongoose/cgi-bin/opkg.jim +++ b/var/mongoose/cgi-bin/opkg.jim @@ -18,6 +18,7 @@ proc opkg {cmd} { #chunk_pad } close $fd + chunk "\r\n" } start_chunked diff --git a/var/mongoose/html/lib/topbar.jim b/var/mongoose/html/lib/topbar.jim index b8f43de..8088bb0 100644 --- a/var/mongoose/html/lib/topbar.jim +++ b/var/mongoose/html/lib/topbar.jim @@ -1,7 +1,7 @@ puts { -
+
@@ -19,6 +19,12 @@ puts {
+ } diff --git a/var/mongoose/html/lib/topbar.shtml b/var/mongoose/html/lib/topbar.shtml index 3e8be4a..3f95b61 100644 --- a/var/mongoose/html/lib/topbar.shtml +++ b/var/mongoose/html/lib/topbar.shtml @@ -1,6 +1,6 @@ -
+
@@ -13,5 +13,11 @@
+ diff --git a/var/mongoose/lib/ts.class b/var/mongoose/lib/ts.class index 15da24c..36b1be4 100644 --- a/var/mongoose/lib/ts.class +++ b/var/mongoose/lib/ts.class @@ -1,6 +1,8 @@ if {![exists -proc class ]} { package require oo } +set dmsfile /mnt/hd2/dms_cds.db + class ts { file "" base "" @@ -125,6 +127,27 @@ ts method settitle {newtitle} { exec /mod/bin/hmt "+settitle=${newtitle}" $file } +ts method dlnaloc {} { + set mime "video/ts" + if {![file exists $::dmsfile]} { return {} } + if {[catch {set db [sqlite3.open $::dmsfile]}]} { return {} } + set url "" + set rfile [file normalize $file] + set muri [$db query " + select tblresource.mimetype, contenturi + from tblresource join tblmedia using (mediaid) + where localurl = '%s'" $rfile] + if {$muri ne ""} { + set rec [lindex $muri 0] + set xuri [lindex $rec 3] + set mime [lindex $rec 1] + set url "http://$::env(HTTP_HOST):9000/web/$xuri" + } + $db close + + if {$url ne "" } { return [list $url $mime] } else { return {} } +} + proc {ts renamegroup} {from to} { set dir [file dirname $from] set root [file rootname $from]