From 61f3868c42862d8367f78cd0f4c2b7172e560d0f Mon Sep 17 00:00:00 2001 From: hummypkg Date: Mon, 13 Oct 2014 12:32:02 +0000 Subject: [PATCH] minor tweaks git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2053 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 2 +- webif/html/backup/view.jim | 7 +++ webif/html/settings/settings.js | 2 +- webif/lib/rsv.class | 81 +++++++++++++++++++++++++++++++-- webif/lib/setup | 2 +- 5 files changed, 88 insertions(+), 6 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index 4760571..98f0c9d 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 1.0.17-1 +Version: 1.0.17-2 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: webif-channelicons(>=1.1.13),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=1.2),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.0.13),hmt(>=1.1.21),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),mongoose diff --git a/webif/html/backup/view.jim b/webif/html/backup/view.jim index de8bc1e..8a7d158 100755 --- a/webif/html/backup/view.jim +++ b/webif/html/backup/view.jim @@ -33,12 +33,19 @@ set fields [lsort [[rsv] vars]] 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 } set vars {} set i 0 foreach f $fields { + if {$ver < 2 && $f eq "aulEventToRecordInfo"} continue incr i lappend vars $f [lindex $vals $i] } diff --git a/webif/html/settings/settings.js b/webif/html/settings/settings.js index de02cd6..ef8f5c3 100644 --- a/webif/html/settings/settings.js +++ b/webif/html/settings/settings.js @@ -90,6 +90,6 @@ $(document).ready(function () { }); // For now - until plugins are updated. - $('div.pluginsettings').find('br + br').remove(); + //$('div.pluginsettings').find('br + br').remove(); }); diff --git a/webif/lib/rsv.class b/webif/lib/rsv.class index c145031..d30a97a 100755 --- a/webif/lib/rsv.class +++ b/webif/lib/rsv.class @@ -60,6 +60,10 @@ require findhsvc if {![exists -proc binary]} { package require binary } rsv method aul {} { + if {[regexp -nocase {^[0-9a-f]+$} $aulEventToRecordInfo} { + set aulEventToRecordInfo [\ + binary format H* $aulEventToRecordInfo] + } set aul {} for {set i 0} {$i < [string length $aulEventToRecordInfo]} {incr i 16} { binary scan [string range $aulEventToRecordInfo $i $($i + 15)] \ @@ -79,6 +83,10 @@ proc {rsv mkaul} {e} { ] } +rsv method setaul {s} { + set aulEventToRecordInfo $s +} + rsv method clear_ulslot {} { set ulslot -1 } @@ -227,6 +235,14 @@ rsv method fix_hsvc {} { set hsvc $_hsvc } +proc {rsv find_hsvc} {lcn channel} { + set _hsvc [get_channel_attr $channel] + if {$_hsvc eq ""} { + set _hsvc [get_channel_attr_bylcn $lcn] + } + return $_hsvc +} + rsv method insert {{table pending} {force 0}} { global rsvdb @@ -524,6 +540,8 @@ proc {rsv construct} {event type} { proc {rsv backup} {file} { global rsvdb + require epg.class + if {[catch { set fd [open $file w] } msg]} { error "Error creating backup file. - $msg" } @@ -535,6 +553,7 @@ proc {rsv backup} {file} { set fields [lsort [[rsv] vars]] puts $fd "# version 2" + puts $fd "# [join $fields "\t"]" foreach event $events { @@ -572,6 +591,20 @@ proc {rsv backup} {file} { } puts "Done." + puts "Backing up channel list..." + + foreach channel [epg channellist hSvc] { + lassign $channel name hsvc + puts $fd "hsvc\t$hsvc\t$name" + } + + foreach channel [epg channellist usLcn] { + lassign $channel name uslcn + puts $fd "lcn\t$uslcn\t$name" + } + + puts "Done." + close $fd } @@ -597,13 +630,27 @@ proc {rsv restore} {file} { set ver 1 + set hsvcmap {} + set lcnmap {} + + # Check version, build maps for later. foreach line $data { if {[string match "# version *" $line]} { 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 + } + } + + foreach line $data { set vals [split $line "\t"] - if {[lindex $vals 0] ne "event"} { continue } + if {[lindex $vals 0] ne "event"} continue set vars {} set i 0 foreach f $fields { @@ -615,14 +662,14 @@ proc {rsv restore} {file} { } # Don't restore DSO events. - if {$vars(ersvtype) == 11} { continue } + if {$vars(ersvtype) == 11} continue set rsv [rsv new $vars] # Need to fix up channel and CRID mappings in case something # has changed during a channel scan. - puts " Restoring [$rsv name]" + puts " Restoring [$rsv name] ([$rsv get szSvcName])" set bad 0 # First, the service number @@ -640,6 +687,34 @@ proc {rsv restore} {file} { } } + if {!$bad} { + # Need to fix up the AUL table service IDs too. + set newaul "" + foreach aul [$rsv aul] { + # {service start end event_id} + lassign $aul ohsvc start end eid + if {![dict exists $hsvcmap $ohsvc]} { + # Should not happen + puts " Losing AUL entry ($ohsvc)." + continue + } + set lcn 0 + set channame $hsvcmap($ohsvc) + if {[dict exists $lcnmap $channame]} { + set lcn $lcnmap($channame) + } + # Find the new hsvc if possible. + set _hsvc [rsv find_hsvc $lcn $channame] + if {$_hsvc eq ""} continue + if {$ohsvc != $_hsvc} { + puts " AUL $channame ($ohsvc -> $_hsvc)" + } + append newaul [binary format iiii \ + $_hsvc $start $end $eid] + } + $rsv setaul $newaul + } + if {!$bad} { if {[catch {$rsv insert pending 1} msg]} { puts " Error inserting event, $msg" diff --git a/webif/lib/setup b/webif/lib/setup index 2c74c9c..b075ca1 100644 --- a/webif/lib/setup +++ b/webif/lib/setup @@ -3,8 +3,8 @@ if {![exists -proc require]} { proc require {args} {{done {}}} { foreach file $args { if {$file ni $done} { - uplevel source "/mod/webif/lib/$file" lappend done $file + uplevel source "/mod/webif/lib/$file" } } }