From 38fdd3aaa60c112f51b5bb670f17711c00595118 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Sat, 24 Jan 2015 21:52:30 +0000 Subject: [PATCH] auto fixencflags git-svn-id: file:///root/webif/svn/pkg/webif/trunk@2220 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 2 +- webif/cgi-bin/channel.jim | 10 +++++++--- webif/lib/bin/auto | 3 ++- webif/lib/bin/fixencflags | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 5 deletions(-) create mode 100755 webif/lib/bin/fixencflags diff --git a/CONTROL/control b/CONTROL/control index 0551c48..58c41a2 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 1.2.0-4 +Version: 1.2.0-5 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: webif-channelicons(>=1.1.14),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(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.0),hmt(>=1.2.0),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),e2fsprogs,wireless-tools(>=29-1),dbupdate,mongoose diff --git a/webif/cgi-bin/channel.jim b/webif/cgi-bin/channel.jim index 579577d..71d31ff 100755 --- a/webif/cgi-bin/channel.jim +++ b/webif/cgi-bin/channel.jim @@ -36,13 +36,13 @@ puts " " foreach tw [$db query { select tsIdx, szNetName, usTsID, ulFrequency, ucLevel, - ucQuality, eTransMode + ucQuality, eTransMode, eConstellation from TBL_TS join TBL_NET using (netIdx) order by ulFrequency }] { lassign $tw \ x tsIdx x netName x usTsID x ulFrequency x ucLevel x ucQuality \ - x eTransMode + x eTransMode x eConstellation puts " @@ -60,7 +60,11 @@ foreach tw [$db query { order by usLcn } $tsIdx] - set mux "Local" + if {$eConstellation == 1} { + set mux "Local" + } else { + set mux "Unknown" + } set ehs 0 foreach chan $channels { lassign $chan x lcn x name diff --git a/webif/lib/bin/auto b/webif/lib/bin/auto index e27d714..50d5517 100755 --- a/webif/lib/bin/auto +++ b/webif/lib/bin/auto @@ -304,7 +304,8 @@ proc do_decrypt {ts} { set anencd [exec /mod/bin/stripts -qE $rfile] if {$anencd != "1"} { log " $file - already decrypted but the HMT flag is wrong." 0 - system notify "$file - auto-decrypt - file is already decrypted but the HMT flag is wrong. Run the 'fixencflags' diagnostic." + # Fix... + exec /mod/webif/lib/bin/fixencflags $file return } diff --git a/webif/lib/bin/fixencflags b/webif/lib/bin/fixencflags new file mode 100755 index 0000000..812977d --- /dev/null +++ b/webif/lib/bin/fixencflags @@ -0,0 +1,33 @@ +#!/mod/bin/jimsh + +source /mod/webif/lib/setup +require system.class ts.class + +proc fix_one {ts} { + set flag [$ts flag "ODEncrypted"] + set rfile [file rootname [$ts get file]] + set anencd [exec /mod/bin/stripts -qE $rfile] + if {$flag && $anencd != "1"} { + exec /mod/bin/hmt -encrypted "$rfile.hmt" + puts "FIXED ENC $rfile" + } + if {!$flag && $anencd == "1"} { + exec /mod/bin/hmt +encrypted "$rfile.hmt" + puts "FIXED DEC $rfile" + } +} + +if {![llength $argv]} { + ts iterate [lambda {ts} { + fix_one $ts + }] + exit +} + +foreach file $argv { + if {![string match {*.ts} $file]} continue + if {[catch {set ts [ts fetch $file]}]} continue + if {$ts == 0} continue + fix_one $ts +} +