forked from hummypkg/webif
fix backup/restore of favourites, fix notify bug
git-svn-id: file:///root/webif/svn/pkg/webif/trunk@3521 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
5104dbd387
commit
8b021ec4b7
@ -1,10 +1,10 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 1.3.5-6
|
||||
Version: 1.3.5-7
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hpkg.tv
|
||||
Depends: tcpfix,webif-channelicons(>=1.1.24),lighttpd(>=1.4.39-1),jim(>=0.77),jim-oo(>=0.77),jim-sqlite3(>=0.76),jim-cgi(>=0.7-1),jim-binary(>=0.76),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.5),hmt(>=2.0.10),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.1.9),webif-charts(>=1.2-1),stripts(>=1.2.5-3),tmenu(>=1.21-2),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.95),sqlite3(>=3.15.1)
|
||||
Depends: tcpfix,webif-channelicons(>=1.1.24),lighttpd(>=1.4.39-1),jim(>=0.77),jim-oo(>=0.77),jim-sqlite3(>=0.76),jim-cgi(>=0.7-1),jim-binary(>=0.76),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.5),hmt(>=2.0.10),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.1.10),webif-charts(>=1.2-1),stripts(>=1.2.5-3),tmenu(>=1.21-2),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.95),sqlite3(>=3.15.1)
|
||||
Suggests:
|
||||
Description: An evolving web interface for the Humax.
|
||||
Tags: http://hummy.tv/forum/threads/7619/
|
||||
|
@ -38,15 +38,7 @@ EOM
|
||||
$PKG_ROOT/etc/init.d/S02anacron start < /dev/null > /dev/null 2>&1 &
|
||||
|
||||
[ -f /tmp/webif_auto.log ] && rm -f /tmp/webif_auto.log
|
||||
|
||||
#if [ ! -f /mod/webif/.strip-updated ]; then
|
||||
# echo "*********************************"
|
||||
# echo "* Please wait while any shrunk recordings are flagged..."
|
||||
# echo "*********************************"
|
||||
# /mod/webif/lib/bin/strip-update
|
||||
#
|
||||
# touch /mod/webif/.strip-updated
|
||||
#fi
|
||||
[ -f /mod/webif/.strip-updated ] && rm -f /mod/webif/.strip-updated
|
||||
|
||||
/mod/webif/lib/bin/diskattrs
|
||||
/mod/webif/lib/auto/upgrade
|
||||
|
@ -16,6 +16,7 @@ switch $runmode {
|
||||
cli {
|
||||
set type "full"
|
||||
if {"-X" in $argv} { set schedtime 7200 }
|
||||
if {"-x" in $argv} { set schedtime 7200 }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,8 @@ $('#restore_button').click(function() {
|
||||
refresh_backup_files();
|
||||
$('#restore_warning').slideDown();
|
||||
$('#restart_block').slideDown('slow');
|
||||
list_reload_required = true;
|
||||
visual_reload_required = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ set dir /mod/var/backup
|
||||
|
||||
httpheader
|
||||
|
||||
set file [file tail [cgi_get restore_file]]
|
||||
set file [file tail [cgi_get restore_file test]]
|
||||
if {$file == 0} {
|
||||
puts "No filename supplied."
|
||||
exit
|
||||
@ -32,16 +32,11 @@ puts "Listing scheduled events from <i>$file</i>..."
|
||||
set fields [[rsv] cleanvars]
|
||||
|
||||
set data [split [read $fd] "\n"]
|
||||
|
||||
set ver 1
|
||||
|
||||
foreach line $data {
|
||||
if {[string match "# version *" $line]} {
|
||||
set ver [lindex [split $line " "] 2]
|
||||
puts "Backup version $ver"
|
||||
}
|
||||
set vals [split $line "\t"]
|
||||
if {[lindex $vals 0] ne "event"} { continue }
|
||||
proc event {vals} {
|
||||
global fields ver
|
||||
|
||||
set vars {}
|
||||
set i 0
|
||||
foreach f $fields {
|
||||
@ -57,6 +52,48 @@ foreach line $data {
|
||||
clock format [$rsv end] -format {%H:%M}])"
|
||||
}
|
||||
|
||||
set favnames {}
|
||||
|
||||
proc fav {vals} {{lgroup 0}} {
|
||||
global favnames
|
||||
|
||||
lassign $vals x group svctype svcname idx
|
||||
|
||||
if {$group != $lgroup} {
|
||||
set lgroup $group
|
||||
if {[dict exists $favnames $group]} {
|
||||
puts "Favourites ($favnames($group))"
|
||||
} else {
|
||||
puts "Favourites (group $group)"
|
||||
}
|
||||
}
|
||||
puts " $svcname"
|
||||
}
|
||||
|
||||
proc favname {vals} {
|
||||
global favnames
|
||||
|
||||
lassign $vals x num idx name
|
||||
|
||||
puts "Favourites $num '$name'"
|
||||
set favnames($idx) $name
|
||||
}
|
||||
|
||||
foreach line $data {
|
||||
if {[string match "# version *" $line]} {
|
||||
set ver [lindex [split $line " "] 2]
|
||||
puts "Backup version $ver"
|
||||
}
|
||||
set vals [split $line "\t"]
|
||||
set type [lindex $vals 0]
|
||||
switch -- $type {
|
||||
fav -
|
||||
favname -
|
||||
event { $type $vals }
|
||||
#default { puts "Unhandled '$type'" }
|
||||
}
|
||||
}
|
||||
|
||||
close $fd
|
||||
rsv cleanup
|
||||
|
||||
|
@ -18,6 +18,7 @@ set lines {}
|
||||
set seen {}
|
||||
foreach line [split [file read /mod/tmp/notify.log] "\n"] {
|
||||
set rest [lassign [split $line -] date]
|
||||
if {$rest eq ""} { set rest $date }
|
||||
if {[dict exists $seen $rest]} {
|
||||
incr seen($rest)
|
||||
} else {
|
||||
|
@ -52,10 +52,11 @@ foreach a {
|
||||
} {
|
||||
lassign $a id attr
|
||||
if {![dict exists $attrs $id]} continue
|
||||
puts "$attr: $attrs($id)"
|
||||
puts -nonewline "$attr: $attrs($id) "
|
||||
$settings _nval_setting "SMART_$attr" $attrs($id)
|
||||
if {$attrs($id) < [$settings _nval_setting "SMART_ack_$attr"]} {
|
||||
$settings _nval_setting "SMART_ack_$attr" $attrs($id)
|
||||
}
|
||||
}
|
||||
puts ""
|
||||
|
||||
|
@ -124,13 +124,7 @@ rsv method isseries {} {
|
||||
}
|
||||
|
||||
rsv method _strip {str} {
|
||||
if {[string range $str 1 2] eq "i7"} {
|
||||
set str [string range $str 3 end]
|
||||
}
|
||||
if {[string first "\025" $str] == 0} {
|
||||
set str [string range $str 1 end]
|
||||
}
|
||||
return $str
|
||||
return [system strip $str]
|
||||
}
|
||||
|
||||
rsv method folder {} {
|
||||
@ -799,6 +793,18 @@ proc {rsv backup} {file} {
|
||||
puts "Done."
|
||||
|
||||
puts "Backing up channel favourites..."
|
||||
puts " Names:"
|
||||
|
||||
# Favourite names
|
||||
set favnames {}
|
||||
loop i 1 6 {
|
||||
set favname [system strip \
|
||||
[system param FAV_CUSTOM_STR0$i Text]]
|
||||
set idx [expr 1 << ($i - 1)]
|
||||
set favnames($idx) $favname
|
||||
puts $fd "favname\t$i\t$idx\t$favname"
|
||||
puts " $favname"
|
||||
}
|
||||
|
||||
set grp 0
|
||||
foreach res [$rsvdb query {
|
||||
@ -811,7 +817,11 @@ proc {rsv backup} {file} {
|
||||
}] {
|
||||
if {$res(eFavGroup) != $grp} {
|
||||
set grp $res(eFavGroup)
|
||||
puts " Group $grp"
|
||||
if {[dict exists $favnames $grp]} {
|
||||
puts " Group $favnames($grp)"
|
||||
} else {
|
||||
puts " Group '$grp':"
|
||||
}
|
||||
}
|
||||
puts " $res(szSvcName)"
|
||||
puts $fd "fav\t$res(eFavGroup)\t$res(eSvcType)\t$res(szSvcName)\t$res(favIdx)"
|
||||
@ -848,7 +858,7 @@ proc {rsv restore} {file} {
|
||||
|
||||
puts "Restoring scheduled events from <i>$file</i>..."
|
||||
|
||||
$rsvdb query {begin transaction;}
|
||||
catch { exec /mod/bin/nugget quit }
|
||||
$rsvdb query {delete from TBL_RESERVATION;}
|
||||
|
||||
set fields [[rsv] cleanvars]
|
||||
@ -859,6 +869,7 @@ proc {rsv restore} {file} {
|
||||
|
||||
set hsvcmap {}
|
||||
set lcnmap {}
|
||||
set favmap {}
|
||||
|
||||
# Check version, build maps for later.
|
||||
foreach line $data {
|
||||
@ -866,15 +877,18 @@ proc {rsv restore} {file} {
|
||||
set ver [lindex [split $line " "] 2]
|
||||
puts "Backup version $ver"
|
||||
}
|
||||
lassign [split $line "\t"] tag hsvc name
|
||||
if {$tag eq "hsvc"} {
|
||||
set hsvcmap($hsvc) $name
|
||||
}
|
||||
if {$tag eq "lcn"} {
|
||||
set lcnmap($name) $hsvc
|
||||
lassign [split $line "\t"] tag f1 f2 f3 f4
|
||||
switch -- $tag {
|
||||
hsvc { set hsvcmap($f1) $f2 }
|
||||
lcn { set lcnmap($f2) $f1 }
|
||||
favname { set favmap($f2) $f3 }
|
||||
}
|
||||
}
|
||||
|
||||
set chanmap [lreverse $hsvcmap]
|
||||
|
||||
# Restore events
|
||||
|
||||
foreach line $data {
|
||||
set vals [split $line "\t"]
|
||||
if {[lindex $vals 0] ne "event"} continue
|
||||
@ -949,62 +963,74 @@ proc {rsv restore} {file} {
|
||||
}
|
||||
|
||||
if {!$bad} {
|
||||
if {[catch {$rsv insert pending 1} msg]} {
|
||||
if {[catch {$rsv insert pending 1 1} msg]} {
|
||||
puts " Error inserting event, $msg"
|
||||
}
|
||||
}
|
||||
puts ""
|
||||
}
|
||||
|
||||
$rsvdb query {commit transaction;}
|
||||
|
||||
puts "Restoring favourite channels..."
|
||||
$rsvdb query {begin transaction;}
|
||||
$rsvdb query {delete from channel.TBL_FAV}
|
||||
|
||||
$rsvdb query {drop table if exists pending.fav}
|
||||
$rsvdb query {create table pending.fav (
|
||||
favIdx integer primary key autoincrement unique,
|
||||
favIdx integer primary key unique,
|
||||
hSvc integer(4),
|
||||
eFavGroup integer(4),
|
||||
[eSvcType] integer(4)
|
||||
)}
|
||||
$rsvdb query {drop table if exists pending.favnames}
|
||||
$rsvdb query {create table pending.favnames (
|
||||
idx integer primary key unique,
|
||||
name string
|
||||
)}
|
||||
|
||||
set grp 0
|
||||
foreach line $data {
|
||||
set vals [split $line "\t"]
|
||||
|
||||
if {[lindex $vals 0] eq "favname"} {
|
||||
lassign $vals x num x name
|
||||
$rsvdb query {
|
||||
insert into
|
||||
pending.favnames(idx, name)
|
||||
values(%s, '%s')
|
||||
} $num $name
|
||||
continue
|
||||
}
|
||||
|
||||
if {[lindex $vals 0] ne "fav"} { continue }
|
||||
|
||||
set group [lindex $vals 1]
|
||||
set type [lindex $vals 2]
|
||||
set chan [lindex $vals 3]
|
||||
set idx [lindex $vals 4]
|
||||
lassign $vals x group type chan idx
|
||||
|
||||
if {$idx eq ""} { set idx 0 }
|
||||
set hsvc [get_channel_attr $chan]
|
||||
|
||||
if {$grp != $group} {
|
||||
set grp $group
|
||||
puts " Group $grp"
|
||||
if {[dict exists $favmap $grp]} {
|
||||
puts " Group $favmap($grp)"
|
||||
} else {
|
||||
puts " Group $grp"
|
||||
}
|
||||
}
|
||||
|
||||
puts " $chan"
|
||||
|
||||
if {$hsvc eq ""} {
|
||||
if {[dict exists $chanmap $chan]} {
|
||||
set hsvc $chanmap($chan)
|
||||
} else {
|
||||
puts " Cannot map channel name to service."
|
||||
continue
|
||||
}
|
||||
|
||||
set query "
|
||||
$rsvdb query {
|
||||
insert into
|
||||
pending.fav(favIdx, hSvc, eFavGroup, eSvcType)
|
||||
values($idx, $hsvc, $group, $type);
|
||||
"
|
||||
|
||||
$rsvdb query $query
|
||||
values(%s, %s, %s, %s);
|
||||
} $idx $hsvc $group $type
|
||||
}
|
||||
|
||||
$rsvdb query {commit transaction;}
|
||||
|
||||
system restartpending
|
||||
|
||||
close $fd
|
||||
|
Loading…
Reference in New Issue
Block a user