add dlna stuff

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@894 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2012-04-08 23:26:38 +00:00
parent 87060ef8e2
commit 3d0152e475
7 changed files with 159 additions and 14 deletions

View File

@ -38,6 +38,7 @@ foreach file [readdir $dir] {
set syn [$ts get synopsis]
regsub -nocase -all -- {^new series\.* *} $syn "" syn
regsub -nocase -all -- {^cbeebies\. *} $syn "" syn
regsub -nocase -all -- {^brand new series - *} $syn "" syn
regsub -all -- { *[:].*$} $syn "" syn
if {[string length $syn] > 40} {
lassign [split $syn "."] v w

View File

@ -50,6 +50,20 @@ puts {
</td>
</tr>
}
if {[system model] eq "HDR"} {
puts {
<tr>
<td colspan=2 align=center>
<button id=dlna style="width: 48%">DLNA Server</button>
</td>
</tr>
}
}
puts {
<tr><td colspan=2 style="height: 10px"></td></tr>
<tr>

View File

@ -49,6 +49,11 @@ $('#channelinfo').click(function(e) {
window.location = '/cgi-bin/channel.jim';
});
$('#dlna').click(function(e) {
e.preventDefault();
window.location = '/dlna/dlna.jim';
});
$('#reboot').click(function(e) {
e.preventDefault();
if (confirm('Are you sure you wish to perform a reboot now?'))

84
var/mongoose/html/dlna/dlna.jim Executable file
View File

@ -0,0 +1,84 @@
#!/mod/bin/jimsh
package require cgi
package require sqlite3
source /mod/var/mongoose/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
header
#append dmsfile ".rr"
set vars {
object.container 0
object.item.videoItem.movie 0
object.item.imageItem.photo 0
object.item.audioItem.musicTrack 0
}
if {[file exists $dmsfile] && ![catch {set db [sqlite3.open $dmsfile]}]} {
catch {
foreach ret [$db query "
select class, count(*) from tblObject group by 1
"] {
lassign $ret x class x num
set vars($class) $num
}
}
$db close
}
if {[system param DMS_START_ON]} {
set cfgstat "Enabled"
} else {
set cfgstat "Disabled"
}
if {[system is_listening 9000]} {
set stat "Running."
set img "745_1_10_Video_2Live.png"
} else {
set stat "Not running."
set img "745_1_11_Video_1REC.png"
}
puts "
<script type=text/javascript src=script.js></script>
<fieldset class=cleft>
<legend>DLNA Server Information</legend>
<table class=keyval cellpadding=5>
<tr>
<th>Server Status</th>
<td class=va>$cfgstat - <img class=va src=/images/$img> $stat</td>
</tr><tr>
<th>Folders Indexed</th>
<td>$vars(object.container)</td>
</tr><tr>
<th>Movies Indexed</th>
<td>$vars(object.item.videoItem.movie)</td>
</tr><tr>
<th>Photos Indexed</th>
<td>$vars(object.item.imageItem.photo)</td>
</tr><tr>
<th>Music Tracks Indexed</th>
<td>$vars(object.item.audioItem.musicTrack)</td>
</tr><tr>
</table>
</fieldset>
<div class=cleft style=\"padding-top: 0.5em\">
<button id=dlnareset>Reset DLNA Database</button>
</div>
<div id=results class=\"cleft hidden blood\"
style=\"border: solid 1px #ccc; margin: 1em; padding: 1em;\">
</div>
"
footer

View File

@ -0,0 +1,27 @@
#!/mod/bin/jimsh
source /mod/var/mongoose/lib/setup
require system.class
puts "Content-Type: text/html"
puts ""
set menupath "Settings-&gt;System-&gt;Internet Setting-&gt;Content Share"
set dbpath "/mnt/hd2/dms_cds.db"
if {[system param DMS_START_ON] || [system is_listening 9000]} {
puts "To reset the DLNA Database, disable <i>Content Sharing</i>"
puts " in the Humax menus at<br>"
puts "<span class=also style=\"padding-left: 5em\">$menupath</span><br>"
puts "and click the button again."
} elseif {![file exists $dbpath]} {
puts "The DLNA Database does not exist.<br>"
puts "(already reset?)"
} else {
file delete $dbpath
puts "The DLNA Database has been reset.<br>"
puts "You can now re-enable <i>Content Sharing</i> in the Humax menus."
puts "<br>"
puts "<span class=also style=\"padding-left: 5em\">$menupath</span><br>"
}

View File

@ -0,0 +1,11 @@
$(function() {
$('button').button();
$('#dlnareset').click(function(e) {
e.preventDefault();
$('#results').empty().slideDown().load('reset.jim');
});
});

View File

@ -119,25 +119,28 @@ proc {system restartpending} {} {
close [open /tmp/.restartpending w]
}
proc {system padding} {} {
set start 0
set stop 0
proc {system param} {param {type Value}} {
if {[catch {set db [sqlite3.open /var/lib/humaxtv/setup.db]} msg]} {
return {0 0}
return 0
}
foreach l [$db query "
select itemName, itemValue
set val 0
set ret [$db query "
select item$type
from TBL_MENUCONFIG
where itemName in ('START_PADDING_TIME', 'STOP_PADDING_TIME')
"] {
lassign $l x name x val
switch $name {
"START_PADDING_TIME" { set start $val }
"STOP_PADDING_TIME" { set stop $val }
}
where itemName = '$param'
"]
if {[llength $ret] == 1} {
lassign [lindex $ret 0] x val
}
$db close
return [list $start $stop]
return $val
}
proc {system padding} {} {
return [list \
[system param START_PADDING_TIME] \
[system param STOP_PADDING_TIME] \
]
}
proc {system mkdir_p} {dir} {