scheduling updates

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@267 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2011-07-12 18:57:30 +00:00
parent b1176d9f64
commit 7643a92550
17 changed files with 136 additions and 98 deletions

View File

@ -1,23 +1,48 @@
#!/mod/bin/jimsh
package require cgi
package require sqlite3
source /mod/var/mongoose/lib/setup
require altrow
puts "Content-Type: text/html"
puts ""
header
cgi_input
#cgi_dump
set ftab [cgi_get tab]
set fdb [cgi_get db]
if {$fdb != 0} {
puts "<h1><a href=/cgi-bin/db.jim>Remove filters</a></h1>"
}
proc db_info {db_file} {
global _cgi fdb ftab
if {$fdb != 0 && [file tail $db_file] ne $fdb} { return }
if {![file exists $db_file]} { return }
set db [sqlite3.open $db_file]
set tables [$db query {SELECT name FROM sqlite_master WHERE type='table' ORDER BY name}]
puts "<h1>$db_file</h1>"
set tables [$db query {
select name from sqlite_master
where type='table' order by name
}]
puts "<h1><a href=/cgi-bin/db.jim?db=[file tail $db_file]>
$db_file</a></h1>"
foreach table $tables {
set table_name [lindex $table 1]
set columns [$db query "pragma table_info($table_name)"]
set datas [$db query "SELECT * FROM $table_name"]
set table [lindex $table 1]
if {$ftab != 0 && $ftab ne $table} { continue }
set columns [$db query "pragma table_info($table)"]
set datas [$db query "SELECT * FROM $table order by 1"]
puts "<h2>$table_name</h2>"
puts "<table>"
puts "<h2><a href=/cgi-bin/db.jim?db=[file tail $db_file]&tab=$table>$table</a></h2>"
puts "<table class=borders>"
puts " <tr>"
foreach column $columns {
puts " <th>[lindex $column 3]</th>"
@ -37,9 +62,10 @@ proc db_info {db_file} {
$db close
}
puts {<style type="text/css">table, td, th {border-collapse:collapse; border:1px solid black;}</style>}
db_info /var/lib/humaxtv/rsv.db
db_info /var/lib/humaxtv/setup.db
db_info /var/lib/humaxtv/channel.db
#db_info /mnt/hd2/dms_cds.db
db_info /mnt/hd2/dms_cds.db
footer

View File

@ -10,9 +10,9 @@ puts ""
cgi_input
#cgi_dump
#set _cgi(service) 4351
#set _cgi(event) 41795
#set _cgi(type) 1
#set _cgi(service) 4170
#set _cgi(event) 38584
#set _cgi(type) 2
if {![dict exists $_cgi service] || ![dict exists $_cgi event]} {
puts "Error, insufficient parameters passed."
@ -30,7 +30,8 @@ if {$event eq ""} {
exit
}
if {[$event percent] > 0} {
puts "Error, cannot record programme which has already started showing."
puts "Error, cannot record programme which has already started showing"
puts "or occurred in the past."
exit
}
@ -46,27 +47,36 @@ set args(usevtid) [$event get event_id]
set args(szevtname) "\025[$event get name]"
set args(eReady) 30
set ccrid [$event get channel_crid]
if {$type == 1} {
# Event
set args(ucCRIDType) 49
set args(ucRecKind) 1
set args(szCRID) "[$event get channel_crid][$event get event_crid]"
set args(ucCRIDType) 49
set args(ucRecKind) 1
set args(szCRID) "$ccrid[$event get event_crid]"
set args(szEventToRecord) "1$args(szCRID)|"
} else {
# Series
set args(ucCRIDType) 50
set args(ucRecKind) 4
set args(szCRID) "[$event get channel_crid][$event get series_crid]"
set args(ucCRIDType) 50
set args(ucRecKind) 4
set args(szCRID) "$ccrid[$event get series_crid]"
set args(szFPBRecPath) "$args(szevtname)"
set progs [lmap i [epg fetch dump -scrid [$event get series_crid]] {
if {[set ecrid [$i get event_crid]] eq ""} { continue }
list "1$::ccrid$ecrid"
}]
set args(szEventToRecord) "[join $progs "|"]|"
}
#puts $args
set msg ""
#set msg "Testing"
if {![file exists /mod/.schedule.testing]} { set msg "Disabled during testing" }
if {$msg ne "" || [catch {[rsv new $args] insert} msg]} {
puts "Error encountered while scheduling the recording: <i>$msg</i>"
} else {
puts "Successfully scheduled recording of <i>[$event get name]</i>"
#close [open /tmp/.restartpending w]
close [open /tmp/.restartpending w]
}
epg cleanup

View File

@ -3,6 +3,7 @@
puts "Content-Type: text/html"
puts ""
puts [exec /etc/init.d/S90settop restart]
file delete /tmp/.restartpending
#puts [exec /etc/init.d/S90settop restart]
#file delete /tmp/.restartpending
puts [exec killall humaxtv]

View File

@ -0,0 +1,13 @@
#!/mod/bin/jimsh
set url "http://$env(HTTP_HOST):9091/"
puts "Content-Type: text/html
Location: $url
<meta http-equiv=refresh content=\"0; url=$url\">
Transmission is available <a href=$url>here</a>
"

View File

@ -1,4 +0,0 @@
<!--#include virtual="/lib/header.shtml" -->
<!--#exec cmd="/mod/var/mongoose/include/db.jim" -->
<!--#include virtual="/lib/footer.shtml" -->

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -106,11 +106,12 @@ $(document).ready(function() {
<div style="clear: both">
<!--#exec cmd="/mod/var/mongoose/include/mediatomb.jim" -->
<!--#exec cmd="/mod/var/mongoose/include/transmission.jim" -->
</div>
<div class=footer>
<ul>
<li>
<a href=/db.shtml target=_blank>SQLite3 Database Dump</a>
<a href=/cgi-bin/db.jim target=_blank>SQLite3 Database Dump</a>
</li><li>
<a href=/jim/ref.html target=_blank>Jim Reference Manual</a> |
<a href=/jim/oo.html target=_blank>OO</a> |

View File

@ -16,7 +16,9 @@ puts {
}
source /mod/var/mongoose/html/lib/topbar.jim
puts "<div id=restart_block>"
source /mod/var/mongoose/include/restart.jim
puts "</div>"
puts {
<div style="clear: both">

View File

@ -12,7 +12,9 @@
<body>
<!--#include virtual="/lib/topbar.shtml" -->
<div id=restart_block>
<!--#exec cmd="/mod/var/mongoose/include/restart.jim" -->
</div>
<div style="clear: both">

View File

@ -39,7 +39,7 @@ Update package list from Internet
<div id=dialogue style="display: none; align: center">
<pre id=dresults></pre>
<div id=dspinner><img src=/img/loading.gif>Processing request...</div>
<div id=dspinner><img border=0 src=/img/loading.gif>Processing request...</div>
</div>
<script type=text/javascript>
@ -49,7 +49,11 @@ var opkg = '/cgi-bin/opkg.jim?cmd=';
$(document).ready(function() {
$('#opkgupdate').button().show('slow');
$('#pkgtabs').tabs({load: setup_buttons});
$('#pkgtabs').tabs({
load: setup_buttons,
spinner: '<img border=0 src=/img/loading.gif> ' +
'<em>Loading...</em>'
});
var $dialog = $('#dialogue').dialog({
title: "Package Management Results",

View File

@ -7,7 +7,6 @@ puts {
<script type=text/javascript src=/cgi-bin/backup/backup.js></script>
<h2>Backup/Restore</h2>
<div id=restart_block></div>
<div id=restore_warning class="hidden warningbox">
<center>
<b>!!!!!!!!!!!!!! PLEASE NOTE !!!!!!!!!!!!!!

View File

@ -1,45 +0,0 @@
#!/mod/bin/jimsh
package require sqlite3
source /mod/var/mongoose/lib/setup
require altrow
proc db_info {db_file} {
if {![file exists $db_file]} { return }
set db [sqlite3.open $db_file]
set tables [$db query {SELECT name FROM sqlite_master WHERE type='table' ORDER BY name}]
puts "<h1>$db_file</h1>"
foreach table $tables {
set table_name [lindex $table 1]
set columns [$db query "pragma table_info($table_name)"]
set datas [$db query "SELECT * FROM $table_name"]
puts "<h2>$table_name</h2>"
puts "<table>"
puts " <tr>"
foreach column $columns {
puts " <th>[lindex $column 3]</th>"
}
puts " </tr>"
foreach data $datas {
altrow
for {set i 1} {$i < [llength $data]} {incr i 2} {
puts " <td>[lindex $data $i]</td>"
}
puts " </tr>"
}
puts "</table>"
}
$db close
}
puts {<style type="text/css">table, td, th {border-collapse:collapse; border:1px solid black;}</style>}
db_info /var/lib/humaxtv/rsv.db
db_info /var/lib/humaxtv/setup.db
db_info /var/lib/humaxtv/channel.db
#db_info /mnt/hd2/dms_cds.db

View File

@ -12,7 +12,7 @@ puts "
<div style=\"float: left; padding-top: 5em\">
<center>
<a href=$url>
<img src=/img/mediatomb.png width=180>
<img border=0 src=/img/mediatomb.png width=180>
</a>
<br>
<a href=$url>

View File

@ -7,7 +7,7 @@ puts {
<div style="width: 60%; height: 0.7em;
background: url(/img/stripes.gif) repeat-x;"></div>
<div style="font-size: 1.2em; width: 60%; text-align: center; padding: 0.5em">
A warm restart is required in order to complete a scheduling operation.
A restart is required in order to complete a scheduling operation.
<br>
<font class=blood>
}

View File

@ -125,14 +125,24 @@ foreach event $events {
puts "</a>"
}
puts "</td>"
if {[$event get aulEventToRecordInfo] != ""} {
puts "<td>*</td>"
}
puts "</tr>"
}
puts "</table>"
puts "<font class=footnote>Click on the CRID to view episodes.</font>"
puts {
<small>
<button onclick="window.location='/backup.shtml';">
Backup/Restore Scheduled Recordings/Events.
Backup/Restore Scheduled Recordings/Events
</button>
<button onclick="window.location='/cgi-bin/db.jim?db=rsv.db&tab=TBL_RESERVATION';">
Raw database view
</button>
<script type=text/javascript>
$('button').button();
</script>
}

View File

@ -0,0 +1,21 @@
#!/mod/bin/jimsh
if {![file exists /mod/sbin/transmission-daemon]} { exit 0 }
set url "/cgi-bin/transmission.jim"
puts "
<div style=\"float: left; padding-top: 5em\">
<center>
<a href=$url>
<img border=0 src=/img/transmission.png>
</a>
<br>
<a href=$url>
<b>Transmission</b>
</a>
<br>
</center>
</div>
"

View File

@ -2,30 +2,28 @@ puts {
<div id=dialogue></div>
<script type=text/javascript>
$(document).ready(function() {
function doschedule(type)
{
$('#epginfo_extra').load('/cgi-bin/epg_schedule.jim?' +
'service=' +
encodeURIComponent($('#dialogue').attr('xs')) +
'&event=' +
encodeURIComponent($('#dialogue').attr('xe')) +
'&type=' + type, function() {
$('#restart_block')
.load('/cgi-bin/restartblock.jim');
});
$(":button:contains('Record')").fadeOut('slow');
}
var $buttons1 = {
"Close" : function() {$(this).dialog('close');}
};
var $buttons2 = $.extend(
{"Record Programme" : function() {
$('#epginfo_extra').load('/cgi-bin/epg_schedule.jim?' +
'service=' +
encodeURIComponent($('#dialogue').attr('xs')) +
'&event=' +
encodeURIComponent($('#dialogue').attr('xe')) +
'&type=1');
$(":button:contains('Record')").fadeOut('slow');
}},
{"Record Programme": function() { doschedule(1) }},
$buttons1);
var $buttons3 = $.extend(
{"Record Series" : function() {
$('#epginfo_extra').load('/cgi-bin/epg_schedule.jim?' +
'service=' +
encodeURIComponent($('#dialogue').attr('xs')) +
'&event=' +
encodeURIComponent($('#dialogue').attr('xe')) +
'&type=2');
$(":button:contains('Record')").fadeOut('slow');
}},
{"Record Series": function() { doschedule(2) }},
$buttons2);
var $dialog = $('#dialogue').dialog({