forked from hummypkg/webif
add channelicons, fix status, show more actions
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2017 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
3c4b907091
commit
b88691c9e5
@ -1,7 +1,7 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 1.0.15-7
|
||||
Version: 1.0.15-8
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: webif-channelicons(>=1.1.12-1),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),mongoose
|
||||
|
15
webif/cgi-bin/hximages.jim
Executable file
15
webif/cgi-bin/hximages.jim
Executable file
@ -0,0 +1,15 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
header
|
||||
|
||||
puts "<ul>"
|
||||
|
||||
foreach f [readdir "/opt/share/images/blue"] {
|
||||
if {![string match {*.png} $f]} continue
|
||||
puts "<li><img src=\"/images/$f\">$f</li>"
|
||||
}
|
||||
|
||||
puts "</ul>"
|
||||
|
@ -33,21 +33,13 @@ if {[catch {set pid [exec pgrep -n humaxtv]}]} {
|
||||
set exts {.ts .mkv .avi .mpg .mpeg .wmv .mp3 .mp4 .mov}
|
||||
|
||||
proc get_data {} {
|
||||
global pid exts
|
||||
global pid exts opfile
|
||||
|
||||
set ret {}
|
||||
if {[catch {set data \
|
||||
[exec /mod/webif/lib/bin/lsof -X -Fns -p $pid]} msg]} {
|
||||
set ret {}
|
||||
} else {
|
||||
|
||||
#aw
|
||||
#s583700480
|
||||
#n/mnt/hd2/My Video/Real Lives Reunited_20140610_1002.ts
|
||||
|
||||
# Unfortunately, the access flag isn't reliable for
|
||||
# some reason. If it were, the sleep could be removed!
|
||||
|
||||
set size 0
|
||||
foreach line [split $data "\n"] {
|
||||
set typ [string index $line 0]
|
||||
@ -79,6 +71,9 @@ proc get_data {} {
|
||||
}
|
||||
}
|
||||
}
|
||||
if {$opfile ne "" && $opfile ni $ret} {
|
||||
set ret($opfile) [file size $opfile]
|
||||
}
|
||||
}
|
||||
return $ret
|
||||
}
|
||||
@ -87,6 +82,14 @@ set play 0
|
||||
set rec 0
|
||||
set output {}
|
||||
|
||||
set opfile ""
|
||||
if {[file exists "/mod/tmp/webif_auto/.op"} {
|
||||
set fp [open "/mod/tmp/webif_auto/.op"]
|
||||
lassign [split [string trim [$fp read]] ":"] op opfile
|
||||
$fp close
|
||||
debug "OP: $op - $opfile"
|
||||
}
|
||||
|
||||
set data {}
|
||||
if {$type eq "full"} {
|
||||
set data [get_data]
|
||||
@ -94,11 +97,20 @@ if {$type eq "full"} {
|
||||
if {[llength $data]} {
|
||||
debug " DATA: ($data)"
|
||||
if {![file exists /tmp/.rractive]} {
|
||||
set rr 0
|
||||
sleep 3
|
||||
set ndata [get_data]
|
||||
debug " NDATA: ($ndata)"
|
||||
set rr 0
|
||||
} else {
|
||||
sleep 1
|
||||
set ndata [get_data]
|
||||
debug " NDATA: ($ndata)"
|
||||
foreach k [array names data] {
|
||||
if {![dict exists $ndata $k]} {
|
||||
dict unset data $k
|
||||
}
|
||||
}
|
||||
|
||||
set rr 1
|
||||
set recs {}
|
||||
loop i 0 2 {
|
||||
@ -113,8 +125,8 @@ if {[llength $data]} {
|
||||
foreach file [array names data] {
|
||||
set bname [file rootname [file tail $file]]
|
||||
|
||||
if {[file exists "/mod/tmp/webif_auto/decrypting.$bname.ts"]} {
|
||||
set mode dec
|
||||
if {$file eq $opfile} {
|
||||
set mode $op
|
||||
} elseif {$data($file) == -1} {
|
||||
set mode chase
|
||||
} elseif {$rr} {
|
||||
@ -151,9 +163,30 @@ if {[llength $data]} {
|
||||
}
|
||||
dec {
|
||||
set mode "Decrypting"
|
||||
set icon "178_1_00_Icon_Lock.png "
|
||||
set icon "/img/decrypt.png "
|
||||
append icon "style=\"padding: 0 0.2em 0 0.5em\""
|
||||
# set icon "178_1_00_Icon_Lock.png "
|
||||
# append icon "style=\"padding: 0 0.2em 0 0.5em\""
|
||||
}
|
||||
mpg {
|
||||
set mode "Extracting MPG"
|
||||
set icon "/img/mpg.png "
|
||||
append icon "style=\"padding: 0 0.2em 0 0.5em\""
|
||||
}
|
||||
mp3 {
|
||||
set mode "Extracting MP3"
|
||||
set icon "/img/mp3.png "
|
||||
append icon "style=\"padding: 0 0.2em 0 0.5em\""
|
||||
}
|
||||
shrink {
|
||||
set mode "Shrinking"
|
||||
set icon "/img/compress.png "
|
||||
append icon "style=\"padding: 0 0.2em 0 0.5em\""
|
||||
}
|
||||
}
|
||||
|
||||
if {[string first "/" $icon] == -1} {
|
||||
set icon "/images/$icon"
|
||||
}
|
||||
|
||||
set name [string map {
|
||||
@ -166,7 +199,7 @@ if {[llength $data]} {
|
||||
if {$runmode eq "cgi"} {
|
||||
lappend output [concat \
|
||||
"<span class=\"va stitem\">\n" \
|
||||
" <img class=va src=/images/$icon>\n" \
|
||||
" <img class=va src=$icon>\n" \
|
||||
" <span>$mode <i>$name</i></span>\n" \
|
||||
"</span>\n" \
|
||||
]
|
||||
|
@ -3,7 +3,7 @@
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class pretty_size system.class settings.class escape browse.class \
|
||||
plugin
|
||||
plugin epg.class
|
||||
|
||||
jqplugin contextMenu bar enadis
|
||||
jscss script.js style.css
|
||||
@ -177,6 +177,8 @@ proc entry {file} {{i 0}} {
|
||||
if {$bfile in $dinuse} {
|
||||
icon "/img/inuse.png"
|
||||
}
|
||||
icon [epg channeliconpath [$ts get channel_name]] \
|
||||
[$ts get channel_name] "" "va browsechannel"
|
||||
set genre [$ts get genre]
|
||||
set glist [ts genrelist]
|
||||
if {[dict exists $glist $genre]} {
|
||||
|
@ -148,6 +148,18 @@ proc dorecalc {dir} {
|
||||
set recalc 0
|
||||
}
|
||||
|
||||
proc startop {op file} {
|
||||
global tmp
|
||||
set fp [open "$tmp/.op" "w"]
|
||||
puts $fp "$op:$file"
|
||||
$fp close
|
||||
}
|
||||
|
||||
proc endop {} {
|
||||
global tmp
|
||||
file delete "$tmp/.op"
|
||||
}
|
||||
|
||||
proc dedup {dir} {
|
||||
log "DEDUP: \[$dir]" 2
|
||||
loop i 0 1 {
|
||||
@ -205,6 +217,7 @@ proc do_shrink {ts} {
|
||||
}
|
||||
set size [$ts size]
|
||||
dsc $size
|
||||
startop shrink [$ts get file]
|
||||
runplugin preshrink $ts
|
||||
startclock
|
||||
log " SHRINK: $file" 0
|
||||
@ -219,6 +232,7 @@ proc do_shrink {ts} {
|
||||
} msg]} {
|
||||
log "Error during shrink: $msg" 0
|
||||
system notify "$file - auto-shrink - error $msg."
|
||||
endop
|
||||
return
|
||||
}
|
||||
|
||||
@ -249,6 +263,7 @@ proc do_shrink {ts} {
|
||||
log "Done... [endclock $size]" 0
|
||||
lappend processed_files [$ts get file]
|
||||
runplugin postshrink $ts
|
||||
endop
|
||||
}
|
||||
|
||||
proc do_decrypt {ts} {
|
||||
@ -297,8 +312,7 @@ proc do_decrypt {ts} {
|
||||
set size [$ts size]
|
||||
dsc $size
|
||||
runplugin predecrypt $ts
|
||||
set flagfile "$tmp/decrypting.$bfile"
|
||||
file touch $flagfile
|
||||
startop dec $file
|
||||
startclock
|
||||
log " DECRYPT: $rfile" 0
|
||||
log " DLNA: $url" 0
|
||||
@ -307,7 +321,7 @@ proc do_decrypt {ts} {
|
||||
if {[file size $file] != [file size "$tmp/$bfile"]} {
|
||||
log " $file - File size mismatch." 0
|
||||
file delete "$tmp/$bfile"
|
||||
file delete $flagfile
|
||||
endop
|
||||
return
|
||||
}
|
||||
|
||||
@ -316,7 +330,7 @@ proc do_decrypt {ts} {
|
||||
if {[$ts inuse]} {
|
||||
log " $file - In use."
|
||||
file delete "$tmp/$bfile"
|
||||
file delete $flagfile
|
||||
endop
|
||||
return
|
||||
}
|
||||
|
||||
@ -331,7 +345,7 @@ proc do_decrypt {ts} {
|
||||
log " $file - File did not decrypt properly." 0
|
||||
system notify "$file - auto-decrypt failed."
|
||||
file delete "$tmp/$bfile"
|
||||
file delete $flagfile
|
||||
endop
|
||||
return
|
||||
}
|
||||
|
||||
@ -364,9 +378,9 @@ proc do_decrypt {ts} {
|
||||
file tdelete "$rfile.encrypted"
|
||||
}
|
||||
log "Done... [endclock $size]" 0
|
||||
file delete $flagfile
|
||||
lappend processed_files [$ts get file]
|
||||
runplugin postdecrypt $ts
|
||||
endop
|
||||
}
|
||||
|
||||
proc do_mpg {ts} {
|
||||
@ -393,6 +407,7 @@ proc do_mpg {ts} {
|
||||
log " $file - In use."
|
||||
return
|
||||
}
|
||||
startop mpg [$ts get file]
|
||||
runplugin prempg $ts
|
||||
dsc [$ts size]
|
||||
|
||||
@ -409,6 +424,7 @@ proc do_mpg {ts} {
|
||||
} msg]} {
|
||||
log "Error during mpg extract: $msg" 0
|
||||
system notify "$file - auto-mpg - error $msg."
|
||||
endop
|
||||
return
|
||||
}
|
||||
|
||||
@ -416,6 +432,7 @@ proc do_mpg {ts} {
|
||||
file rename $tmp/mpg.mpg $file.mpg
|
||||
lappend processed_files [$ts get file]
|
||||
runplugin postmpg $ts
|
||||
endop
|
||||
}
|
||||
|
||||
proc do_mp3 {ts} {
|
||||
@ -443,6 +460,7 @@ proc do_mp3 {ts} {
|
||||
log " $file - In use."
|
||||
return
|
||||
}
|
||||
startop mp3 [$ts get file]
|
||||
runplugin premp3 $ts
|
||||
dsc [$ts size]
|
||||
|
||||
@ -460,6 +478,7 @@ proc do_mp3 {ts} {
|
||||
} msg]} {
|
||||
log "Error during mp3 extract: $msg" 0
|
||||
system notify "$file - auto-mp3 - error $msg."
|
||||
endop
|
||||
return
|
||||
}
|
||||
|
||||
@ -476,6 +495,7 @@ proc do_mp3 {ts} {
|
||||
file rename $tmp/mp3.mp3 $file.mp3
|
||||
lappend processed_files [$ts get file]
|
||||
runplugin postmp3 $ts
|
||||
endop
|
||||
}
|
||||
|
||||
proc entries {dir callback} {
|
||||
|
@ -110,6 +110,10 @@ epg method type_icon {} {
|
||||
}
|
||||
}
|
||||
|
||||
proc {epg channeliconpath} {name} {
|
||||
return "/img/channels/out/$name.png"
|
||||
}
|
||||
|
||||
proc {epg channelicon} {name {width 0} {style ""}} {
|
||||
set str "<img src=\"/img/channels/out/$name.png\"";
|
||||
if {$width > 0} { append str " width=$width" }
|
||||
|
@ -114,30 +114,34 @@ proc {system pkgver} {{pkg webif}} {
|
||||
return [lrange [split [exec opkg list-installed $pkg] " "] 2 end]
|
||||
}
|
||||
|
||||
proc {system pkginst} {pkg} {{cache {}} {ncache {}}} {
|
||||
if {$pkg in $cache} { return 1 }
|
||||
if {$pkg in $ncache} { return 0 }
|
||||
|
||||
# It may not be possible to get an opkg lock immediately so
|
||||
# try several times and throw an error if not.
|
||||
set status unknown
|
||||
loop i 0 5 {
|
||||
if {[catch {set status [exec opkg list-installed $pkg]}]} {
|
||||
sleep 1
|
||||
} else break
|
||||
}
|
||||
if {$status eq "unknown"} {
|
||||
error "Could not get opkg lock after 5 seconds."
|
||||
}
|
||||
|
||||
if {$status ne ""} {
|
||||
lappend cache $pkg
|
||||
return 1
|
||||
}
|
||||
lappend ncache $pkg
|
||||
return 0
|
||||
proc {system pkginst} {pkg} {
|
||||
return [file exists "/mod/var/opkg/info/$pkg.control"]
|
||||
}
|
||||
|
||||
#proc {system pkginst} {pkg} {{cache {}} {ncache {}}} {
|
||||
# if {$pkg in $cache} { return 1 }
|
||||
# if {$pkg in $ncache} { return 0 }
|
||||
#
|
||||
# # It may not be possible to get an opkg lock immediately so
|
||||
# # try several times and throw an error if not.
|
||||
# set status unknown
|
||||
# loop i 0 5 {
|
||||
# if {[catch {set status [exec opkg list-installed $pkg]}]} {
|
||||
# sleep 1
|
||||
# } else break
|
||||
# }
|
||||
# if {$status eq "unknown"} {
|
||||
# error "Could not get opkg lock after 5 seconds."
|
||||
# }
|
||||
#
|
||||
# if {$status ne ""} {
|
||||
# lappend cache $pkg
|
||||
# return 1
|
||||
# }
|
||||
# lappend ncache $pkg
|
||||
# return 0
|
||||
#}
|
||||
|
||||
proc {system mediaroot} {} {
|
||||
switch [system model] {
|
||||
HDR { return "/media/My Video" }
|
||||
|
Loading…
Reference in New Issue
Block a user