close rsv DB prior to RTS commit
git-svn-id: file:///root/webif/svn/pkg/webif/trunk@3337 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
de8af8c4ad
commit
46a539c739
@ -1,7 +1,7 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 1.3.2-10
|
||||
Version: 1.3.2-11
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hpkg.tv
|
||||
Depends: tcpfix,webif-channelicons(>=1.1.24),lighttpd(>=1.4.39-1),jim(>=0.76-2),jim-oo,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.3),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.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.95)
|
||||
|
@ -220,7 +220,7 @@ if {[llength $data]} {
|
||||
if {![system instandby] && $play < 1} {
|
||||
set hsvc [system param CUR_SVC Value USERCONFIG]
|
||||
|
||||
set ff [$rsvdb query "
|
||||
set ff [[rsv dbhandle] query "
|
||||
select usSvcid as svcid, usLcn as lcn,
|
||||
substr(szSvcName, 2) as name
|
||||
from channel.TBL_SVC
|
||||
|
@ -3,9 +3,7 @@ if {![exists -proc get_channel_attr]} {
|
||||
if {![exists -proc rsv]} { require rsv.class }
|
||||
|
||||
proc get_channel_attr {channel {field hSvc}} {
|
||||
global rsvdb
|
||||
|
||||
set ff [$rsvdb query "
|
||||
set ff [[rsv dbhandle] query "
|
||||
select $field
|
||||
from channel.TBL_SVC
|
||||
where szSvcName = '$channel'
|
||||
@ -20,9 +18,7 @@ if {![exists -proc get_channel_attr]} {
|
||||
}
|
||||
|
||||
proc get_channel_attr_bylcn {lcn {field hSvc}} {
|
||||
global rsvdb
|
||||
|
||||
set ff [$rsvdb query "
|
||||
set ff [[rsv dbhandle] query "
|
||||
select $field
|
||||
from channel.TBL_SVC
|
||||
where usLcn = $lcn
|
||||
@ -36,9 +32,7 @@ if {![exists -proc get_channel_attr]} {
|
||||
}
|
||||
|
||||
proc get_channel_attr_byorglcn {lcn {field hSvc}} {
|
||||
global rsvdb
|
||||
|
||||
set ff [$rsvdb query "
|
||||
set ff [[rsv dbhandle] query "
|
||||
select $field
|
||||
from channel.TBL_SVC
|
||||
where usOrgLcn = $lcn
|
||||
@ -53,9 +47,7 @@ if {![exists -proc get_channel_attr]} {
|
||||
}
|
||||
|
||||
proc get_channel_attr_byhsvc {hsvc {field usLcn}} {
|
||||
global rsvdb
|
||||
|
||||
set ff [$rsvdb query "
|
||||
set ff [[rsv dbhandle] query "
|
||||
select $field
|
||||
from channel.TBL_SVC
|
||||
where hSvc = $hsvc
|
||||
@ -69,9 +61,7 @@ if {![exists -proc get_channel_attr]} {
|
||||
}
|
||||
|
||||
proc get_channel_attr_bysvc {svc {field usLcn}} {
|
||||
global rsvdb
|
||||
|
||||
set ff [$rsvdb query "
|
||||
set ff [[rsv dbhandle] query "
|
||||
select $field
|
||||
from channel.TBL_SVC
|
||||
where usSvcId = $svc
|
||||
|
@ -2,23 +2,8 @@ source /mod/webif/lib/setup
|
||||
|
||||
if {![exists -proc class]} { package require oo }
|
||||
if {![exists -proc sqlite3.open]} { package require sqlite3 }
|
||||
require settings.class system.class
|
||||
|
||||
set rsvdb [sqlite3.open /var/lib/humaxtv/rsv.db]
|
||||
$rsvdb query {attach database '/var/lib/humaxtv/channel.db' as channel}
|
||||
|
||||
if {![file exists /var/lib/humaxtv/rsvp.db]} {
|
||||
file copy /var/lib/humaxtv/rsv.db /var/lib/humaxtv/rsvp.db
|
||||
set tdb [sqlite3.open /var/lib/humaxtv/rsvp.db]
|
||||
$tdb query {drop table TBL_VERSION}
|
||||
$tdb query {alter table TBL_RESERVATION rename to pending}
|
||||
$tdb query {alter table pending add column action int}
|
||||
$tdb query {delete from pending}
|
||||
$tdb close
|
||||
}
|
||||
$rsvdb query {attach database '/var/lib/humaxtv/rsvp.db' as pending}
|
||||
# These are required to upgrade old tables.
|
||||
catch { $rsvdb query { alter table pending add column action int} }
|
||||
if {![exists -proc binary]} { package require binary }
|
||||
require settings.class system.class plugin findhsvc
|
||||
|
||||
set binaryfields aulEventToRecordInfo
|
||||
|
||||
@ -57,8 +42,41 @@ class rsv {
|
||||
_origstart 0
|
||||
}
|
||||
|
||||
require findhsvc
|
||||
if {![exists -proc binary]} { package require binary }
|
||||
proc {rsv dbhandle} {args} {
|
||||
|
||||
if {"-close" in $args} {
|
||||
if {[info exists ::rsv::db]} {
|
||||
catch {$::rsv::db close}
|
||||
unset ::rsv::db
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
if {[info exists ::rsv::db]} {
|
||||
return $::rsv::db
|
||||
}
|
||||
|
||||
set ::rsv::db [sqlite3.open /var/lib/humaxtv/rsv.db]
|
||||
$::rsv::db query {attach database '/var/lib/humaxtv/channel.db' as channel}
|
||||
|
||||
if {![file exists /var/lib/humaxtv/rsvp.db]} {
|
||||
file copy /var/lib/humaxtv/rsv.db /var/lib/humaxtv/rsvp.db
|
||||
set tdb [sqlite3.open /var/lib/humaxtv/rsvp.db]
|
||||
$tdb query {drop table TBL_VERSION}
|
||||
$tdb query {alter table TBL_RESERVATION rename to pending}
|
||||
$tdb query {alter table pending add column action int}
|
||||
$tdb query {delete from pending}
|
||||
$tdb close
|
||||
}
|
||||
$::rsv::db query {attach database '/var/lib/humaxtv/rsvp.db' as pending}
|
||||
# These are required to upgrade old tables.
|
||||
catch { $::rsv::db query { alter table pending add column action int} }
|
||||
|
||||
return $::rsv::db
|
||||
}
|
||||
|
||||
alias {rsv cleanup} rsv dbhandle -close
|
||||
|
||||
rsv method status {} {
|
||||
set stat -1
|
||||
@ -327,7 +345,7 @@ rsv method set_skip {event} {
|
||||
}
|
||||
|
||||
rsv method remove_pending {} {
|
||||
$::rsvdb query "delete from pending where ulslot = $ulslot"
|
||||
[rsv dbhandle] query "delete from pending where ulslot = $ulslot"
|
||||
}
|
||||
|
||||
rsv method fix_hsvc {} {
|
||||
@ -354,7 +372,7 @@ rsv method cleanvars {} {
|
||||
}
|
||||
|
||||
rsv method insert {{table pending} {force 0} {defer 0}} {
|
||||
global rsvdb
|
||||
set rsvdb [rsv dbhandle]
|
||||
|
||||
set now [clock seconds]
|
||||
|
||||
@ -482,7 +500,7 @@ proc {rsv list} {{table tbl_reservation} {extra ""}} {
|
||||
|
||||
#puts "QSTRING: ($qstring)"
|
||||
|
||||
set res [$::rsvdb query $qstring]
|
||||
set res [[rsv dbhandle] query $qstring]
|
||||
set records {}
|
||||
foreach rec $res {
|
||||
lappend rec _table $table
|
||||
@ -499,7 +517,7 @@ proc {rsv count} {{table tbl_reservation}} {
|
||||
proc {rsv lookuptab} {} {
|
||||
set records {}
|
||||
foreach tab {tbl_reservation pending} {
|
||||
set res [$::rsvdb query "
|
||||
set res [[rsv dbhandle] query "
|
||||
select usSvcId, usevtid, ucCRIDType, szCRID,
|
||||
ucRecKind
|
||||
from $tab left join channel.TBL_SVC
|
||||
@ -534,7 +552,7 @@ proc {rsv lookuptab} {} {
|
||||
proc {rsv xlookuptab} {} {
|
||||
set records {}
|
||||
foreach tab {tbl_reservation pending} {
|
||||
set res [$::rsvdb query "
|
||||
set res [[rsv dbhandle] query "
|
||||
select $tab.szCRID, channel.TBL_SVC.hSvc
|
||||
from $tab left join channel.TBL_SVC
|
||||
on $tab.hSvc = channel.TBL_SVC.hSvc
|
||||
@ -550,7 +568,7 @@ proc {rsv xlookuptab} {} {
|
||||
}
|
||||
|
||||
proc {rsv entry} {{table TBL_RESERVATION} crid svc} {
|
||||
set res [$::rsvdb query "
|
||||
set res [[rsv dbhandle] query "
|
||||
select $table.*,
|
||||
channel.TBL_SVC.szSvcName, channel.TBL_SVC.usLcn
|
||||
from $table
|
||||
@ -590,7 +608,7 @@ proc {rsv fetch} {table ersvtype hsvc nsttime usevtid {crid ""} {extra ""}} {
|
||||
append q " $extra "
|
||||
}
|
||||
|
||||
set res [$::rsvdb query $q {*}$params]
|
||||
set res [[rsv dbhandle] query $q {*}$params]
|
||||
|
||||
if {[llength $res] > 0} {
|
||||
return [rsv new [lindex $res 0]]
|
||||
@ -599,7 +617,7 @@ proc {rsv fetch} {table ersvtype hsvc nsttime usevtid {crid ""} {extra ""}} {
|
||||
}
|
||||
|
||||
proc {rsv slot} {{table TBL_RESERVATION} slot} {
|
||||
set res [$::rsvdb query "
|
||||
set res [[rsv dbhandle] query "
|
||||
select $table.*,
|
||||
channel.TBL_SVC.szSvcName, channel.TBL_SVC.usLcn
|
||||
from $table
|
||||
@ -613,23 +631,23 @@ proc {rsv slot} {{table TBL_RESERVATION} slot} {
|
||||
return 0
|
||||
}
|
||||
|
||||
proc {rsv cleanup} {} {
|
||||
catch {$::rsvdb close}
|
||||
}
|
||||
|
||||
proc {rsv rtsched} {} {
|
||||
if {![system nuggeted]} { return 0 }
|
||||
if {![[settings] rtschedule]} { return 0 }
|
||||
return 1
|
||||
}
|
||||
|
||||
proc {rsv commit} {} {
|
||||
proc {rsv commit} {{plugins 1}} {
|
||||
if {![rsv rtsched]} return
|
||||
rsv dbhandle -close
|
||||
if {[catch {
|
||||
exec /mod/boot/rsvsync -realtime >> /mod/tmp/rsvsync.log} msg]} {
|
||||
puts "Scheduling: $msg"
|
||||
} else {
|
||||
system restartpending 0
|
||||
if {$plugins} {
|
||||
eval_plugins rts
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -738,7 +756,7 @@ proc {rsv manual} {start end lcn type repeat {title ""}} {
|
||||
}
|
||||
|
||||
proc {rsv backup} {file} {
|
||||
global rsvdb
|
||||
set rsvdb [rsv dbhandle]
|
||||
|
||||
require epg.class
|
||||
|
||||
@ -809,7 +827,7 @@ proc {rsv backup} {file} {
|
||||
}
|
||||
|
||||
proc {rsv restore} {file} {
|
||||
global rsvdb
|
||||
set rsvdb [rsv dbhandle]
|
||||
|
||||
if {![file exists $file]} {
|
||||
error "Backup file <i>$file</i> does not exist."
|
||||
|
Loading…
Reference in New Issue
Block a user