diff --git a/var/mongoose/cgi-bin/backup/backup.js b/var/mongoose/cgi-bin/backup/backup.js
index be7b6d5..906bd44 100755
--- a/var/mongoose/cgi-bin/backup/backup.js
+++ b/var/mongoose/cgi-bin/backup/backup.js
@@ -48,8 +48,9 @@ $(document).ready(function() {
$('#results').slideDown(function() {
$('#restore_working').slideUp();
refresh_files();
- alert('!!!!!!!!!!!!!! PLEASE NOTE !!!!!!!!!!!!!!\n\nAfter a restore you must restart the box using the link at the top of the screen or via the remote control and then add at least one scheduled entry using the remote control (which you can then delete).');
- window.location.reload(true);
+ $('#restore_warning').slideDown();
+ $('#restart_block').load(
+ '/cgi-bin/restartblock.jim');
});
});
}
diff --git a/var/mongoose/cgi-bin/backup/restore.jim b/var/mongoose/cgi-bin/backup/restore.jim
index 3a0bbe3..e87b021 100755
--- a/var/mongoose/cgi-bin/backup/restore.jim
+++ b/var/mongoose/cgi-bin/backup/restore.jim
@@ -99,6 +99,7 @@ foreach line $data {
puts "Restoring favourite channels..."
$rsvdb query {delete from channel.TBL_FAV}
+set grp 0
foreach line $data {
set vals [split $line "\t"]
if {[lindex $vals 0] ne "fav"} { continue }
@@ -108,6 +109,11 @@ foreach line $data {
set chan [lindex $vals 3]
set hsvc [findhsvc $chan]
+ if {$grp != $group} {
+ set grp $group
+ puts " Group $grp"
+ }
+
puts " $chan"
if {!$hsvc} {
diff --git a/var/mongoose/cgi-bin/browse.jim b/var/mongoose/cgi-bin/browse.jim
index e9d3372..95b9d05 100755
--- a/var/mongoose/cgi-bin/browse.jim
+++ b/var/mongoose/cgi-bin/browse.jim
@@ -46,15 +46,11 @@ proc entry {file} {{i 0}} {
if {$ext eq ".ts" && [file exists "${base}.nts"]} {
set type ts
set ts [ts fetch $file 1]
- set img 741_1_10_Video_Title.png
- set pad 0
- set newpad "top: -6; left: 4;"
+ set img Video_TS
} else {
set type gen
set ts 0
- set img 743_4_10_Video_Xvid_File.png
- set pad "2"
- set newpad "top: -2; left: 2;"
+ set img Video_Other
}
puts "
@@ -69,26 +65,9 @@ proc entry {file} {{i 0}} {
if {![file exists "[file rootname $file].hmi"]} { set new 1 }
}
- if {$new} {
- # Overlay the new image over the media one.
- puts "
-
-
-
-
- "
- } else {
- puts "
-
- "
- }
+ if {$new} { append img _New }
+
+ puts ""
puts "
$bfile
@@ -101,11 +80,15 @@ proc entry {file} {{i 0}} {
# Icons
set locked 0
+ set encd 0
+ set def unknown
if {$type eq "ts"} {
# HD / SD
if {[$ts get definition] eq "HD"} {
+ set def HD
set img "172_1_00_HD"
} else {
+ set def SD
set img "172_1_26_SD"
}
puts ""
@@ -119,6 +102,7 @@ proc entry {file} {{i 0}} {
# Encrypted
if {[$ts flag "Encrypted"] > 0} {
+ set encd 1
puts ""
@@ -137,7 +121,7 @@ proc entry {file} {{i 0}} {
puts "
diff --git a/var/mongoose/cgi-bin/browse/browse.js b/var/mongoose/cgi-bin/browse/browse.js
index 1977de0..e0c0461 100755
--- a/var/mongoose/cgi-bin/browse/browse.js
+++ b/var/mongoose/cgi-bin/browse/browse.js
@@ -69,6 +69,18 @@ function lock_callback(file, type, id)
$.get(url, function() { window.location.reload(true); });
}
+function enc_callback(file, type, id)
+{
+ var url = '/cgi-bin/browse/enc.jim?file=' + encodeURIComponent(file);
+ $.get(url, function() { window.location.reload(true); });
+}
+
+function new_callback(file, type, id)
+{
+ var url = '/cgi-bin/browse/new.jim?file=' + encodeURIComponent(file);
+ $.get(url, function() { window.location.reload(true); });
+}
+
function rename_submit()
{
var s = $('#renameform_form').serialize();
@@ -98,6 +110,26 @@ function preparemenu(el, menu)
{
if (el.attr('type') == 'ts')
{
+ if (el.attr('def') == 'HD')
+ {
+ $('#optmenu').enableContextMenuItems('#enc');
+ if (el.attr('encd') == 1)
+ $(menu).changeContextMenuItem('#enc',
+ 'Remove ENC');
+ else
+ $(menu).changeContextMenuItem('#enc',
+ 'Set ENC');
+ }
+ else
+ $('#optmenu').disableContextMenuItems('#enc');
+
+ $('#optmenu').enableContextMenuItems('#new');
+ if (el.attr('new') == 1)
+ $(menu).changeContextMenuItem('#new', 'Mark watched');
+ else
+ $(menu).changeContextMenuItem('#new', 'Mark new');
+
+
$('#optmenu').enableContextMenuItems('#lock');
if (el.attr('locked') == 1)
{
@@ -114,7 +146,10 @@ function preparemenu(el, menu)
{
$('#optmenu').enableContextMenuItems('#delete');
$('#optmenu').disableContextMenuItems('#lock');
+ $('#optmenu').disableContextMenuItems('#enc');
+ $('#optmenu').disableContextMenuItems('#new');
}
+
}
@@ -139,6 +174,16 @@ var menuclick = function(action, el, pos)
file, type, id);
break;
+ case 'enc':
+ confirm_action('change the ENC flag on', enc_callback,
+ file, type, id);
+ break;
+
+ case 'new':
+ confirm_action('change the New flag on', new_callback,
+ file, type, id);
+ break;
+
case 'rename':
$('#rename').val(bfile);
$('#renameorig').val(file);
diff --git a/var/mongoose/cgi-bin/browse/enc.jim b/var/mongoose/cgi-bin/browse/enc.jim
new file mode 100755
index 0000000..a1f4ea6
--- /dev/null
+++ b/var/mongoose/cgi-bin/browse/enc.jim
@@ -0,0 +1,27 @@
+#!/mod/bin/jimsh
+
+package require cgi
+source /mod/var/mongoose/lib/ts.class
+
+puts "Content-Type: text/html"
+puts ""
+
+cgi_input
+#cgi_dump
+
+#set _cgi(file) "/media/My Video/The Walking Dead/The Walking Dead S01E06.ts"
+
+set file [dict get $_cgi file]
+set ts [ts fetch $file]
+if {[set ts [ts fetch $file]] != 0} {
+ set action enc
+ if {[$ts flag "Encrypted"]} { set action unenc }
+
+ if {[$ts $action]} {
+ puts "Successfully [set action]ed $file."
+ } else {
+ puts "Problem [set action]ing $file,
+ [$ts get error]"
+ }
+}
+
diff --git a/var/mongoose/cgi-bin/browse/new.jim b/var/mongoose/cgi-bin/browse/new.jim
new file mode 100755
index 0000000..4496009
--- /dev/null
+++ b/var/mongoose/cgi-bin/browse/new.jim
@@ -0,0 +1,27 @@
+#!/mod/bin/jimsh
+
+package require cgi
+source /mod/var/mongoose/lib/ts.class
+
+puts "Content-Type: text/html"
+puts ""
+
+cgi_input
+#cgi_dump
+
+#set _cgi(file) "/media/My Video/The Walking Dead/The Walking Dead S01E06.ts"
+
+set file [dict get $_cgi file]
+set ts [ts fetch $file]
+if {[set ts [ts fetch $file]] != 0} {
+ set action new
+ if {[$ts flag "New"]} { set action watched }
+
+ if {[$ts set_$action]} {
+ puts "Successfully marked $file as $action."
+ } else {
+ puts "Problem marking $file as $action,
+ [$ts get error]"
+ }
+}
+
diff --git a/var/mongoose/cgi-bin/restart.jim b/var/mongoose/cgi-bin/restart.jim
new file mode 100755
index 0000000..8f2fd37
--- /dev/null
+++ b/var/mongoose/cgi-bin/restart.jim
@@ -0,0 +1,8 @@
+#!/mod/bin/jimsh
+
+puts "Content-Type: text/html"
+puts ""
+
+puts [exec /etc/init.d/S90settop restart]
+file delete /tmp/.restartpending
+
diff --git a/var/mongoose/cgi-bin/restartblock.jim b/var/mongoose/cgi-bin/restartblock.jim
new file mode 100755
index 0000000..3d3b1df
--- /dev/null
+++ b/var/mongoose/cgi-bin/restartblock.jim
@@ -0,0 +1,7 @@
+#!/mod/bin/jimsh
+
+puts "Content-Type: text/html"
+puts ""
+
+source /mod/var/mongoose/include/restart.jim
+
diff --git a/var/mongoose/cgi-bin/settings.jim b/var/mongoose/cgi-bin/settings.jim
index 2f30fac..3cf857d 100755
--- a/var/mongoose/cgi-bin/settings.jim
+++ b/var/mongoose/cgi-bin/settings.jim
@@ -56,9 +56,6 @@ header
puts {}
puts {
-
Backup/Restore
+
+
+
+!!!!!!!!!!!!!! PLEASE NOTE !!!!!!!!!!!!!!
+
+After restoring the scheduled recordings you MUST restart the box using
+the link at the top of the screen or via the remote control and then add
+at least one scheduled entry using the remote control
+(which you can then delete).
+
+
To create a backup of your current favourite channel configuration and
diff --git a/var/mongoose/include/restart.jim b/var/mongoose/include/restart.jim
index 76d4b68..61cd171 100755
--- a/var/mongoose/include/restart.jim
+++ b/var/mongoose/include/restart.jim
@@ -1,16 +1,52 @@
#!/mod/bin/jimsh
-if {![file exists /tmp/.restartpending]} { exit }
+if {[file exists /tmp/.restartpending]} {
puts {
-
-
- A restart is required in order to complete a scheduling operation.
-
-
-
+
+ A warm restart is required in order to complete a scheduling operation.
+
+
+}
+
+# Is humaxtv doing anything?
+set pid [exec pgrep humaxtv]
+set c 0
+catch { set c [exec /mod/bin/lsof -p $pid | grep Video | fgrep .ts | wc -l] }
+
+if {$c > 0} {
+ puts "Cannot restart whilst box is busy."
+} else {
+ puts {
+ Restart via the remote control or
+
+ }
+}
+
+puts {
+
+