1.2.2-4 - faster decrypt

git-svn-id: file:///root/webif/svn/pkg/webif/trunk@2383 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2015-04-10 22:01:51 +00:00
parent bf1bd66bbe
commit 2e3ce0aed1
5 changed files with 94 additions and 35 deletions

View File

@ -1,10 +1,10 @@
Package: webif
Priority: optional
Section: web
Version: 1.2.2-3
Version: 1.2.2-4
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.1.17),lighttpd(>=1.4.35-2),jim(>=0.76),jim-oo,jim-sqlite3(>=0.76),jim-cgi(>=0.7),jim-binary(>=0.76),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.0),hmt(>=2.0.3),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,recmon(>=2.0.2)
Depends: webif-channelicons(>=1.1.17),lighttpd(>=1.4.35-2),jim(>=0.76),jim-oo,jim-sqlite3(>=0.76),jim-cgi(>=0.7),jim-binary(>=0.76),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.0),hmt(>=2.0.3),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,recmon(>=2.0.2)
Suggests:
Description: An evolving web interface for the Humax.
Tags: http://hummy.tv/forum/threads/5866/

8
etc/recmon.d/autotrigger Executable file
View File

@ -0,0 +1,8 @@
#!/mod/bin/jimsh
set file [lindex $argv 0]
set dir [file dirname $file]
exec /mod/webif/lib/bin/auto -single $dir

View File

@ -282,12 +282,6 @@ proc do_decrypt {ts} {
return
}
lassign [$ts dlnaloc "127.0.0.1"] url
if {$url eq ""} {
log " $file - Not yet indexed."
return
}
if {![system is_listening 9000]} {
log " $file - DLNA Server not running." 2
set ::dlnaok 0
@ -308,6 +302,20 @@ proc do_decrypt {ts} {
return
}
lassign [$ts dlnaloc "127.0.0.1"] url
if {$url ne ""} {
log " $file - has been indexed."
set helper 0
} else {
log " $file - Not yet indexed, trying helper."
lassign [system dlnahelper [file normalize $file]] url
if {$url eq ""} {
log " $file - Can't use helper."
return
}
set helper 1
}
# Perform the decryption by requesting the file from the DLNA server.
set size [$ts size]
dsc $size
@ -318,6 +326,9 @@ proc do_decrypt {ts} {
log " DLNA: $url" 0
exec wget -O "$tmp/$bfile" $url
# Release the helper lock once finished.
if {$helper} { system dlnahelper -release }
if {[file size $file] != [file size "$tmp/$bfile"]} {
log " $file - File size mismatch." 0
file tdelete "$tmp/$bfile"

View File

@ -1,4 +1,6 @@
source /mod/webif/lib/setup
if {![exists -proc class]} { package require oo }
if {![exists -proc sqlite3.open]} { package require sqlite3 }
if {![exists -proc binary]} { package require binary }
@ -159,6 +161,69 @@ proc {system dlnadb} {} {
return ""
}
proc {system dlnaurl} {file {urlbase ""}} {
set mime "video/ts"
if {[catch {set db [sqlite3.open [system dlnadb]]}]} { return {} }
set muri [$db query {
select tblresource.mimetype, contenturi
from tblresource join tblmedia using (mediaid)
where localurl = '%s'} $file]
if {[llength $muri]} {
lassign [lindex $muri 0] x mime x xuri
} else {
# Try for partially linked entry
set muri [$db query {
select mediaid from tblmedia
where localurl = '%s'
} $file]
if {![llength $muri]} { return {} }
lassign [lindex $muri 0] x mediaid
set xuri "media/$mediaid.TS"
}
$db close
if {$urlbase eq ""} { set urlbase [system ip] }
set url "http://${urlbase}:9000/web/$xuri"
return [list $url $mime]
}
proc {system dlnahelper} {file {urlbase ""}} {
set dir /mnt/hd2/mod/.dlnahelper
require lock
if {$file eq "-release"} {
release_lock dlnahelper
return {}
}
if {![acquire_lock dlnahelper 2]} { return {} }
if {![file isdirectory $dir]} { file mkdir $dir }
set base [file rootname $file]
foreach ext {hmt ts} {
file delete "$dir/helper.$ext"
file link -symbolic "$dir/helper.$ext" "$base.$ext"
}
set ret [system dlnaurl "$dir/helper.ts" $urlbase]
if {![llength $ret]} {
# Manually import the helper file.
if {![catch {set db [sqlite3.open [system dlnadb]]}]} {
$db query {
insert into tblmedia
(localurl,folder,mediatype,refcount)
values('%s','%s',0,1)
} "$dir/helper.ts" $dir
$db close
set ret [system dlnaurl "$dir/helper.ts" $urlbase]
}
}
return $ret
}
proc {system dustbin} {{short 0}} {
set dustbin "\[Deleted Items\]"
if {![catch {set fd [open "/mod/boot/dustbin.name" r]}]} {

View File

@ -4,8 +4,6 @@ if {![exists -proc pack]} { package require pack }
source /mod/webif/lib/setup
require system.class tvdb.class classdump
set dmsfile /mnt/hd2/dms_cds.db
set tsgroup {ts nts hmt thm}
class ts {
@ -259,31 +257,8 @@ ts method setgenre {newgenre} {
set genre $newgenre
}
ts method dlnaloc {{urlbase 0}} {
set mime "video/ts"
if {![file exists $::dmsfile]} { return {} }
if {[catch {set db [sqlite3.open $::dmsfile]}]} { return {} }
set url ""
set rfile [file normalize $file]
if {[catch {set muri [$db query "
select tblresource.mimetype, contenturi
from tblresource join tblmedia using (mediaid)
where localurl = '%s'" $rfile]}]} {
set muri ""
}
if {$muri ne ""} {
set rec [lindex $muri 0]
set xuri [lindex $rec 3]
set mime [lindex $rec 1]
if {$urlbase ne "0"} {
set url "http://$urlbase:9000/web/$xuri"
} else {
set url "http://[system ip]:9000/web/$xuri"
}
}
$db close
if {$url ne "" } { return [list $url $mime] } else { return {} }
ts method dlnaloc {{urlbase ""}} {
return [system dlnaurl [file normalize $file] $urlbase]
}
ts method cleanbmp {} {