Compare commits

...

132 Commits

Author SHA1 Message Date
prpr 9ccb535b29 Update to 1.5.2-12 2024-04-14 01:56:23 +01:00
prpr 578b0ec551 Fix deferred cleanup of copied setup.db when locked 2024-04-08 17:42:16 +01:00
prpr 0fe6bfc482 Clear File Editor window on page refresh 2024-04-07 21:09:54 +01:00
prpr db67239313 Enhance robustness against poor/corrupt installed package data 2024-04-07 14:32:29 +01:00
prpr 0ee83fa950 Update to 1.5.2-11 2024-03-28 19:23:28 +00:00
prpr bb64837e79 Fix more DST problems with the schedule display 2024-03-28 19:17:35 +00:00
prpr 95c9471b51 Fix expression in expression errors 2024-03-28 18:58:07 +00:00
prpr 345b9ab706 Disable Twitter feed, as it no longer works 2024-03-16 21:38:49 +00:00
prpr bf2f95fdfc Simplify catch and expr statements 2024-03-10 21:16:35 +00:00
prpr fdb7ed4007 Update to 1.5.2-10 2024-03-10 14:02:33 +00:00
prpr 244b3e46cf Fix erroneous ffprobe output when .ts file not DLNA indexed 2024-03-10 14:01:22 +00:00
prpr a4d7dfaea6 Filter non-info output from ffprobe output 2024-03-10 14:00:02 +00:00
prpr 81940fa4a8 Minor optimisation in "ts fetch" 2024-03-10 13:59:21 +00:00
prpr 5a1b0fe2b2 Tidy up HTML 2024-02-21 19:45:00 +00:00
prpr ac21373095 Handle database error better 2024-02-12 20:46:42 +00:00
prpr 9b40cae0be Update to 1.5.2-9 2024-02-12 12:09:35 +00:00
prpr ba8786f0db Allow backup file name prefix to be specified via command line arg. 2024-02-12 11:32:45 +00:00
prpr 788652b289 Add setting for schedule backups max. age 2024-02-12 11:31:20 +00:00
prpr 3bf7a9ee6c Merge pull request 'Add -w flag to lsof so that it doesn't fail if there is an non accesible cifs filesystem mounted' (#50) from MymsMan/webif:Fix_system_inuse into master
Reviewed-on: #50
2024-02-05 19:21:43 +00:00
prpr 52c698587d Fix missing <div> 2024-02-05 19:11:14 +00:00
prpr 4cf9d0e102 Simplify expressions 2024-02-05 19:10:36 +00:00
Bob Buxton d7f7928d79 Add -w -f flags to lsof so that it doesn't fail if there is an non accesible cifs filesystem mounted
Note performance is still impacted - about 10s
2024-02-05 16:44:24 +00:00
prpr 19bfc162a6 Fix poor html 2024-02-05 15:25:19 +00:00
prpr fd9188c8f6 Update to 1.5.2-8 2024-01-31 22:25:35 +00:00
prpr f9877ae35e Flush buffered socket output due to Jim behaviour change 2024-01-31 22:23:19 +00:00
prpr e0fd42c929 Tweak formatting 2024-01-27 00:52:02 +00:00
prpr 93c266fa2d Remove duplicate </span> tag 2024-01-27 00:51:16 +00:00
prpr b0d965e4c8 Remove duplicate Rendered line and simplify expression 2024-01-27 00:49:34 +00:00
prpr 78cebd9099 Update extension list and make common 2024-01-27 00:45:00 +00:00
prpr 4c4fbe6a2b Fix escaping for literal \ also 2024-01-26 09:50:21 +00:00
prpr f07f2486ee Update to 1.5.2-7 2024-01-25 22:43:46 +00:00
prpr 230491ca76 Fix escaping on Jim critical characters - {}[]; 2024-01-25 22:43:11 +00:00
prpr f85e83f1df Add button for quick access to auto.log (from /df) 2024-01-13 11:40:58 +00:00
prpr d5f21d0ef5 Simplify expression 2023-12-26 23:48:22 +00:00
prpr c0ed6a65d9 Remove out directory (webif-channelicons) 2023-12-12 00:41:16 +00:00
prpr 3deb1cedff Remove duplicate code 2023-12-03 10:28:34 +00:00
prpr 1a67bc68ca Update to 1.5.2-6 2023-11-22 15:59:31 +00:00
prpr 114550d540 Fix regexp parsing whilst SMART test in progress 2023-11-22 15:58:13 +00:00
prpr e1b038d161 Update to 1.5.2-5 2023-11-20 16:04:57 +00:00
prpr 3e3f50b501 Fix return code decode from smartctl on self-test logs 2023-11-20 16:04:03 +00:00
prpr 504fbc89f8 Update to 1.5.2-4 2023-11-02 11:09:11 +00:00
prpr 33c2400cfc Tweak debug code formatting 2023-11-02 11:05:26 +00:00
prpr 8e80e86d70 Merge pull request 'Change slotid of dummy entry to -1 in checkconfilcts to prevent confusion with real recording slot 0' (#49) from MymsMan/webif:fixIncorrectConflicts into master
Reviewed-on: #49
2023-11-02 11:00:38 +00:00
Bob Buxton 67b3f61303 Change slotid of dummy entry to -1 in checkconfilcts to prevent confusion with real recording slot 0 2023-11-01 21:25:42 +00:00
prpr c5358a9299 Update to 1.5.2-3 2023-10-28 16:05:23 +01:00
prpr 88ab54ad96 Fix info display for lone .hmt files, and make Play/Download work correctly in all cases 2023-10-28 16:04:17 +01:00
prpr 043865aa00 Add fetchhmt function to support lone .htm file operation 2023-10-28 16:01:41 +01:00
prpr 72c7e6e3b1 Fix null string length match 2023-10-07 02:12:09 +01:00
prpr bbd1c50b38 Prevent trying to Play a .hmt file 2023-10-07 02:00:41 +01:00
prpr 46e4bddd56 Fix string match variable 2023-10-07 00:03:39 +01:00
prpr 15c3fcb239 Prevent trying to run ffprobe on .hmt files 2023-10-06 23:53:07 +01:00
prpr dc65836cd4 Update to 1.5.2-2 2023-09-29 23:23:03 +01:00
prpr 129c190b84 Refresh status bar every minute 2023-09-29 23:22:13 +01:00
prpr c3992e1a17 Set watched flag on .ts files played from file browser 2023-09-21 21:50:44 +01:00
prpr 8bd653b84b Update to 1.5.2-1 2023-07-26 21:42:46 +01:00
prpr bed05f0820 Log schedule operations correctly 2023-07-26 21:42:11 +01:00
prpr c60ac50c43 Simplify string format 2023-07-13 13:15:46 +01:00
prpr 275dc62d26 Update to 1.5.2 2023-07-13 12:32:25 +01:00
prpr d22735af68 Protect log rotation operations by lock 2023-07-12 02:25:51 +01:00
prpr fb9fb6ca85 Use manage_logs to rotate log file 2023-07-12 02:11:13 +01:00
prpr 1d243c989b Correctly display minute/minutes 2023-07-02 10:37:26 +01:00
prpr 44c52143a7 Fix divide by 0 error 2023-07-02 10:27:43 +01:00
prpr 7bd5bbc3c0 Log unschedule operation correctly 2023-07-01 22:14:33 +01:00
prpr 9c5b1a5641 Sanity check Recording start/end fields 2023-07-01 12:36:52 +01:00
prpr 90b69d0d21 Remove mux database 2023-07-01 00:02:48 +01:00
prpr 8713ea9495 Fix URL encoding for CRIDs containing IMIs 2023-06-28 02:12:46 +01:00
prpr 7c3021e320 Fix JSON formatting 2023-06-28 02:11:55 +01:00
prpr 0108d87c1c Update to 1.5.1-5 2023-06-13 10:54:15 +01:00
prpr 9b5c9553f0 Fix reverse sorts to keep folders first 2023-06-13 10:53:47 +01:00
prpr 2ea56fd045 Add Type (Extension) sort and tidy selection options 2023-06-13 01:37:00 +01:00
prpr ac13c730a8 Add front panel software reboot reason 2023-06-07 00:33:52 +01:00
prpr 3de96080c2 Update to 1.5.1-4 2023-06-06 01:49:30 +01:00
prpr 1def3cc520 Overwrite files from previous shrink failure 2023-06-06 01:48:53 +01:00
prpr d3f83f6f42 Update to 1.5.1-3 2023-06-05 13:47:04 +01:00
prpr 0711f9b226 Fix syntax error 2023-06-05 13:46:51 +01:00
prpr a7b7e589e1 Update to 1.5.1-2 2023-06-04 21:30:59 +01:00
prpr 0a5f9a95c4 Revert bafa8fcfd3 2023-06-04 20:58:52 +01:00
prpr a1adcb7033 Add front panel software reboot reason 2023-06-04 16:13:16 +01:00
prpr 32a32d2ad3 Widen window 2023-06-03 01:56:31 +01:00
prpr 7bac247e48 Remove white space before testing length 2023-05-30 00:40:08 +01:00
prpr bafa8fcfd3 Stop epg jumping when page load has finished 2023-05-28 20:06:04 +01:00
prpr 39d18b4ff0 Fix missing pathname when scanning for .ts files
Don't abort on safe_delete error
2023-05-28 19:24:53 +01:00
prpr c9100acf66 Don't overwrite instance variable defaults if .hmt file corrupt 2023-05-28 19:22:03 +01:00
prpr 0ab8fb125d Don't crash if file doesn't exist 2023-05-28 19:21:06 +01:00
prpr b24ade080f Don't alert with null string 2023-05-19 01:43:15 +01:00
prpr 62d63b2f84 Fix visual schedule off by 1 day 2023-03-26 17:45:01 +01:00
prpr f5b43f7ea1 Update to 1.5.1 2023-03-10 00:19:37 +00:00
prpr 640e81bda0 Add alternative a7.31 loader detection 2023-03-10 00:18:35 +00:00
prpr 7a00ea84ed Correct status when copying between local drives. 2023-02-17 20:37:50 +00:00
prpr d3d1755e98 Expire lone .hmt files from failed recordings 2023-01-23 14:18:09 +00:00
prpr b63a268dac Revert ce9e32977d - large can of worms. 2023-01-04 19:40:34 +00:00
prpr ce9e32977d Rename class variables to match change from 12 years ago! 2023-01-04 00:59:54 +00:00
prpr 29e560b11b Reverse sign of duration calculation 2022-12-30 19:26:43 +00:00
prpr 30a006b971 Add "system isrestartpending" 2022-12-27 17:02:23 +00:00
prpr aa24f100fa Allow application/xml* as editable types.
Tidy error messages.
2022-12-05 15:11:34 +00:00
prpr f9825002eb Update to 1.5.0-9 2022-10-27 11:56:43 +01:00
prpr 47f413b55d Fix off by 1 hour 2022-10-27 11:56:00 +01:00
prpr b0ba26918a Update to 1.5.0-8 2022-10-27 11:27:23 +01:00
prpr 3f756a78f4 Fix double Sunday display around DST change 2022-10-27 11:26:43 +01:00
prpr 80464c8342 Update to 1.5.0-7 2022-10-16 15:28:40 +01:00
prpr a587278586 Delay refresh on UI interaction 2022-10-16 15:27:33 +01:00
prpr 00e8a342c0 Ignore TSR buffer size when disabled 2022-10-15 22:07:34 +01:00
prpr 203430c224 Update to 1.5.0-6 2022-09-25 17:01:24 +01:00
prpr 8c2a33b54d More fixes for expr weirdness 2022-09-25 16:59:39 +01:00
prpr 3f1832387a Revert expr modification 2022-09-25 02:08:56 +01:00
prpr cb78e4bc1d Update to 1.5.0-4 2022-09-22 02:04:01 +01:00
prpr f17adb764b Update expr commands to remove deprecated syntax 2022-09-22 02:02:32 +01:00
prpr c73a940bae Ignore errors from invalid directories 2022-09-15 01:39:13 +01:00
prpr 805b9ba2dc Check for null last boot reason 2022-09-14 11:03:49 +01:00
prpr 66bd753689 Update to 1.5.0-3 2022-09-13 01:16:19 +01:00
prpr c1358ef72f Update to 1.5.0-2 2022-09-10 15:33:33 +01:00
prpr 25bb62f622 Improve lock handling of /var/lib/humaxtv/setup.db 2022-09-10 15:31:33 +01:00
prpr aab63aa8cc Fix filename escaping in file editor 2022-09-10 14:24:10 +01:00
prpr 5e941b889c Update to 1.5.0-1 2022-04-24 17:39:03 +01:00
prpr b6c0ff80b6 Don't error on null SMART status 2022-04-24 17:37:13 +01:00
prpr 97b24da0ed Allow HD to collect disk stats. 2022-04-24 17:36:35 +01:00
prpr a34a951a33 Handle errors from Smartctl 2022-04-24 17:33:49 +01:00
prpr 12ecc32e44 Update version and dependencies 2022-04-21 18:59:25 +01:00
prpr b44f5c3678 Fix clipboard paste for .ts files without sidecars 2022-04-21 18:00:39 +01:00
prpr bdfae19796 Add error check 2022-04-21 18:00:04 +01:00
prpr 5cb9bdd6dd Remove redundant calls 2022-04-21 17:58:44 +01:00
prpr 9b8e6763af Handle SMART error counters more intelligently 2022-04-20 12:17:06 +01:00
prpr 1e53bc1b37 Update version and dependencies 2022-04-15 14:57:22 +01:00
prpr cfa77051e5 Change loglevel 2022-04-15 14:56:15 +01:00
prpr 08de047d91 Add prefix to logging 2022-04-15 14:55:07 +01:00
prpr da24fc6b20 (Re-)Create settings table if missing. 2022-04-11 01:00:40 +01:00
prpr f4357b87db Update to 1.4.9-8 2022-03-28 00:00:50 +01:00
prpr 9fb761a38e Revert 567d142613 2022-03-27 23:59:32 +01:00
prpr a79addc543 Remove redundant rename/comments 2022-03-25 23:46:52 +00:00
prpr 5edd63b2af Fix for "system dlnaurl" reversion 2022-03-25 23:43:51 +00:00
prpr 7f1d68bf3a Remove .orig files 2022-03-25 23:40:03 +00:00
prpr 0d7ba4744f Revert e79e85af81 2022-03-25 23:34:40 +00:00
104 changed files with 784 additions and 546 deletions

View File

@ -1,10 +1,10 @@
Package: webif
Priority: optional
Section: web
Version: 1.4.9-7
Version: 1.5.2-12
Architecture: mipsel
Maintainer: af123@hpkg.tv
Depends: tcpfix,webif-channelicons(>=1.1.27),lighttpd(>=1.4.39-1),jim(>=0.79),jim-pack(>=0.79),jim-oo(>=0.77),jim-sqlite3(>=0.77),jim-cgi(>=0.7-2),jim-binary(>=0.76),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.8),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.13),webif-charts(>=1.2-1),stripts(>=1.4.2),tmenu(>=1.21-2),ffmpeg(>=2.8),id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.98),sqlite3(>=3.15.1),jim-xconv,zip(>=3.0-1),wget
Maintainer: prpr
Depends: tcpfix,webif-channelicons(>=1.2.4),lighttpd(>=1.4.39-1),jim(>=0.82-5),jim-cgi(>=0.7-2),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.8),hmt(>=2.0.11),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.1.13),webif-charts(>=1.2-1),stripts(>=1.4.2),tmenu(>=1.21-2),ffmpeg(>=2.8),id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.98),sqlite3(>=3.15.1),jim-xconv,zip(>=3.0-1),wget
Suggests:
Description: An evolving web interface for the Humax.
Tags: https://hummy.tv/forum/threads/7712/
Tags: https://hummy.tv/forum/threads/10760/

View File

@ -113,7 +113,7 @@ if {[$record get event_crid] != ""} {
puts "
<tr>
<th>CRID</th><td>
<a href=/cgi-bin/epg/search.jim?crid=[$record get event_crid]>
<a href=/cgi-bin/epg/search.jim?crid=[cgi_quote_url [$record get event_crid]]>
<img border=0 height=14
src=/images/421_1_00_CH_Title_2R_Arrow.png>
[$record get channel_crid][$record get event_crid]
@ -127,7 +127,7 @@ if {[$record get series_crid] != ""} {
puts "
<tr>
<th nowrap>Series CRID</th><td>
<a href=/cgi-bin/epg/search.jim?scrid=[$record get series_crid]>
<a href=/cgi-bin/epg/search.jim?scrid=[cgi_quote_url [$record get series_crid]]>
<img border=0 height=14
src=/images/421_1_00_CH_Title_2R_Arrow.png>
[$record get channel_crid][$record get series_crid]
@ -141,7 +141,7 @@ if {[$record get rec_crid] != ""} {
set rec [$record recommended]
if {$rec != ""} {
puts "<tr><th>Recommends</th><td>
<a href=/cgi-bin/epg/search.jim?crid=[$rec get event_crid]>
<a href=/cgi-bin/epg/search.jim?crid=[cgi_quote_url [$rec get event_crid]]>
<img border=0 height=14
src=/images/421_1_00_CH_Title_2R_Arrow.png>
[$rec get name]

View File

@ -9,12 +9,12 @@ header
require totop
set ct [cgi_get ct 0]
set crid [cgi_get crid ""]
set scrid [cgi_get scrid ""]
set ct [cgi_unquote_input [cgi_get ct 0]]
set crid [cgi_unquote_input [cgi_get crid ""]]
set scrid [cgi_unquote_input [cgi_get scrid ""]]
if {[cgi_exists term]} {
set lterm [cgi_get term]
set lterm [cgi_unquote_input [cgi_get term]]
if {[string match {CRID:*} $lterm]} {
set crid [string range $lterm 5 end]

View File

@ -75,8 +75,7 @@ if {$cmd eq "update" || $cmd eq "upgrade"} {
putsf ""
putsf "Updating diagnostic meta information"
pkg fetchdiagmeta
putsf "Updating MUX database"
pkg fetchmuxdb
pkg removemuxdb
}
putsf "Done."

View File

@ -30,7 +30,8 @@ if {[catch {set pid [exec pgrep -n humaxtv]}]} {
exit
}
set exts {.ts .avi .mpg .mpeg .wmv .mkv .mp3 .mp4 .mov .hmt .m4v .m4a}
source /mod/webif/include/extensions.jim
set exts $include
set statusops {
decrypt { "Decrypting"
@ -120,8 +121,7 @@ proc get_data {} {
# and recently written)
if {[dict exists $ret $file] &&
$ext eq ".ts"} {
set age [expr [clock seconds] \
- [file mtime $file]]
set age $([clock seconds] - [file mtime $file])
if {$age < 60} {
set access [lindex \
[dict get $ret $file] 1]
@ -212,12 +212,8 @@ if {[llength $data]} {
foreach file [array names data] {
set bname [file tail $file]
set name [string map {
"/mnt/hd2/My Video/" ""
"/media/drive1/Video/" ""
"/media/" ""
".ts" ""
} $file]
regexp {(^/(mnt/hd2/My Video|media/drive[1-9]+/Video)/)?(.*)(\.ts)?$}\
$file _ _ _ name
if {[lindex $data($file) 0] == -1} {
set mode chase
@ -250,7 +246,7 @@ if {[llength $data]} {
set mode $ops($file)
}
regexp -- {^([^0-9]+)} $mode x mode
regexp -- {^([^0-9]+)} $mode _ mode
switch $mode {
chase {

View File

@ -55,5 +55,6 @@ if {[llength $usbdisks] > 0} {
puts -nonewline "]"
}
puts ""
puts "}"

View File

@ -24,6 +24,6 @@ set token [system startop -multiple mp3 $rfile]
puts [$ts mkmp3 $slow]
system endop $token
set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
set xtime $(([clock milliseconds] - $xstart) / 1000.0)
puts "Time taken: $xtime"

View File

@ -14,9 +14,9 @@ if {![file exists "${bfile}.mp3"]} {
puts "0"
} else {
set sz [file size $rfile]
set nsz [expr [file size "${bfile}.mp3"] / 0.3]
set nsz $([file size "${bfile}.mp3"] / 0.3)
set perc [expr $nsz * 100 / $sz]
set perc $($nsz * 100 / $sz)
if {$perc > 100} { set perc 100 }
puts $perc
}

View File

@ -82,6 +82,7 @@ switch $action {
set path [$item get path]
set file [file tail $path]
set mode [$item get action]
set fileonly 0
puts "Pasting $file"
@ -105,8 +106,13 @@ switch $action {
"$dir/[file tail $f]"}
}
}
} else {
set fileonly 1
}
} else {
set fileonly 1
}
if {$fileonly} {
if {$mode eq "cut"} {
catch {file rename $path \
"$dir/[file tail $path]"}

View File

@ -68,7 +68,7 @@ foreach b $bookmarks {
set l $($end - $start)
incr keeping $l
incr cur $l
append newbookmarks "[expr $cur + 3] "
append newbookmarks "$($cur + 3) "
set left $($start * $planwidth / $len)
set right $($end * $planwidth / $len)

View File

@ -50,7 +50,7 @@ set cmd [list /mod/bin/nicesplice \
-out "$dir/$shname"]
if {$invert} {
if {[expr [llength $bookmarks] % 2] != 0} {
if {([llength $bookmarks] % 2) != 0} {
lappend bookmarks [$ts duration 1]
}
foreach k [array names bookmarks] {
@ -70,11 +70,7 @@ set newname "$shname-[clock seconds]"
puts "Renaming file group to $newname"
puts "<span class=hidden id=fileparams file=\"$dir/$newname.ts\"></span>"
ts renamegroup "$dir/$shname.ts" $newname
exec /mod/bin/hmt "+setfilename=$newname" "$dir/$newname.hmt"
# New nicesplice shrinks whilst cropping.
# No longer required - nicesplice now sets this flag.
#exec /mod/bin/hmt "+shrunk" "$dir/$newname.hmt"
set croptime [expr [expr [clock milliseconds] - $cropstart] / 1000.0]
set croptime $(([clock milliseconds] - $cropstart) / 1000.0)
puts "Time taken: $croptime"

View File

@ -19,7 +19,7 @@ if {![file exists $newfile]} {
set expected $($sz / 100 * $perc)
set nsz [file size $newfile]
set perc [expr $nsz * 100 / $expected]
set perc $($nsz * 100 / $expected)
if {$perc > 100} { set perc 100 }
puts $perc
}

View File

@ -98,6 +98,6 @@ if {$mode eq "dlna"} {
}
}
set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
set xtime $(([clock milliseconds] - $xstart) / 1000.0)
puts "Time taken: $xtime"

View File

@ -22,6 +22,6 @@ if {![file exists "$file"]} {
set sz [file size $rfile]
set nsz [file size "$file"]
puts [expr $nsz * 100 / $sz]
puts $($nsz * 100 / $sz)
}

View File

@ -7,7 +7,6 @@ require ts.class
httpheader
set file [cgi_get file]
set ts [ts fetch $file]
if {[set ts [ts fetch $file]] != 0} {
set action enc
if {[$ts flag "Encrypted"]} { set action unenc }

View File

@ -9,6 +9,7 @@ httpheader "application/json"
set file [cgi_get file]
if {$file == 0} exit
set ts [ts fetch $file]
if {$ts == 0} exit
puts "{"
puts "\"title\" : \"[jescape [$ts get title]]\","

View File

@ -6,5 +6,11 @@ source /mod/webif/lib/setup
httpheader
set file [cgi_get file]
puts [exec /mod/bin/ffprobe -hide_banner $file]
set log ""
catch {set log [exec /mod/bin/ffprobe -hide_banner -v level $file]}
set log [lsearch -all -regexp -inline [split $log "\n"] "^\\\[info\\\]"]
if {[regsub -all -line -- "^\\\[info\\\]" [join $log "\n"] "" log]} {
puts $log
} else {
puts None
}

View File

@ -15,13 +15,20 @@ set sz [pretty_size [file size $file]]
set flags {}
set url ""
set ts 0
# assumption: the type is only ts if fetch has already been checked
if {$type eq "ts"} {
require epg.class ts.class
set ts [ts fetch $file 1]
} elseif {$type eq "bad"} {
require epg.class ts.class
set ts [ts fetchhmt $file]
}
if {$ts != 0} {
# Causes other series information to be automatically populated
set epname [$ts episode_name]
set series [$ts series_name]
@ -154,73 +161,77 @@ if {$type eq "ts"} {
<td>"
puts [clock format [$ts get end] -format "%c %Z"]
puts "<font class=also>(Scheduled: [clock format \
[expr [$ts get schedstart] + [$ts get scheddur]] \
$([$ts get schedstart] + [$ts get scheddur]) \
-format "%c %Z"])</font>"
set duration [$ts duration]
set durmins $($duration == 1 ? "minute" : "minutes")
set resume [$ts get resume]
set resmins $($resume == 1 ? "minute" : "minutes")
puts "</td>
</tr><tr>
<th>Duration</th>
<td>[$ts duration] minute(s).
<font class=also>(Scheduled: [expr [$ts get scheddur] / 60])
<td>$duration $durmins.
<font class=also>(Scheduled: $([$ts get scheddur] / 60))
</font></td>
</tr><tr>
<th>Status</th>
<td>[$ts get status]</td>
</tr><tr>
<th>Resumes</th>
<td>[expr [$ts get resume] / 60] minutes into recording.
[progressbar $([$ts get resume] * 100 / [$ts duration 1])]
<td>$($resume / 60) $resmins into recording.
[progressbar $($resume * 100 / [$ts duration 1])]
</td>
</tr><tr>
<th>Size</th>
<td>$sz</td>
"
lassign [$ts dlnaloc] url
if {$url ne ""} {
lassign [$ts dlnaloc] url
if {$url ne ""} {
puts "</tr><tr><th>DLNA&nbsp;URL</th>
<td><a href=\"$url\">$url</a></td>"
<td><a href=\"$url\">$url</a></td>"
}
puts "
puts "
</tr><tr>
<th>Files</th>
<td>
"
set fileset [$ts fileset]
puts -nonewline "<img class=collapser x=fileset id=xfileset class=va
set fileset [$ts fileset]
puts -nonewline "<img class=collapser x=fileset id=xfileset class=va
src=/img/tree/plusonly.png>"
puts -nonewline "[llength $fileset] file"
if {[llength $fileset] != 1} { puts -nonewline "s" }
puts -nonewline " in set."
puts "<div id=fileset class=hidden><ul>"
foreach f $fileset {
puts "<li>[file tail $f] ([pretty_size [file size $f]])</li>"
}
puts "</ul></div>"
puts -nonewline "[llength $fileset] file"
if {[llength $fileset] != 1} { puts -nonewline "s" }
puts -nonewline " in set."
puts "<div id=fileset class=hidden><ul>"
foreach f $fileset {
puts "<li>[file tail $f] ([pretty_size [file size $f]])</li>"
}
puts "</ul></div>"
puts "</td></tr>"
puts "</td></tr>"
eval_plugins browsetsfile
eval_plugins browsetsfile
puts "<tr>
puts "<tr>
<th>Flags</th>
<td>[set flags [$ts get flags]]</td>
</tr>
</tr>
"
if {[$ts get bookmarks]} {
if {[$ts get bookmarks]} {
puts "
<tr>
<tr>
<th>Bookmarks</th>
<td>[$ts get bookmarks] @ [join [lmap i [$ts bookmarks 1] {
clock format $i -format "%T"
}] ", "]
</td>
</tr>
"
}
</tr>
"
}
puts "<div class=hidden id=file>$file</div>"
puts {
puts "<div class=hidden id=file>$file</div>"
puts {
<script type=text/javascript>
var file = $('#file').text();
$('button').button();
@ -256,12 +267,11 @@ $('img.rollimg').hover(
);
</script>
}
}
}
} else {
# Otherwise, for a general file.
if {$type ne "ts"} {
puts "
<table class=keyval>
<tr>
@ -274,23 +284,42 @@ if {$type ne "ts"} {
}
set hasffmpeg 0
if {$type ne "ts" || ("ODEncrypted" ni $flags && $url eq "") } {
proc ffinfo {} {
puts "<tr>
<th>Info</th>
<td class=pre id=ffmpeg>
<img src=/img/spin.gif><i>Loading...</i>
</td>
</tr>"
set hasffmpeg 1
} elseif {$type eq "ts" && $url ne ""} {
puts [format {
<script type="text/javascript">
$('#playDL').attr('href','%s').enable();
</script> } $url]
<th>Info</th>"
if {$::hasffmpeg} {
puts " <td class=pre id=ffmpeg>
<img src=/img/spin.gif><i>Loading...</i>
</td>"
} else {
puts "<td>Encrypted</td>"
}
puts "</tr>"
}
if {$type eq "ts"} {
if {$url ne ""} {
puts [format {
<script type="text/javascript">
$('#playDL').attr('href','%s').enable();
</script> } $url]
}
} elseif {$type ne "bad"} {
if {[string tolower [file extension $file]] != ".ts"} {
set hasffmpeg 1
} else {
if {![exec /mod/bin/stripts -qE [file rootname $file]]} {
set hasffmpeg 1
}
}
ffinfo
}
puts "
</table>
"
</table>
"
if {$hasffmpeg} {
set url "/browse/ffmpeg.jim?file=[cgi_quote_url $file]"

View File

@ -20,8 +20,7 @@ header
set nicesplice [system pkginst nicesplice]
set ignore {.nts .thm .hmi}
set include {.ts .avi .mpg .mpeg .wmv .mkv .mp3 .mp4 .mov .hmt .m4v .m4a .webm}
source /mod/webif/include/extensions.jim
if {![dict exists $env SCRIPT_NAME]} {
set env(SCRIPT_NAME) ""
@ -142,7 +141,7 @@ proc entry {file} {{i 0}} {
if {[$ts get definition] eq ""} {
set type gen
set ts 0
set img Video_Other
set img Video_Other
set omenu oopt
} else {
set omenu opt
@ -215,8 +214,8 @@ proc entry {file} {{i 0}} {
# Indexed
set dlna 0
if {$::dlnaok && $::model eq "HDR" &&
[llength [system dlnaurl $file]]} {
if {$::dlnaok && $::model eq "HDR" && [llength [
system dlnaurl [file normalize $file]]]} {
icon "/img/dlna.png" "Indexed by DLNA Server"
set dlna 1
}
@ -303,7 +302,7 @@ if {$parent ne ""} {
"
}
proc s_file_stat {a b attr} {
proc s_file_stat {a b attr {rev 0}} {
global dir
set a "$dir/$a"
@ -325,8 +324,8 @@ proc s_file_stat {a b attr} {
if {[catch {file stat $b l}]} { return 0}
set bt $l($attr)
if {$at < $bt} { return -1 }
if {$at > $bt} { return 1 }
if {$at < $bt} { return $($rev ? 1 : -1) }
if {$at > $bt} { return $($rev ? -1 : 1) }
return 0
}
@ -334,16 +333,35 @@ proc s_time {a b} {
tailcall s_file_stat $a $b mtime
}
proc s_time_r {a b} {
tailcall s_file_stat $a $b mtime 1
}
proc s_size {a b} {
tailcall s_file_stat $a $b size
}
proc s_size_r {a b} {
tailcall s_file_stat $a $b size 1
}
proc s_ext {a b} {
set at [file extension $a]
set bt [file extension $b]
if {$at == $bt} {
return [string compare -nocase $a $b]
} else {
return [string compare -nocase $at $bt]
}
}
set files [readdir -nocomplain $dir]
switch $order {
1 { set files [lsort -command s_time $files] }
2 { set files [lreverse [lsort -command s_time $files]] }
2 { set files [lsort -command s_time_r $files] }
3 { set files [lsort -command s_size $files] }
4 { set files [lreverse [lsort -command s_size $files]] }
4 { set files [lsort -command s_size_r $files] }
5 { set files [lsort -command s_ext $files] }
default { set files [lsort -nocase $files] }
}
@ -351,19 +369,20 @@ set dinuse [system dirinuse $dir]
foreach file $files { entry "$dir/$file" }
puts "
<a href=# id=selectall>Select all</a> | <a href=# id=deselectall>none</a>
&nbsp;&nbsp;
Directories: $dircount, Files: $filecount
Select: <a href=# id=selectall>All</a> | <a href=# id=deselectall>None</a>
&nbsp;&nbsp;Folders: $dircount, Files: $filecount
"
# Sort icons
puts "<div id=sortdiv>"
set sortlist {
{0 sort_name name {Alphabetical order A->Z}}
{1 sort_date date {Oldest first}}
{2 sort_date reverse-date {Newest first}}
{3 sort_size size {Smallest first}}
{4 sort_size reverse-size {Largest first}}}
{0 sort_name Name {Alphabetical order A->Z}}
{5 sort_type Type {Type A->Z}}
{1 sort_date Date {Oldest first}}
{2 sort_date Reverse-date {Newest first}}
{3 sort_size Size {Smallest first}}
{4 sort_size Reverse-size {Largest first}}
}
puts "
Sort by: "
foreach sl $sortlist {

View File

@ -28,6 +28,6 @@ system endop $token
set ts [ts fetch "$dir/$dst.ts"]
$ts settitle $dst
set jointime [expr [expr [clock milliseconds] - $joinstart] / 1000.0]
set jointime $(([clock milliseconds] - $joinstart) / 1000.0)
puts "Time taken: $jointime"

View File

@ -16,7 +16,7 @@ if {![file exists $file]} {
} else {
set sz [file size $file]
set perc [expr $sz * 100 / $expected]
set perc $($sz * 100 / $expected)
if {$perc > 100} { set perc 100 }
puts $perc
}

View File

@ -7,7 +7,6 @@ require ts.class
httpheader
set file [cgi_get file ""]
set ts [ts fetch $file]
if {[set ts [ts fetch $file]] != 0} {
set action lock
if {[$ts flag "Locked"]} { set action unlock }

View File

@ -9,7 +9,7 @@ httpheader "application/json"
set dir [cgi_get dir "/media/My Video/test"]
puts "{"
foreach file [readdir $dir] {
foreach file [readdir -nocomplain $dir] {
if {[file extension $file] ne ".mp3"} continue
if {[catch {

View File

@ -18,6 +18,6 @@ set token [system startop -multiple mpg $rfile]
$ts mkmpg
system endop $token
set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
set xtime $(([clock milliseconds] - $xstart) / 1000.0)
puts "Time taken: $xtime"

View File

@ -14,9 +14,9 @@ if {![file exists "${bfile}.mpg"]} {
puts "0"
} else {
set sz [file size $rfile]
set nsz [expr [file size "${bfile}.mpg"] / 0.75]
set nsz $([file size "${bfile}.mpg"] / 0.75)
set perc [expr $nsz * 100 / $sz]
set perc $($nsz * 100 / $sz)
if {$perc > 100} { set perc 100 }
puts $perc
}

View File

@ -7,7 +7,6 @@ require ts.class
httpheader
set file [cgi_get file]
set ts [ts fetch $file]
if {[set ts [ts fetch $file]] != 0} {
set action new
if {[$ts flag "New"]} { set action watched }

View File

@ -15,7 +15,7 @@ set vc [cgi_get vc ""]
set url $file
# Prefer to use DLNA server ... (necessary if encrypted)
set dlna [system dlnaurl $url $urlbase]
set dlna [system dlnaurl [file normalize $url] $urlbase]
if {[llength $dlna]} {
set url [lindex $dlna 0]
} elseif {[regexp {^(https?://(.+:.*@)?[[:alnum:].]+(:[[:digit:]]+)?)/} $urlbase x y]} {
@ -27,6 +27,7 @@ if {[llength $dlna]} {
if {[file extension $file] in {.ts .TS}} {
if {![catch {set ts [ts fetch $file]}] && $ts != 0} {
set duration [$ts duration 1]
$ts set_watched
}
}

View File

@ -26,9 +26,7 @@ if {[file isdirectory $file]} {
set new [string map {"\n" ""} [
string trim [cgi_get "rename_$attr"]]]
set old [$ts get $attr]
if {$attr eq "title" || $attr eq "synopsis"} {
set new "\025$new"
} elseif {$attr eq "genre"} {
if {$attr eq "genre"} {
set new [ts genre $new]
}
if {$new ne $old} {

View File

@ -809,13 +809,13 @@ var $dialog = $('#dialogue').dialog({
});
/* insert button-like Download link before Play */
$('#play').before(function(i){
var dl = document.createElement('a');
dl.setAttribute('class', this.className);
dl.id = this.id + 'DL';
dl.innerHTML = 'Download';
return dl;
});
$('#play').before(function(i){
var dl = document.createElement('a');
dl.setAttribute('class', this.className);
dl.id = this.id + 'DL';
dl.innerHTML = 'Download';
return dl;
});
function doplay(it)
{
@ -826,7 +826,7 @@ function doplay(it)
var fmts = "";
var vc = ""
var ff = $('#ffmpeg')[0];
if (ff) {
/* extract duration, container and video codec from ffmpeg output */
ff = ff.innerHTML;
@ -877,6 +877,7 @@ $('a.bf').click(function(e) {
$dialog.attr('type', type);
$('#playDL').attr('download', file.replace(/.*\//, ''));
$('#play, #playDL').enable();
if (type == 'ts') {
if (opt.attr('odencd') != 0) {
@ -888,11 +889,13 @@ $('a.bf').click(function(e) {
/* link unencrypted file directly */
$('#playDL').attr('href', file);
}
} else if (type == 'bad') {
$('#play, #playDL').disable();
} else {
/* generic: enable Play once media file is parsed */
$('#play').disable();
$('#play, #playDL').disable();
$('#playDL').attr('href', file);
}
}
$dialog.dialog('open');
});

View File

@ -24,7 +24,7 @@ foreach line [split $dutxt "\n"] {
}
# Handle symbolic links.
foreach file [readdir $dir] {
foreach file [readdir -nocomplain $dir] {
set file "$dir/$file"
if {[catch {set lk [file readlink $file]}]} continue

View File

@ -51,6 +51,6 @@ ts renamegroup "$dir/$shname.ts" $newname
exec /mod/bin/hmt "+setfilename=$newname" "$dir/$newname.hmt"
exec /mod/bin/hmt "+shrunk" "$dir/$newname.hmt"
set striptime [expr [expr [clock milliseconds] - $stripstart] / 1000.0]
set striptime $(([clock milliseconds] - $stripstart) / 1000.0)
puts "Time taken: $striptime"

View File

@ -17,7 +17,7 @@ if {![file exists $ntsfile]} {
set sz [file size $origfile]
set nsz [file size $ntsfile]
set perc [expr $nsz * 100 / $sz]
set perc $($nsz * 100 / $sz)
if {$perc > 100} { set perc 100 }
puts $perc
}

View File

@ -59,11 +59,11 @@ puts "<div style=\"width=100%; text-align: center\">
<input name=pos id=pos size=5 maxlength=4 value=\"$pos\">
second(s) into recording.
</form>
<button class=mvpos pos=[expr $pos - 30]>&lt;&lt; 30 seconds</button>
<button class=mvpos pos=[expr $pos - 5]>&lt; 5 seconds</button>
<button class=mvpos pos=$($pos - 30)>&lt;&lt; 30 seconds</button>
<button class=mvpos pos=$($pos - 5)>&lt; 5 seconds</button>
<button id=repos>Update</button>
<button class=mvpos pos=[expr $pos + 5]>&gt; 5 seconds</button>
<button class=mvpos pos=[expr $pos + 30]>&gt;&gt; 30 seconds</button>
<button class=mvpos pos=$($pos + 5)>&gt; 5 seconds</button>
<button class=mvpos pos=$($pos + 30)>&gt;&gt; 30 seconds</button>
</div>
<span id=start class=hidden>$start</span>
<span id=end class=hidden>$limit</span>
@ -71,7 +71,7 @@ puts "<div style=\"width=100%; text-align: center\">
<tr>
"
for {set i [expr $start + 0.0]} {$i <= $limit} {set i [expr $i + 0.5]} {
for {set i $($start + 0.0)} {$i <= $limit} {set i $($i + 0.5)} {
lappend times $i
puts "<th style=\"text-align: center\">
@ <span class=mark>$i</span>s</th>"

View File

@ -9,11 +9,11 @@ httpheader
set rfile [cgi_get file]
set s [cgi_get s 0]
set e [cgi_get e $($s + 2)]
set i [expr [cgi_get i 0.5] + 0.0]
set i $([cgi_get i 0.5] + 0.0)
if {![catch {set ts [ts fetch $rfile]}]} {
$ts cleanbmp
for {set n [expr $s + 0.0]} {$n <= $e} {set n [expr $n + $i]} {
for {set n $($s + 0.0)} {$n <= $e} {set n $($n + $i)} {
puts "Generating thumbnail for pos $n"
$ts mkbmp $n ".pos$n"
}

View File

@ -28,7 +28,7 @@ foreach dir $dirs {
if {!$auto} { puts "\[$dir\]" }
loadseries $dir
foreach file [lsort -command dedupsort [readdir $dir]] {
foreach file [lsort -command dedupsort [readdir -nocomplain $dir]] {
if {[file extension $file] ne ".nts"} { continue }
set file "$dir/[file rootname $file].hmt"

View File

@ -28,7 +28,7 @@ puts "<fieldset style=\"display: inline\">
loadseries $dir
set recalc 0
foreach file [lsort -command dedupsort [readdir $dir]] {
foreach file [lsort -command dedupsort [readdir -nocomplain $dir]] {
set file "$dir/$file"
if {[file extension $file] ne ".nts"} { continue }

View File

@ -4,7 +4,7 @@ require system.class
proc dedupsort {a b} {
global dir
return [expr [file mtime "$dir/$a"] > [file mtime "$dir/$b"]]
return $([file mtime "$dir/$a"] > [file mtime "$dir/$b"])
}
proc dedupprocess {file} {{seen {}}} {

View File

@ -30,7 +30,10 @@ puts "
<table>
<tr><th class=key>SMART Status</th><td>$smart<td></tr>
"
foreach line [split [exec /bin/smartctl -i $device] "\n"] {
if {[catch {set msg [exec /bin/smartctl -i $device]} xmsg]} {
set msg $xmsg
}
foreach line [split $msg "\n"] {
if {[string match "*Not in smartctl database*" $line]} continue
if {[string match "*: *" $line]} {
regsub -all -- {[[:space:]]+} $line " " line
@ -81,7 +84,7 @@ proc flags {val} {
set f ""
set fx ""
loop i 0 [llength $flaglist] {
if {[expr $val & (1 << $i)]} {
if {$val & (1 << $i)} {
append f [lindex $flaglist $i]
append fx "[lindex $flagdescr $i]\n"
} else {
@ -95,8 +98,11 @@ set nolife {184 187 188 189 191 197 198}
set derive {4 "" 5 sectors 9 hours 12 cycles 192 "" 193 "cycles"}
if {[catch {set msg [exec /bin/smartctl -A $device]}]} {
set msg ""
}
set i 0
foreach line [split [exec /bin/smartctl -A $device] "\n"] {
foreach line [split $msg "\n"] {
regsub -all -- {[[:space:]]+} $line " " line
regsub -all -- {^[[:space:]]+} $line "" line
if {[incr i] < 8} continue
@ -129,20 +135,18 @@ foreach line [split [exec /bin/smartctl -A $device] "\n"] {
set left ""
if {$flags eq ""} { set flags 0 }
if {$id ni $nolife &&
[expr $flags & 0x18] == 0x10 && $val == $worst && $val <= 100 &&
($flags & 0x18) == 0x10 && $val == $worst && $val <= 100 &&
$thresh < 100} {
# Event counter which is not a rate and has not regressed.
set notes ""
set left [expr 100 - 100 * (100 - $val) / (100 - $thresh)]
set left $(100 - 100 * (100 - $val) / (100 - $thresh))
if {$left < 10} { set class orangeshade }
# rval can be non-numeric (e.g. 6078h+41m+22.260s)
if {[regexp {^\d+$} $rval] && $rval > 0 && [\
dict exists $derive $id]} {
if {$left < 100} {
set total [expr \
round(($rval / (100 - $left) * 100) \
/ 10000) * 10000 \
]
set total $(round(($rval / (100 - $left) \
* 100) / 10000) * 10000)
set remain $($total - $rval)
set notes "$remain of approximately"
append notes " $total $derive($id)"
@ -151,9 +155,9 @@ foreach line [split [exec /bin/smartctl -A $device] "\n"] {
set left "<span title=\"$notes\">$left%</span>"
}
if {$id == 190} {
append val " ([expr 100 - $val]&deg;C)"
append worst " ([expr 100 - $worst]&deg;C)"
append thresh " ([expr 100 - $thresh]&deg;C)"
append val " ($(100 - $val)&deg;C)"
append worst " ($(100 - $worst)&deg;C)"
append thresh " ($(100 - $thresh)&deg;C)"
}
puts "<tr class=$class>
<td>$id</td>
@ -185,17 +189,17 @@ puts {
</tr>
}
if {[catch {set msg [exec /bin/smartctl -l selftest $device]} xmsg]} {
set msg $xmsg
if {[catch {exec /bin/smartctl -l selftest $device} msg]} {
set rc [lindex $::errorCode 2]
set rc $($rc eq "" ? 1 : $rc & 7)
if {$rc} { set msg "" }
}
set i 0
foreach line [split $msg "\n"] {
regsub -all -- {[[:space:]][[:space:]]+} $line "|" line
if {[incr i] < 7} continue
lassign [split $line "|"] id name status remaining when lba
if {[string length $id] > 10} continue
if {$id eq ""} continue
if {[regexp {\s*#\s*(\d+)\s+((?:[\s-]?\w[:;.,]?)+)\s+((?:[\s-]?\w[:;.,]?)+?)\s+(\d\d?%)\s+(\d+)\s+([\d-]\d*)} \
$line x id name status remaining when lba] == 0} continue
puts "<tr>
<td>$id</td>
<td>$name</td>

View File

@ -7,10 +7,8 @@ httpheader
set settings [settings]
foreach attr {realloc pending offline} {
foreach attr {realloc pending offline spinretry} {
set val [$settings _nval_setting "SMART_$attr"]
if {$val < 0} continue
$settings _nval_setting "SMART_ack_$attr" $val
}

View File

@ -12,11 +12,10 @@ if {[catch {set db [sqlite3.open /var/lib/humaxtv/channel.db]} msg]} {
exit
}
pkg loadmuxdb
pkg removemuxdb
proc f2c {frequency} {
set ch int($((($frequency / 1000) - 303.25) / 8))
return [expr int($ch)]
return $(int((($frequency / 1000) - 303.25) / 8))
}
proc svc2mux {svcid mux} {
@ -67,7 +66,7 @@ foreach tw [$db query {
puts "
<tr class=odd>
<td>[f2c $ulFrequency]</td>
<td>[expr $ulFrequency / 1000.0] MHz</td>
<td>$($ulFrequency / 1000.0) MHz</td>
"
puts "<td>[progressbar $ucLevel]</td>"
puts "<td>[progressbar $ucQuality]</td>"

View File

@ -11,8 +11,8 @@ set autofreq [$s autofreq]
if {$autofreq == 0} { set autofreq 10 }
puts "{"
puts " \"autofreq\": \"$autofreq\","
puts " \"autolast\": \"[clock format $autolast] ([clock format [expr \
[clock seconds] - $autolast] -format %T] ago)\","
puts " \"autolast\": \"[clock format $autolast] ([clock format \
$([clock seconds] - $autolast) -format %T] ago)\","
puts " \"data\": \["
set flag 0
@ -33,7 +33,7 @@ foreach q [queue all] {
}
set start [$q get start]
if {$start ne "0"} { set start $($start - [clock seconds]) }
if {$start ne "0"} { set start $([clock seconds] - $start) }
if {$flag} { puts "," } else { incr flag }
puts "{"

View File

@ -57,6 +57,7 @@ There are no tasks in the queue.
<button id=qresubmit act=resubmit class="submit needssel">Re-submit</button>
<button id=qhold act=hold class="submit needssel">Hold</button>
<button class=refresh id=refresh>Refresh</button>
<button id=viewlog class=needsdata>View auto.log</button>
<span class=isloading><img src=/img/spin.gif></span>
</div>
<div id=lastscan>Last media scan: <span id=autolast>retrieving...</span> -

View File

@ -103,6 +103,8 @@ function load()
$(function() {
var loader=0;
$('table')
.tablesorter({
sortList: [[0,1]],
@ -198,7 +200,20 @@ $('#queuetab').on('click', 'a.file', function(e) {
encodeURIComponent('{root}/' + dirname(file));
});
setInterval(load, 60000);
$('#viewlog').button().click(function() {
window.location = '/log/?log=/mod/tmp/auto.log';
});
function set_loader() {
if (loader != 0)
clearInterval(loader);
loader=setInterval(load, 60000);
}
$('#queuetab').on('change', 'input[type=checkbox]', set_loader);
set_loader();
});

View File

@ -12,7 +12,7 @@ set file [cgi_get file -]
set backdesc [cgi_get backdesc "Back to diagnostics"]
set backlink [cgi_get backlink "/diag/diag.jim"]
if {$file ne "-"} {
puts "<script type=text/javascript>forcefile = '$file';</script>"
puts "<script type=text/javascript>forcefile = \"[cgi_quote_url $file]\";</script>"
}
puts {

View File

@ -11,20 +11,23 @@ set file [cgi_get file "/tmp/hosts"]
if {$file eq "-"} { exit }
httpheader "text/plain" 0
set maxfsize 102400
if {![file exists $file]} {
puts ">>> File $file does not exist.\r\n"
puts ">>> File $file does not exist."
} else {
set type [exec /mod/bin/file --brief --mime-type --dereference $file]
if {![string match {text/*} $type]} {
puts ">>> File $file is not a plain file ($type)"
} elseif {[file size $file] > 102400} {
puts ">>> File $file is too large."
puts ">>> [pretty_size [file size $file]]"
if {!([string match {text/*} $type] || [string match {application/xml*} $type])} {
puts ">>> File $file is not an editable type ($type)."
} else {
set fp [open $file r]
puts [read $fp]
close $fp
set fsize [file size $file]
if {$fsize > $maxfsize} {
puts ">>> File $file is too large ([pretty_size $fsize] > [pretty_size $maxfsize])."
} else {
set fp [open $file r]
puts [read $fp]
close $fp
}
}
}

View File

@ -9,7 +9,7 @@ var changed = false;
$('button').button();
$('button.editactive').disable();
$('#editor').tabsupport().disable();
$('#editor').tabsupport().disable().val('');
$('#open').button({icons: {primary: "ui-icon-folder-open"}});
$('#revert').button({icons: {primary: "ui-icon-refresh"}});
@ -189,7 +189,7 @@ $('#executable').on('click', function() {
if (forcefile)
{
loadfile(forcefile);
loadfile(decodeURIComponent(forcefile));
$('#open,#create,#qedit').remove();
}

View File

@ -110,11 +110,9 @@ puts "
</a><br>
"
set end [clock milliseconds]
puts "<font class=footnote>
Retrieved in: [expr [expr $got - $start] / 1000.0] seconds.
Rendered in: [expr [expr $end - $start] / 1000.0] seconds.
</font>"
Retrieved in: $(($got - $start) / 1000.0) seconds.
</font>"
epg cleanup

View File

@ -78,7 +78,7 @@ puts "
<tr>
<th class=hour></th>
"
set t [clock seconds]
set t [midnight]
set firstday [clock format $t -format {%Y%m%d}]
set daymap {}
loop i 0 8 {
@ -87,7 +87,7 @@ loop i 0 8 {
set day [clock format $t -format {%Y%m%d}]
set daymap($day) $i
set dayrmap($i) $day
incr t 86400
set t [midnight_local $($t+93600)]
}
puts "
</tr>

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

View File

@ -30,7 +30,7 @@ $(document).ready(function() {
source /mod/webif/include/menuicons.jim
if {[$settings notwitfeed] == 0} {
source /mod/webif/include/twitfeed.jim
# source /mod/webif/include/twitfeed.jim
}
puts {<div class=cleft>}

View File

@ -22,7 +22,6 @@ setInterval(updateidle, 60000);
if ($('#vfd').length)
{
function updatevfd()
{
$.get('/cgi-bin/vfd.jim', function(vfd) {
@ -34,5 +33,18 @@ if ($('#vfd').length)
setInterval(updatevfd, 5000);
}
if ($('#status_txt').length)
{
function updatestatus()
{
$.get('/cgi-bin/status.jim', function(status) {
$('#status_txt').html(status);
});
}
updatestatus();
setInterval(updatestatus, 60000);
}
});

View File

@ -6,7 +6,7 @@ puts {
}
catch {
set rendertime [expr ([clock milliseconds] - $renderstart) / 1000.0]
set rendertime $(([clock milliseconds] - $renderstart) / 1000.0)
puts "<span class=footnote>Rendered in: $rendertime seconds</span>"
}

View File

@ -17,5 +17,6 @@ incr ::mws::headerdone
puts {
</head>
<body>
<div>
}

View File

@ -6,8 +6,7 @@ require ts.class pretty_size system.class settings.class escape browse.class
cgi_input
set ignore {.nts .thm .hmi}
set include {.ts .avi .mpg .mpeg .wmv .mkv .mp3 .mp4 .mov .hmt}
source /mod/webif/include/extensions.jim
set dir [cgi_get dir [system mediaroot]]

View File

@ -41,8 +41,8 @@ foreach o $others {
if {[$o get series_crid] eq ""} { set ro 1 } else { set ro 2 }
puts -nonewline "<br><font class=also>&nbsp;&nbsp;&nbsp;&nbsp;"
puts -nonewline "Also: "
puts -nonewline "<a href=event_d.jim?sid=[$o get service_id]&"
puts -nonewline "eid=[$o get event_id] data-rel=dialog>"
puts -nonewline "<a href=\"event_d.jim?sid=[$o get service_id]&"
puts -nonewline "eid=[$o get event_id] data-rel=dialog\">"
puts -nonewline "[clock format [$o get start] -format {%c %Z}]"
puts -nonewline " on "
puts -nonewline [$o channel_icon 16]

View File

@ -5,7 +5,7 @@ proc epgcell {e {aside 0}} {
set et $($st + [$e get duration])
puts "
<li><a data-rel=dialog data-transition=slidedown
href=event_d.jim?sid=[$e get service_id]&eid=[$e get event_id]>
href=\"event_d.jim?sid=[$e get service_id]&eid=[$e get event_id]\">
[$e channel_icon 80]
<h4>[$e get name]</h4>
<p class=datetime>
@ -19,11 +19,11 @@ proc epgcell {e {aside 0}} {
"
set guidance [$e get warning]
if {$guidance ne ""} {
puts "<p class=blood style=\"white-space: normal\">
puts " <p class=blood style=\"white-space: normal\">
$guidance</p>"
}
if {[$e showing]} {
puts "<p>[progressbar [$e percent]]</p>"
puts " <p>[progressbar [$e percent]]</p>"
}
if {$aside} {
puts "
@ -33,5 +33,6 @@ proc epgcell {e {aside 0}} {
</p>
"
}
puts " </a></li>"
}

View File

@ -17,13 +17,15 @@ puts "
puts {
<meta charset="utf-8">
<meta name="viewport" content="user-scalable=no,initial-scale=1">
<meta name=apple-mobile-web-app-capable content=yes>
<meta name=apple-mobile-web-app-status-bar-style content=black>
<meta name="apple-mobile-web-app-capable" "content=yes">
<meta name="apple-mobile-web-app-status-bar-style" "content=black">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="/lib/jquery.mobile/jquery.mobile.css" />
<link rel="stylesheet" href="/m/style.css" type="text/css"/>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/lib/jquery.mobile/jquery.mobile.js">
</script>
<script type="text/javascript" src="/lib/jquery.mobile/jquery.mobile.js"></script>
<script type="text/javascript" src="/lib/jquery.plugin/enadis/enadis.js?1.5.2-8"></script>
<script type="text/javascript" src="/m/script.js"></script>
<link rel="apple-touch-icon" href="/img/mobile_57.png" />
<link rel="apple-touch-icon" sizes="57x57" href="/img/mobile_57.png" />
@ -31,7 +33,6 @@ puts {
<link rel="apple-touch-icon" sizes="114x114" href="/img/mobile_114.png" />
<link rel="apple-touch-icon" sizes="144x144" href="/img/mobile_144.png" />
}
noheader
jqplugin enadis
puts {
</head>

View File

@ -25,14 +25,14 @@ foreach e $records {
}
set lcn $chnum
puts "<li><a href=channel.jim?sid=[$e get service_id]>
puts "<li><a href=\"channel.jim?sid=[$e get service_id]\">
[$e channel_icon 80]"
set entries 0
}
set es [$e get start]
set ee [expr $es + [$e get duration]]
set ee $($es + [$e get duration])
$e process_sched
set recopts 1

View File

@ -55,7 +55,7 @@ proc eventtab {type title} {
}
puts "
<li><a data-rel=dialog data-transition=slidedown
href=schedule_d.jim?table=$type&slot=[$event get ulslot]>
href=\"schedule_d.jim?table=$type&slot=[$event get ulslot]\">
[epg channelicon [$event channel_name] 80]
<h3>$icons $name</h3>
<p>

View File

@ -65,7 +65,7 @@ puts "[clock format $s -format "%a %d %b %Y"]
if {$d > 0 && $n > $s && $n < $e} {
puts "<br>"
set perc [expr [expr $n - $s] * 100 / $d]
set perc $(($n - $s) * 100 / $d)
puts "<img class=va src=/images/745_1_11_Video_1REC.png>"
puts [progressbar $perc]
}

View File

@ -56,7 +56,7 @@ $('#pkgtabs').tabs({
var $dialog = $('#dialogue').dialog({
title: "Package Management Results",
modal: false, autoOpen: false,
height: 500, width: 700,
height: 500, width: 800,
show: 'scale', hide: 'fade',
draggable: true, resizable: true,
buttons: { "Close":
@ -139,7 +139,8 @@ function execopkg(arg, pkg)
error: function(_, _, e) {
if (window.console)
console.log("ajax error");
alert(e);
if (e.trim().length)
alert(e);
}
});
busy = false;

View File

@ -33,7 +33,9 @@ puts {
<fieldset class=cleft style="margin: 0 1em 1em 1em">
<legend>VLC Player</legend>
}
puts "<span class=also>Now playing: $rfile, [$ts duration] minutes.</span>"
set duration [$ts duration]
set mins $($duration == 1 ? "minute" : "minutes")
puts "<span class=also>Now playing: $rfile, $duration $mins.</span>"
puts {
<div id=vlc></div>

View File

@ -3,19 +3,25 @@
package require cgi
source /mod/webif/lib/setup
require settings.class
require rsv.class
set dir "/mod/var/backup"
httpheader
set prefix "auto"
if {$argc > 0} {
set prefix [lindex $argv 0]
}
set now [clock seconds]
set file [file tail [cgi_get file \
[clock format $now -format "auto-%Y-%b-%d-%H:%M"]]]
[clock format $now -format "$prefix-%Y-%b-%d-%H:%M"]]]
if {[string match {auto-*} $file]} {
# Delete any automatic backups over 15 days old.
set mt $(15 * 86400)
# Delete any old automatic backups.
set mt $([[settings] backupsage] * 86400)
foreach af [glob -nocomplain "$dir/auto-*"] {
set aft [file mtime $af]
set diff $($now - $aft)

View File

@ -17,7 +17,7 @@ set svckeys [array names svcmap]
set conflictstart [clock milliseconds]
set conflicts [rsv newconflicts [system tuners] "xlist"]
set conflicttime [expr ([clock milliseconds] - $conflictstart) / 1000.0]
set conflicttime $(([clock milliseconds] - $conflictstart) / 1000.0)
if {[llength $conflicts] > 1} {
puts "<div class=warningbox><div><center>
@ -109,7 +109,7 @@ proc eventrow {event {table TBL_RESERVATION}} {
set attrs "table=$table sid=[$event get ulslot] \
reckind=[$event get ucRecKind] rsvtype=[$event get ersvtype] \
ar=[expr ! [$event padded]] ended=$ended"
ar=$(! [$event padded]) ended=$ended"
set ek [ekey $event]
set opts 1
@ -289,7 +289,7 @@ proc eventrow {event {table TBL_RESERVATION}} {
foreach e $elist {
lassign $e service_id start end event_id
if {$start == $s} continue
if {[incr i] == $max && [expr $c - $i] > 1} {
if {[incr i] == $max && ($c - $i) > 1} {
puts "<div class=\"hidden moretoshowc\">"
} else {
puts "<br>"

View File

@ -55,7 +55,7 @@ puts "[clock format $s -format "%a %d %b %Y"]
if {$d > 0 && $n > $s && $n < $e} {
puts "<br>"
set perc [expr [expr $n - $s] * 100 / $d]
set perc $(($n - $s) * 100 / $d)
puts "<img class=va src=/images/745_1_11_Video_1REC.png>"
puts [progressbar $perc]
}
@ -75,7 +75,7 @@ if {$crid != ""} {
puts " CRID</th><td>"
puts -nonewline "<a href=/cgi-bin/epg/search.jim?"
if {[$event isseries]} { puts -nonewline "s" }
puts "crid=/$crid>
puts "crid=/[cgi_quote_url $crid]>
<img border=0 src=/images/421_1_00_CH_Title_2R_Arrow.png
height=14>
[$event get szCRID]"
@ -90,7 +90,7 @@ proc cridlist {events} {
incr flag
set crid [join [lrange [split $ev /] 1 end] /]
puts -nonewline "<a href=/cgi-bin/epg/search.jim?"
puts "crid=/$crid>
puts "crid=/[cgi_quote_url $crid]>
<img border=0 src=/images/421_1_00_CH_Title_2R_Arrow.png
height=14>
$ev"

View File

@ -23,7 +23,7 @@ lmap i \
#set svcmap [lreverse $hmap]
proc lsum {l} {
expr [join $l +] + 0
expr [join [linsert $l 0 0] +]
}
proc pop_event {} {
@ -132,7 +132,7 @@ set padadj 0
# Returns an absolute number of pixels from the left corresponding
# to a number of seconds into the day.
proc secstopx {daysecs hourpx usedhours} {
set max [expr int($daysecs / 3600)]
set max $(int($daysecs / 3600))
# Subtract any unused hours from $daysecs.
for {set i 0} {$i < $max} {incr i} {
if {$i >= 24} break
@ -140,7 +140,7 @@ proc secstopx {daysecs hourpx usedhours} {
incr daysecs -3600
}
}
return [expr int($daysecs * $hourpx / 3600)]
return $(int($daysecs * $hourpx / 3600))
}
# daysecs - absolute number of seconds into the day that needs to be reached.
@ -295,7 +295,7 @@ proc render_timeline {usedhours} {
}
# calculate pixels per hour
set hourpx [expr int($width / $tothours)]
set hourpx $(int($width / $tothours))
if {$debug} {
puts "USEDHOURS: $usedhours<br>\n"
@ -320,6 +320,7 @@ proc render_timeline {usedhours} {
# Midnight today.
set day [midnight]
set gday [midnight_gmt $day]
set elength [llength $events]
set eindex 0
@ -344,8 +345,8 @@ proc render_timeline {usedhours} {
puts "<div class=\"ct_day $class\">"
puts "<div class=\"ct_row\">"
puts "<div class=ct_dayname>[clock format $day \
-format {%a %d/%m/%Y}]</div>"
puts "<div class=ct_dayname>[clock format $gday \
-format {%a %d/%m/%Y} -gmt 1]</div>"
set pxpos [set padadj 0]
@ -410,6 +411,7 @@ proc render_timeline {usedhours} {
}
incr day 86400
incr gday 86400
# Close ct_day
puts "</div>"
}

View File

@ -388,7 +388,7 @@ $('.ct_event, .ct_debug')
});
return "<span>" + s +
'<img class=visualicon ' +
'src="/img/channels/out/' +
'src="/img/channels/' +
channel + '.png"></span> ' +
"<span>" + channel +
' (' + period + ')</span>';

View File

@ -46,6 +46,7 @@ set noautoremove [$settings noautoremove]
set logsize [$settings logsize]
set logkeep [$settings logkeep]
set logage [$settings logage]
set backupsage [$settings backupsage]
set cryptokey [system customencryptionkey]
@ -54,5 +55,5 @@ handle_int_update rtschedule $rtschedule "Real-time scheduling"
handle_int_update noautoremove $noautoremove "Package auto-remove"
handle_int_update logsize $logsize "Log rotation size"
handle_int_update logkeep $logkeep "Logs to keep"
handle_int_update logage $logage "Rotated log max age"
handle_int_update logage $logage "Rotated logs max age"
handle_int_update backupsage $backupsage "Schedule backups max age"

View File

@ -21,9 +21,10 @@ setting_toggle "Automatically remove unneeded dependent packages?" \
puts -nonewline "
<tr>
<form class=auto id=logsize method=get action=$env(SCRIPT_NAME)>
<th class=key>Rotate logs when they exceed</th>
<td><select name=logsize
<td>
<form class=auto id=logsize method=get action=$env(SCRIPT_NAME)>
<select name=logsize
class=\"text ui-widget-content ui-corner-all\">
"
set sizes { 102400 262144 524288 1048576 1572864 2097152 }
@ -36,8 +37,8 @@ puts "
</select>
<small><input value=\"set\" type=submit></small>
<div id=logsize_output></div>
</form>
</td>
</form>
</tr>
"
@ -47,6 +48,9 @@ setting_number logkeep "How many rotated logs to keep" $logkeep \
setting_number logage "Delete old logs after X days" $logage \
0 365
setting_number backupsage "Delete schedule backups after X days" \
$backupsage 7 56
if {[system modversion 1] >= 214} {
setting_toggle "Disable telnet menu?" "xtelnet" \
[file exists /mod/boot/xtelnet] 0 1
@ -62,16 +66,17 @@ puts "
Native encryption key
</th><td><span id=nativekey>[system encryptionkey]</span></td></tr>
<tr>
<form class=auto id=cryptokey method=post action=$env(SCRIPT_NAME)>
<input type=hidden name=act value=cryptokey>
<th class=key>Custom encryption key</th>
<td><input name=cryptokey size=40 maxlength=32
<td>
<form class=auto id=cryptokey method=post action=$env(SCRIPT_NAME)>
<input type=hidden name=act value=cryptokey>
<input name=cryptokey size=40 maxlength=32
class=\"text ui-widget-content ui-corner-all\"
value=\"$cryptokey\">
<small><input value=set type=submit></small>
<div id=cryptokey_output></div>
</td>
</form>"
<small><input value=\"set\" type=submit></small>
<div id=cryptokey_output></div>
</form>
</td>"
# Script that clears the custom key input field when the native key
# is restored by entering its full value (as shown in #nativekey).
# We rely on magical knowledge that the form holding this <input> is

View File

@ -13,28 +13,29 @@ puts "
puts -nonewline "
<tr>
<form class=auto id=autolog method=get action=$env(SCRIPT_NAME)>
<th class=key>Auto-processing log level</th>
<td><select id=autolog name=autolog
<td>
<form class=auto id=autolog method=get action=$env(SCRIPT_NAME)>
<select id=autolog name=autolog
class=\"text ui-widget-content ui-corner-all\">
"
puts "<option value=0"
if {$autolog == 0} { puts " selected" }
puts ">Actions and errors only\n"
puts "<option value=1"
if {$autolog == 1} { puts " selected" }
puts ">Actions, errors and scan information\n"
puts "<option value=2"
if {$autolog == 2} { puts " selected" }
puts ">Debugging information\n"
puts -nonewline " <option value=0"
if {$autolog == 0} { puts -nonewline " selected" }
puts ">Actions and errors only"
puts -nonewline " <option value=1"
if {$autolog == 1} { puts -nonewline " selected" }
puts ">Actions, errors and scan information"
puts -nonewline " <option value=2"
if {$autolog == 2} { puts -nonewline " selected" }
puts -nonewline ">Debugging information"
puts "
</select>
<small>
<input name=autolog value=\"set\" type=submit>
<input name=autolog_submit value=\"set\" type=submit>
</small>
<div id=autolog_output></div>
</form>
</td>
</form>
</tr>
"
@ -51,29 +52,29 @@ setting_number autorecperiod "...how many minutes is soon?" $autorecperiod \
puts -nonewline "
<tr>
<form class=auto id=noautohours method=get action=$env(SCRIPT_NAME)>
<th class=key>Choose hours during which
automatic processing runs:
</th>
<td>
<form class=auto id=noautohours method=get action=$env(SCRIPT_NAME)>
<input class=hidden name=\"noautohours\[]\" value=dummy>
<select name=\"noautohours\[]\" id=s_noautohours
multiple size=8
class=\"text ui-widget-content ui-corner-all\">
"
loop h 0 24 {
puts -nonewline "<option value=$h"
puts -nonewline " <option value=$h"
if {$h in $noautohours} { puts -nonewline " selected" }
puts ">[format "%02d:00 - %02d:59" $h $h]</option>"
}
puts "
</select>
<small>
<input name=noautohours value=\"set\" type=submit>
<input name=noautohours_submit value=\"set\" type=submit>
</small>
<div id=noautohours_output></div>
</form>
</td>
</form>
</tr>
"

View File

@ -11,67 +11,70 @@ puts "
<table>
"
puts "
puts -nonewline "
<tr>
<form class=auto id=epg_style method=get action=$env(SCRIPT_NAME)>
<th class=key>Default Now/Next style</th>
<td><select id=epg_style name=epg_style
<td>
<form class=auto id=epg_style method=get action=$env(SCRIPT_NAME)>
<select id=epg_style name=epg_style
class=\"text ui-widget-content ui-corner-all\">
"
puts "<option value=standard"
if {$epg_style ne "grid"} { puts " selected" }
puts ">Standard\n"
puts "<option value=grid"
if {$epg_style eq "grid"} { puts " selected" }
puts ">Grid\n"
puts -nonewline " <option value=standard"
if {$epg_style ne "grid"} { puts -nonewline " selected" }
puts ">Standard"
puts -nonewline " <option value=grid"
if {$epg_style eq "grid"} { puts -nonewline " selected" }
puts -nonewline ">Grid"
puts "
</select>
<small>
<input name=epg_style value=\"set\" type=submit>
<input name=epg_style_submit value=\"set\" type=submit>
</small>
<div id=epg_style_output></div>
</form>
</td>
</form>
</tr>
"
puts "
puts -nonewline "
<tr>
<form class=auto id=service_style method=get action=$env(SCRIPT_NAME)>
<th class=key>Default Single-channel style</th>
<td><select id=service_style name=service_style
<td>
<form class=auto id=service_style method=get action=$env(SCRIPT_NAME)>
<select id=service_style name=service_style
class=\"text ui-widget-content ui-corner-all\">
"
puts "<option value=standard"
if {$service_style eq "standard"} { puts " selected" }
puts ">Standard\n"
puts "<option value=grid"
if {$service_style ne "standard"} { puts " selected" }
puts ">Grid\n"
puts -nonewline " <option value=standard"
if {$service_style eq "standard"} { puts -nonewline " selected" }
puts ">Standard"
puts -nonewline " <option value=grid"
if {$service_style ne "standard"} { puts -nonewline " selected" }
puts -nonewline ">Grid"
puts "
</select>
<small>
<input name=service_style value=\"set\" type=submit>
<input name=service_style_submit value=\"set\" type=submit>
</small>
<div id=service_style_output></div>
</form>
</td>
</form>
</tr>
"
puts "
puts -nonewline "
<tr>
<form class=auto id=channel_group method=get action=$env(SCRIPT_NAME)>
<th class=key>Channel Group for EPG</th>
<td><select id=channel_group name=channel_group
<td>
<form class=auto id=channel_group method=get action=$env(SCRIPT_NAME)>
<select id=channel_group name=channel_group
class=\"text ui-widget-content ui-corner-all\">
"
set i 0
puts "<option value=0>-- None --"
puts " <option value=0>-- None --"
foreach grp [$settings channel_groups] {
incr i
puts -nonewline "<option value=$i"
puts -nonewline " <option value=$i"
if {$channel_group == $i} {
puts -nonewline " selected"
}
@ -81,24 +84,25 @@ foreach grp [$settings channel_groups] {
puts "
</select>
<small>
<input name=channel_group value=\"set\" type=submit>
<input name=channel_group_submit value=\"set\" type=submit>
</small>
<div id=channel_group_output></div>
</form>
</td>
</form>
</tr>
"
puts "
puts -nonewline "
<tr>
<form class=auto id=xepghours method=get action=$env(SCRIPT_NAME)>
<th class=key>Grid-style EPG Hours</th>
<td><select id=xepghours name=xepghours
<td>
<form class=auto id=xepghours method=get action=$env(SCRIPT_NAME)>
<select id=xepghours name=xepghours
class=\"text ui-widget-content ui-corner-all\">
"
foreach xehopt {2 3 4 5 6 7 8} {
puts -nonewline "<option value=$xehopt"
puts -nonewline " <option value=$xehopt"
if {$xehopt == $xepghours} {
puts -nonewline " selected"
}
@ -108,11 +112,11 @@ foreach xehopt {2 3 4 5 6 7 8} {
puts "
</select>
<small>
<input name=xepghours value=\"set\" type=submit>
<input name=xepghours_submit value=\"set\" type=submit>
</small>
<div id=xepghours_output></div>
</form>
</td>
</form>
</tr>
"

View File

@ -3,7 +3,7 @@ set hostname [$settings hostname]
set notoolbar [$settings notoolbar]
set nomobile [$settings nomobile]
set nohelplinks [$settings nohelplinks]
set notwitfeed [$settings notwitfeed]
#set notwitfeed [$settings notwitfeed]
set nounwatchedcount [$settings nounwatchedcount]
set nounderscore [$settings nounderscore]
set hidevisualota [$settings hidevisualota]
@ -14,7 +14,7 @@ handle_str_update hostname $hostname Hostname
handle_int_update notoolbar $notoolbar "Disable toolbar"
handle_int_update nomobile $nomobile "Disable mobile link"
handle_int_update nohelplinks $nohelplinks "Disable help links"
handle_int_update notwitfeed $notwitfeed "Disable twitter feed ticker"
#handle_int_update notwitfeed $notwitfeed "Disable twitter feed ticker"
handle_int_update nounwatchedcount $nounwatchedcount "Disable unwatched count"
handle_int_update nounderscore $nounderscore "Disable underscore count"
handle_int_update hidevisualota $hidevisualota "Hide OTA from visual view"

View File

@ -13,24 +13,25 @@ puts "
puts "
<tr>
<form class=auto id=hostname method=get action=$env(SCRIPT_NAME)>
<th class=key>Hostname</th>
<td><input name=hostname value=\"$hostname\"
<td>
<form class=auto id=hostname method=get action=$env(SCRIPT_NAME)>
<input name=hostname value=\"$hostname\"
class=\"text ui-widget-content ui-corner-all\"
length=20 maxlength=50>
<small>
<input id=hostname_submit value=\"change\" type=submit>
</small>
<div id=hostname_output></div>
<small>
<input id=hostname_submit value=\"change\" type=submit>
</small>
<div id=hostname_output></div>
</form>
</td>
</form>
</tr>
"
setting_toggle "Slide-down toolbar?" "notoolbar" $(!$notoolbar) 1
setting_toggle "Mobile link on main page?" "nomobile" $(!$nomobile) 1
setting_toggle "Help links on main page?" "nohelplinks" $(!$nohelplinks) 1
setting_toggle "Twitter feed ticker on main page?" "notwitfeed" $(!$notwitfeed) 1
#setting_toggle "Twitter feed ticker on main page?" "notwitfeed" $(!$notwitfeed) 1
setting_toggle "Unwatched count on folders?" "nounwatchedcount" $(!$nounwatchedcount) 1
setting_toggle "Underscore item indicator on folders?" "nounderscore" $(!$nounderscore) 1
setting_toggle "Hide OTA from Visual View?" "hidevisualota" $hidevisualota
@ -41,25 +42,26 @@ if {[system pkginst ir]} {
puts -nonewline "
<tr>
<form class=auto id=audiomp3 method=get action=$env(SCRIPT_NAME)>
<th class=key>Audio extraction type</th>
<td><select id=audiomp3 name=audiomp3
<td>
<form class=auto id=audiomp3 method=get action=$env(SCRIPT_NAME)>
<select id=audiomp3 name=audiomp3
class=\"text ui-widget-content ui-corner-all\">
"
puts "<option value=0"
if {$audiomp3 == 0} { puts " selected" }
puts ">[$settings audiomp3descr 0] - very fast but less compatible.\n"
puts "<option value=1"
if {$audiomp3 == 1} { puts " selected" }
puts ">[$settings audiomp3descr 1] - around 60 times slower.\n"
puts -nonewline " <option value=0"
if {$audiomp3 == 0} { puts -nonewline " selected" }
puts ">[$settings audiomp3descr 0] - very fast but less compatible."
puts -nonewline " <option value=1"
if {$audiomp3 == 1} { puts -nonewline " selected" }
puts -nonewline ">[$settings audiomp3descr 1] - around 60 times slower."
puts "
</select>
<small>
<input name=audiomp3 value=\"set\" type=submit>
<input name=audiomp3_submit value=\"set\" type=submit>
</small>
<div id=audiomp3_output></div>
</form>
</td>
</form>
</tr>
"

View File

@ -7,7 +7,7 @@ proc _ns_extractip {blob} {
set r {}
binary scan $blob c4 octets
foreach octet $octets {
lappend r [expr {$octet & 0xff}]
lappend r $($octet & 0xff)
}
return [join $r .]
}
@ -67,7 +67,7 @@ proc _ns_iftable {if tag} {
<th class=key>DNS Server</th>
<td><input name=dns class=static value=\"[
_ns_extractip [system param ETHERNET_CONF_${tag}_DNS Blob]]\"></td>
</tr><tr>
</tr>
"
if {$if eq "wifi"} {
set authtypes {
@ -105,17 +105,19 @@ proc _ns_iftable {if tag} {
"
append r "
<tr>
<th class=key>Authentication Type</th>
<td><select id=ns_wifi_authmode name=auth>
"
set val [system param WLAN_AUTH_TYPE]
foreach id [array names authtypes] {
append r "<option value=\"$id\""
append r " <option value=\"$id\""
if {$id eq $val} { append r " selected" }
append r ">$authtypes($id)\n"
append r ">$authtypes($id)\n "
}
append r "</select></td></tr><tr>"
append r " </select></td>"
append r "
</tr>"
append r "
<tr>
<th class=key>
@ -127,20 +129,22 @@ proc _ns_iftable {if tag} {
</th>
<td><input type=password id=ns_pp name=pass size=40
value=\"[_ns_pass]\"></td>
</tr><tr>
</tr>
"
}
append r "
<td></td>
<td align=right><small><input type=submit value=\"Save\"></small></td>
<tr>
<th></th>
<td align=right><small><input type=submit value=\"Save\"></small></td>
</tr>
</table>
</form>
<div id=networksettings_${if}_output></div>
"
}
puts "
puts -nonewline "
<h4>Network Settings</h4>
<div id=network_settings>
<fieldset style=\"display: inline; float: left\">
@ -149,6 +153,7 @@ puts "
</legend>
[_ns_iftable eth 1ST]
</fieldset>
<fieldset style=\"display: inline; float: left\">
<legend>
Wireless Interface
@ -179,5 +184,3 @@ puts "
<script type=text/javascript src=/settings/modules/network/script.js>
</script>
"

View File

@ -16,11 +16,11 @@ setting_toggle "Additional diagnostic output?" "tvdb_debug" $tvdb_debug
puts "
<tr>
<form class=auto id=dedup method=get action=$env(SCRIPT_NAME)>
<th class=key>
Dedup Episode Prefix<br>
</th>
<td>
<form class=auto id=dedup method=get action=$env(SCRIPT_NAME)>
<input name=dedup_template value=\"$dedup_template\"
class=\"text ui-widget-content ui-corner-all\"
length=20 maxlength=50>
@ -29,6 +29,7 @@ puts "
<input id=dedup_submit value=\"change\" type=submit>
</small>
<div id=dedup_output></div>
</form>
</td>
<td>
<span class=blood>
@ -40,7 +41,6 @@ puts "
%N - number of episodes (two digits)
</span>
</td>
</form>
</tr>
"

View File

@ -13,7 +13,7 @@ setting_toggle "HTTPS web server?" "https" \
[file exists /mod/etc/webif.pem] 0 1
puts "
</table>
</legend></fieldset>
</fieldset>
<br>
<fieldset style=\"display: inline\">
<legend> User Access Control </legend>

View File

@ -97,9 +97,9 @@ proc setting_toggle {name attr checked {invert 0} {val 0}} {
proc setting_number {name descr val {min ""} {max ""}} {
puts -nonewline "
<tr>
<form class=auto id=${name} method=get action=$::env(SCRIPT_NAME)>
<th class=key>$descr</th>
<td>
<form class=auto id=${name} method=get action=$::env(SCRIPT_NAME)>
<input name=${name} size=5 type=number
class=\"text ui-widget-content ui-corner-all\"
maxlength=10"
@ -114,8 +114,8 @@ proc setting_number {name descr val {min ""} {max ""}} {
<input value=\"set\" type=submit>
</small>
<div id=${name}_output></div>
</form>
</td>
</form>
</tr>
"
}

View File

@ -37,10 +37,10 @@ require epg_popup
set now [clock seconds]
set stt [cgi_get stt $now]
set dst [expr $now - $stt]
set dst $($now - $stt)
if {$dst >= 0 && $dst < 1800} {
set current 1
} elseif { $stt < [expr int ($now / 86400) * 86400] } {
} elseif { $stt < (int ($now / 86400) * 86400) } {
set stt $now
set current 0
} else {
@ -51,7 +51,7 @@ set favgroup [$settings channel_group]
set hours [cgi_get hours -]
if {$hours eq "-"} {
set hours [expr 1.0 * [[settings] xepghours]]
set hours $(1.0 * [[settings] xepghours])
}
if {$hours == 0} { set hours 4.0 }
@ -61,7 +61,7 @@ if {$hours > 8} { set hours 8.0 }
set seconds $($hours * 3600)
set ostt $stt
set stt [expr int($stt / 1800.0) * 1800]
set stt $(int($stt / 1800.0) * 1800)
set ett $(int($stt + $seconds))
set offset 0
@ -124,11 +124,11 @@ for {set i 0} {$i < 24} {incr i} {
if {$i == $starthour} {
append xclass " tjstart"
} elseif {$i > $starthour && $i < [expr $starthour + $hours]} {
} elseif {$i > $starthour && $i < ($starthour + $hours)} {
append xclass " tjother"
}
set tt [expr $starthour + $stt + 3600 * ($i - $starthour)]
set tt $($starthour + $stt + 3600 * ($i - $starthour))
# Back to start of hour
set tt $(3600 * int($tt / 3600))
@ -191,7 +191,7 @@ puts "
for {set i 0} {$i < $hours * 2} {incr i} {
puts "<div class=xetime id=xe$i
style=\"width: [expr $minpx * 30]px\">"
style=\"width: $($minpx * 30)px\">"
puts "[clock format $($stt + 1800 * $i) -format "%H:%M"]</div>"
}
@ -201,10 +201,12 @@ puts "</div>"
######################################################################
# Events
set stt2 0
catch {set stt2 $($stt + 0)}
puts "
<script type=text/javascript>
var hours = $hours;
var stt = [expr $stt + 0];
var stt = $stt2;
var nowoffset = $offset;
</script>
"
@ -259,7 +261,7 @@ foreach e $records {
}
set es [$e get start]
set ee [expr $es + [$e get duration]]
set ee $($es + [$e get duration])
if {$es < $le} continue
@ -269,19 +271,18 @@ foreach e $records {
set txt [list [cgi_quote_html [$e get name]] "([\
clock format $es -format "%H:%M"] - [\
clock format $ee -format "%H:%M"])[\
expr {$showing ? " ($perc%)" : ""}]"]
clock format $ee -format "%H:%M"])$($showing ? " ($perc%)" : "")"]
if {$es < $stt} { set es $stt }
if {$ee > $ett} { set ee $ett }
set left [expr int(($es - $stt) * $secpx)]
set right [expr int(($ee - $stt - 1) * $secpx)]
set left $(int(($es - $stt) * $secpx))
set right $(int(($ee - $stt - 1) * $secpx))
if {$le == 0 && $es > $stt} {
# EPG data carried over from previous day have been purged
set pos $left
puts "<div class=\"xeprog $bg\"
style=\"width: [expr $pos - 3]px;\" title=\"Unknown\">
style=\"width: $($pos - 3)px;\" title=\"Unknown\">
<i>Unknown</i></div>"
}
@ -312,7 +313,7 @@ foreach e $records {
}
puts "<div class=\"xeprog $lbg\"
style=\"width: [expr $px - 4]px;\" title=\"[join $txt]\">
style=\"width: $($px - 4)px;\" title=\"[join $txt]\">
<a class=event href=# xs=[$e get service_id]
xe=[$e get event_id] sch=[$e get sched_type]
rec=$recopts>"
@ -342,10 +343,9 @@ Visit settings to change EPG options.
epg cleanup
set end [clock milliseconds]
puts "<font class=footnote>
Retrieved in: [expr ($got - $start) / 1000.0] seconds.
</font>"
Retrieved in: $(($got - $start) / 1000.0) seconds.
</font>"
footer

View File

@ -4,17 +4,30 @@ source /mod/webif/lib/setup
require system.class
require settings.class
proc {system disksmarterror} {sa count ack_count} {
if {$sa eq "spinretry"} {
set msg "Disk $sa count is: $count"
} else {
set msg "Disk $sa sector count is: $count"
}
if {$ack_count > 0} {
append msg " (was $ack_count)"
}
append msg "\n"
return $msg
}
proc {system disksmart} {} {
set smartmsg ""
set smartattrs {realloc pending offline spinretry}
set smartattribs(SMART_status) "Unknown"
foreach sa $smartattrs {
set smartattribs(SMART_$sa) 0
set smartattribs(SMART_ack_$sa) 0
}
foreach line [[settings] smartdata] {
lassign $line x name x n x t
if {$name eq "SMART_status"} {
@ -23,22 +36,27 @@ proc {system disksmart} {} {
set smartattribs($name) $n
}
}
# (SMART_ack_status 0 SMART_ack_pending 0 SMART_status PASSED SMART_pending 7 SMART_ack_realloc 0 SMART_ack_offline 0 SMART_realloc 0 SMART_offline 7)
if {$smartattribs(SMART_status) ne "PASSED"} {
if {$smartattribs(SMART_status) ne "PASSED" &&
$smartattribs(SMART_status) ne "Unknown" &&
$smartattribs(SMART_status) ne ""} {
append smartmsg \
"Disk overall health assessment is: $smartattribs(SMART_status)\n"
}
foreach sa $smartattrs {
if {$smartattribs(SMART_$sa) != $smartattribs(SMART_ack_$sa)} {
append smartmsg \
"Disk $sa sector count is: $smartattribs(SMART_$sa)"
if {$smartattribs(SMART_ack_$sa) > 0} {
append smartmsg " (was $smartattribs(SMART_ack_$sa))"
set count $smartattribs(SMART_$sa)
set ack_count $smartattribs(SMART_ack_$sa)
if {$count > $ack_count} {
append smartmsg [system disksmarterror $sa $count $ack_count]
} elseif {$count < $ack_count} {
if {($sa eq "pending" || $sa eq "offline") && ($count > 0)} {
append smartmsg [system disksmarterror $sa $count $ack_count]
} else {
[settings] _nval_setting "SMART_ack_$sa" $count
}
append smartmsg "\n"
}
}
return $smartmsg

4
webif/include/extensions.jim Executable file
View File

@ -0,0 +1,4 @@
#!/mod/bin/jimsh
set ignore {.nts .thm .hmi}
set include {.ts .avi .mpg .mpeg .wmv .mkv .mp2 .mp3 .mp4 .mov .hmt .m4v .m4a .wav .webm}

View File

@ -23,8 +23,8 @@ helplink "hummy.tv<br>Forums" "/img/forum.png" "http://hummy.tv/"
helplink "hummy.tv<br>Wiki" "/img/wiki.png" "http://wiki.hummy.tv/"
helplink "Things Every<br>Owner Should Know" "/img/started.png" \
"http://hummy.tv/forum/threads/1858/"
helplink "Twitter<br>Feed" "/img/silver-twitter-bird-button.png" \
"http://twitter.com/HummyPkg"
#helplink "Twitter<br>Feed" "/img/silver-twitter-bird-button.png" \
# "http://twitter.com/HummyPkg"
eval_plugins helplink

View File

@ -13,8 +13,8 @@ puts "<span class=versions>
Web interface version: [system pkgver webif]<br>
Custom firmware version: $modver
"
catch {set fhtcpversion [system fhtcpversion]}
catch {set kernelver [system kernelver]}
set fhtcpversion [system fhtcpversion]
set kernelver [system kernelver]
puts "<br>Humax Version: $fhtcpversion (kernel $kernelver)"
puts "<br>Loader Version: [system loaderver]"
puts "<br>System ID: [system systemid]"

View File

@ -1,9 +1,10 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require system.class
set class "class=hidden"
if {[file exists /tmp/.restartpending]} {
source /mod/webif/lib/setup
require system.class rsv.class
if {[system isrestartpending]} {
require rsv.class
if {[rsv count pending] <= 0} {
system restartpending 0
} else {
@ -31,6 +32,6 @@ puts {
</div>
<div style="width: 100%; height: 0.7em;
background: url(/img/stripes.gif) repeat-x;"></div>
</div>
</div>
}

View File

@ -5,11 +5,10 @@ require system.class
if {[system modversion 1] < 300} {
puts {
</span><br><span class=blood>
</span><br><br><span class=blood>
Your custom firmware is out of date and will shortly stop receiving package updates -
<a href=http://hummy.tv/forum/threads/5867/>
click for details</a>
</span>
}
}

View File

@ -11,7 +11,7 @@ if {![exists -proc altrow]} {
0 { puts -nonewline " class=odd" }
1 { puts -nonewline " class=even" }
}
set i [expr ! $i]
set i $(!$i)
}
if {$attrs ne ""} { puts -nonewline " $attrs" }
puts ">";

View File

@ -20,10 +20,16 @@ proc ::expire::directory {dir} {
}
set entries [lsort \
-command [lambda {a b} {upvar getter g; expr [$g $a] - [$g $b]}]\
-command [lambda {a b} {upvar getter g; expr {[$g $a] - [$g $b]}}]\
[lmap i [readdir -nocomplain $dir] {
if {![string match {*.ts} $i]} continue
if {[catch {set ts [ts fetch "$dir/$i"]}]} continue
set fname "$dir/$i"
if {[string match {*.hmt} $i]} {
if {[file exists "[file rootname $fname].ts"]} continue
if {[catch {set ts [ts parse $fname [ts exec $fname]]}]}\
continue
} elseif {[string match {*.ts} $i]} {
if {[catch {set ts [ts fetch $fname]}]} continue
} else continue
if {$ts == 0} continue
list $ts
}]]
@ -43,16 +49,22 @@ proc ::expire::directory {dir} {
break
}
log " [file tail $file]"
if {[::auto::inuse $ts]} {
log " In use, skipping."
continue
}
if {$ax(keepnew) ne "0" && [$ts flag New]} {
log " Unwatched, skipping."
continue
if {[string match {*.ts} $file]} {
if {[::auto::inuse $ts]} {
log " In use, skipping."
continue
}
if {$ax(keepnew) ne "0" && [$ts flag New]} {
log " Unwatched, skipping."
continue
}
}
if {$ax(days) > 0} {
# Calculate age in days
if {[$getter $ts] < [$ts get start]} {
log " End before start, skipping."
continue
}
set age $(($now - [$getter $ts]) / 86400.0)
log " $age days (cf. $ax(days))"
if {$age < $ax(days)} {
@ -61,11 +73,9 @@ proc ::expire::directory {dir} {
}
}
log " Removing."
if {![safe_delete $file]} {
log "Unknown error in safe_delete, aborting." 0
break
if {[safe_delete $file]} {
log " EXPIRE: removed $file" 0
}
log " EXPIRE: removed $file" 0
::auto::recalcdir $dir
incr num -1
}

View File

@ -77,7 +77,7 @@ proc ::shrink::dequeue {q ts} {
# Move the shrunken version back to the local directory.
foreach f [glob "$tmp/shrunk.*"] {
set ext [file extension $f]
file rename $f "${file}_shrunk${ext}"
file rename -force $f "${file}_shrunk${ext}"
# Set the file time to match the old file
file touch "${file}_shrunk${ext}" [$ts get file]
}
@ -93,7 +93,7 @@ proc ::shrink::dequeue {q ts} {
foreach ext $tsgroup {
set f "${file}_shrunk.$ext"
if {[file exists $f]} {
file rename $f "${file}.$ext"
file rename -force $f "${file}.$ext"
}
}
$ts set_shrunk

View File

@ -371,18 +371,22 @@ proc ::auto::runplugin {fn {_plugin ""} args} {
if {[exists -proc $rfn] || [exists -alias $rfn]} {
set st [clock milliseconds]
log [string repeat * 56] 2
log "*********> $rfn (Priority $priority)" 2
log "*********> $rfn (Priority $priority)" 1
if {$plugin in $legacy && $fn ne "rundir"} {
set call [list $rfn __dummy]
} else {
set call [list $rfn $args]
}
if {[catch {uplevel 1 {*}$call} msg]} {
set ologprefix $::auto::logprefix
set ::auto::logprefix "$plugin:$::auto::logprefix"
set ret [catch {uplevel 1 {*}$call} msg]
set ::auto::logprefix $ologprefix
if {$ret} {
log "$rfn: $msg" 0
lassign [info stacktrace] p f l
log " $f:$l @ $p" 0
}
log "<********* $rfn ([elapsed $st] seconds)" 2
log "<********* $rfn ([elapsed $st] seconds)" 1
}
}
}

View File

@ -10,13 +10,12 @@ proc ::auto::loginit {} {
# Rotate log file if large enough.
if {[file exists $::auto::logfile] &&
[file size $::auto::logfile] > $logsize} {
set tstamp [clock format [clock seconds] -format {%Y%m%d%H%M%S}]
file rename -force $::auto::logfile "/mod/tmp/auto.$tstamp.log"
exec /mod/webif/lib/bin/manage_logs
}
# Open log file
if {$::auto::logfd eq "unset"} {
set ::auto::logfd [open "/mod/tmp/auto.log" "a+"]
set ::auto::logfd [open $::auto::logfile "a+"]
}
}

View File

@ -3,8 +3,6 @@
source /mod/webif/lib/setup
require system.class settings.class
if {[system model] eq "HD"} exit
set disk [system disk]
set settings [settings]
@ -20,7 +18,10 @@ if {$line ne ""} {
}
# Extract disk model.
foreach line [split [exec /bin/smartctl -i $disk] "\n"] {
if {[catch {set msg [exec /bin/smartctl -i $disk]}]} {
set msg ""
}
foreach line [split $msg "\n"] {
if {[string match "*Not in smartctl database*" $line]} continue
if {[string match "*: *" $line]} {
regsub -all -- {[[:space:]]+} $line " " line
@ -31,7 +32,11 @@ foreach line [split [exec /bin/smartctl -i $disk] "\n"] {
}
# Extract disk attributes.
foreach line [split [exec /bin/smartctl -A -f brief $disk] "\n"] {
if {[catch {set msg [exec /bin/smartctl -A -f brief $disk]}]} {
set msg ""
}
set attrs {}
foreach line [split $msg "\n"] {
regsub -all -- {[[:space:]]+} $line " " line
regsub -all -- {^[[:space:]]+} $line "" line
lassign [split $line] id name flags val worst thresh when rval

View File

@ -1,13 +1,20 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require settings.class
require settings.class lock
set s [settings]
set logsize [$s logsize]
set logkeep [$s logkeep]
set logage [$s logage]
defer {catch {release_lock webif_autolog}}
if {![acquire_lock webif_autolog]} {
acquire_lock webif_autolog 10 1
puts "Could not acquire exclusive lock, terminating."
exit
}
puts "Rotating at $logsize, keeping $logkeep, max age $logage"
set logdir "/mod/tmp"
@ -56,7 +63,7 @@ puts "\n-- Purge\n"
proc logsort {a b} {
global logdir
return [expr [file mtime "$logdir/$a"] - [file mtime "$logdir/$b"]]
return $([file mtime "$logdir/$a"] - [file mtime "$logdir/$b"])
}
foreach log $baselogs {

View File

@ -52,7 +52,9 @@ lbr=0
if [ -f /tmp/.lbr ]; then
lbr="`cat /tmp/.lbr`"
#echo "LBR: $lbr"
else
[ -z "$lbr" ] && lbr=0
fi
if [ $lbr -eq 0 ]; then
# No last-boot-reason file, fall-back to reading timer directly.
echo "No .lbr, falling back to timer..."
if readwakeup | grep "00 00 00 00"; then

View File

@ -86,7 +86,7 @@ epg method percent {} {
set now [clock seconds]
if {$start > $now} { return 0 }
if {$start + $duration < $now} { return 100 }
return [expr [expr $now - $start] * 100 / $duration]
return $(($now - $start) * 100 / $duration)
}
epg method showing {} {
@ -110,11 +110,11 @@ epg method elapsed {} {
set percent [$self percent]
if {$percent == 0} { return 0 }
if {$percent == 100} { return $duration }
return [expr $duration * $percent / 100]
return $($duration * $percent / 100)
}
epg method remaining {} {
return [expr $duration - [$self elapsed]]
return $($duration - [$self elapsed])
}
epg method end {} {
@ -134,11 +134,11 @@ epg method type_icon {} {
}
proc {epg channeliconpath} {name} {
return "/img/channels/out/$name.png"
return "/img/channels/$name.png"
}
proc {epg channelicon} {name {width 0} {style ""}} {
set str "<img src=\"/img/channels/out/$name.png\"";
set str "<img src=\"[epg channeliconpath $name]\"";
if {$width > 0} { append str " width=$width" }
if {$style ne ""} { append str " style=\"$style\"" }
append str " alt=\"\">"
@ -146,11 +146,7 @@ proc {epg channelicon} {name {width 0} {style ""}} {
}
epg method channel_icon {{width 0} {style ""}} {
set str "<img src=\"/img/channels/out/$channel_name.png\"";
if {$width > 0} { append str " width=$width" }
if {$style ne ""} { append str " style=\"$style\"" }
append str " alt=\"\">"
return $str
return [epg channelicon $channel_name $width $style]
}
epg method get_channel_info {} {

View File

@ -8,6 +8,7 @@ lbr_descr()
2) echo "Remote control handset" ;;
3) echo "Scheduled event" ;;
4) echo "Power cycle" ;;
5) echo "Front panel reboot" ;;
*) echo "Unknown `cat /tmp/.lbr`" ;;
esac
else

View File

@ -13,12 +13,11 @@ class pkg {
set ::pkgmeta {}
set ::diagmeta {}
set ::muxdb {}
pkg method _load {nm} {
set name $nm
set latest 0
foreach line [split [exec /bin/opkg list $nm] "\n"] {
foreach line [split [pkg list $nm] "\n"] {
# betaftpd - 0.0.8pre17-1 - Description...
if {[string match { *} $line]} {
append descr $line
@ -33,12 +32,9 @@ pkg method _load {nm} {
}
if {$descr eq ""} {
$self loadraw
if {[dict exists $raw description]} {
set descr $raw(description)
}
}
regexp {(.*) \[(.*)\]} $descr x descr changes
set info [exec /bin/opkg list-installed $nm]
set info [pkg listinst $nm]
regexp {^([^ ]+) - ([^ ]+)$} $info x x installed
return $self
@ -48,7 +44,7 @@ proc {pkg instverlist} {} {{cache {}}} {
if {[llength $cache]} { return $cache }
# Fetch details of installed packages
foreach line [split [exec /bin/opkg list-installed] "\n"] {
foreach line [split [pkg listinst] "\n"] {
lassign $line pkg x ver
set cache($pkg) $ver
}
@ -126,7 +122,7 @@ pkg method loadraw {} {
if {[file exists "/mod/var/opkg/info/$name.control"]} {
set data [file read "/mod/var/opkg/info/$name.control"]
} else {
set data [exec /bin/opkg info $name]
set data [pkg info $name]
}
foreach line [split $data "\n"] {
@ -135,7 +131,7 @@ pkg method loadraw {} {
continue
}
regexp {^([^:]+): (.*)$} $line x tag txt
if {![dict exists $raw $tag]} {
if {$tag ne "" && $txt ne "" && ![dict exists $raw $tag]} {
set tag [string tolower $tag]
set raw($tag) $txt
} else {
@ -144,6 +140,7 @@ pkg method loadraw {} {
}
if {[dict exists $raw tags]} { set url $raw(tags) }
if {![dict exists $raw description]} { set descr [set raw(description) "Unknown"] }
}
proc {pkg load} {nm} {
@ -167,7 +164,7 @@ pkg method is {what} {
proc {pkg avail} {} {
set inst_pkgs [pkg inst]
set avail_pkgs {}
foreach pkg [split [exec /bin/opkg list] "\n"] {
foreach pkg [split [pkg list] "\n"] {
if {[regexp {^ } $pkg]} { continue }
if {[regexp {^([^ ]+)} $pkg name] == 0} { continue }
if {$name ni $inst_pkgs && $name ni $avail_pkgs} {
@ -181,7 +178,7 @@ proc {pkg avail} {} {
proc {pkg inst} {} {
# Build a list of installed packages - just the names
set inst_pkgs {}
foreach pkg [split [exec /bin/opkg list-installed] "\n"] {
foreach pkg [split [pkg listinst] "\n"] {
if {[regexp {^([^ ]+)} $pkg name] == 0} { continue }
if {$name ni $inst_pkgs} {
lappend inst_pkgs $name
@ -194,7 +191,7 @@ proc {pkg inst} {} {
proc {pkg upgr} {} {
#webif - 0.5.3 - 0.5.7
set upgr_pkgs {}
foreach pkg [split [exec /bin/opkg list-upgradable] "\n"] {
foreach pkg [split [pkg listupgr] "\n"] {
if {[regexp {^([^ ]+)} $pkg name] == 0} { continue }
lappend upgr_pkgs $name
#puts "Upgr: $name<br>"
@ -230,6 +227,7 @@ proc {pkg fetchfile} {url} {
$f puts -nonewline "Host: hpkg.tv\r\n"
$f puts -nonewline "Connection: close\r\n"
$f puts -nonewline "\r\n"
$f flush
# Skip headers in the response.
set line [string trim [$f gets]]
@ -260,23 +258,42 @@ proc {pkg fetchdiagmeta} {} {
$ff close
}
proc {pkg loadmuxdb} {} {
if {[llength $::muxdb]} { return }
if {![file exists "/mod/var/mux.db"]} {
catch {pkg fetchmuxdb}
} else {
set meta [open "/mod/var/mux.db" r]
set ::muxdb [read $meta]
$meta close
}
proc {pkg list} {{nm ""}} {
catch {
if {$nm eq ""} {
exec /bin/opkg list | grep -v "valid architecture"
} else {
exec /bin/opkg list $nm | grep -v "valid architecture"
}
} msg
return $msg
}
proc {pkg fetchmuxdb} {} {
set ::muxdb [pkg fetchfile mux.db]
proc {pkg listinst} {{nm ""}} {
catch {
if {$nm eq ""} {
exec /bin/opkg list-installed | grep -v "valid architecture"
} else {
exec /bin/opkg list-installed $nm | grep -v "valid architecture"
}
} msg
return $msg
}
set ff [open "/mod/var/mux.db" w]
puts $ff $::muxdb
$ff close
proc {pkg listupgr} {} {
catch {exec /bin/opkg list-upgradable | grep -v "valid architecture"} msg
return $msg
}
proc {pkg info} {{nm ""}} {
catch {
if {$nm eq ""} {
exec /bin/opkg info | grep -v "valid architecture"
} else {
exec /bin/opkg info $nm | grep -v "valid architecture"
}
} msg
return $msg
}
proc {pkg update} {} {
@ -287,6 +304,10 @@ proc {pkg upgrade} {nm} {
exec /bin/opkg upgrade $nm
}
proc {pkg removemuxdb} {} {
file delete "/mod/var/mux.db"
}
proc {pkg vercompare} {v1 v2} {
if {$v1 eq $v2} { return 0 }

View File

@ -1,7 +1,7 @@
if {![exists -proc progressbar]} {
proc progressbar {percent} {
set pos [expr 118 - $percent / 100.0 * 118]
set pos $(118 - $percent / 100.0 * 118)
return "<img src=/img/percentimage.png
title=\"$percent%\"
alt=\"$percent%\" class=progress

View File

@ -167,7 +167,7 @@ proc {queue startup} {{days 7}} {
delete from queue
where status in ('COMPLETE', 'FAILED')
and submitted < %s
} [expr [clock seconds] - 86400 * $days]
} $([clock seconds] - 86400 * $days)
] ] ]
}

View File

@ -213,11 +213,8 @@ rsv method szsttime_stamp {} {
set spaced [regsub {^(....)(..)(..)(..)(..)(..).*} \
$szsttime {\1 \2 \3 \4 \5 \6}]
if {[catch {
set stamp [clock scan $spaced -format "%Y %m %d %H %M %S"]
}]} {
return 0
}
set stamp 0
catch {set stamp [clock scan $spaced -format "%Y %m %d %H %M %S"]}
return $stamp
}
@ -292,7 +289,7 @@ rsv method iconset {{height 20}} {
lappend iconlist "<img src='/images/$icon' height=$height>"
if {$ersvtype == 3} {
if {[$self padded]} {
set padding "<- [expr $ulPreOffset / 60], [expr $ulPostOffset / 60] ->"
set padding "<- $($ulPreOffset / 60), $($ulPostOffset / 60) ->"
lappend iconlist \
"<img src=/img/pad.png height=$height
title=\"$padding\" alt=\"$padding\">"
@ -702,7 +699,17 @@ rsv method insert {{table pending} {force 0} {defer 0}} {
$rsvdb query "delete from ${table} where ulslot = $ulslot;"
$rsvdb query $query {*}$bvals
system plog activity "Scheduled [$self name] @ $nsttime"
switch $action {
0 { set actstr "Scheduled" }
1 { set actstr "Unscheduled" }
2 { set actstr "Set AR" }
3 { set actstr "Set padding" }
4 { set actstr "Set folder name" }
5 { set actstr "Set skip" }
6 { set actstr "Refresh" }
default { set actstr "Unknown action $action" }
}
system plog activity "$actstr [$self name] @ $nsttime"
if {$table eq "pending" && !$defer} { rsv commit }
}
@ -1068,7 +1075,7 @@ proc {rsv backup} {file} {
loop i 1 6 {
set favname [system strip \
[system param FAV_CUSTOM_STR0$i Text]]
set idx [expr 1 << ($i - 1)]
set idx $(1 << ($i - 1))
set favnames($idx) $favname
puts $fd "favname\t$i\t$idx\t$favname"
puts " $favname"
@ -1515,8 +1522,8 @@ proc {rsv evaluate_conflicts} {events type thresh {debug 0}} {
lassign $ev start end hsvc eid sid
if {$debug} {
puts "\nSLOTS: $slots"
puts $ev
puts "<br>\nSLOTS: $slots"
puts "$ev - "
}
# Close off any open slots that have now finished.
@ -1578,13 +1585,11 @@ proc {rsv evaluate_conflicts} {events type thresh {debug 0}} {
lassign [lindex $slots 0] xsid xend
if {$xend >= $end} continue
if {$debug} { puts " Replacing slot 0.\n" }
if {$debug} { puts " Replacing slot 0.<br>\n" }
set uslot 0
}
if {$debug} {
puts " -> into slot $uslot"
}
if {$debug} { puts " -> into slot $uslot" }
# Insert event into slot
lset slots $uslot [list $sid $end]
}
@ -1594,23 +1599,23 @@ proc {rsv evaluate_conflicts} {events type thresh {debug 0}} {
proc {rsv newconflicts} {{thresh 1} {type "list"} {debug 0}} {
set events [lsort -index 0 -integer [rsv allevents]]
set conflicts [rsv evaluate_conflicts $events $type $thresh $debug]
if {$debug} { puts "<br>\nConflicts: $conflicts" }
if {$type eq "map"} { return $conflicts }
return [dict keys $conflicts]
}
proc {rsv checkconflict} {s d thresh {debug 0}} {
set events [rsv allevents]
lappend events [list $s $($s + $d) 0 0 0]
lappend events [list $s $($s + $d) 0 0 -1]
set events [lsort -index 0 -integer $events]
set conflicts [rsv evaluate_conflicts $events 'list' $thresh $debug]
if {$debug} { puts "<br>\nConflicts: $conflicts" }
set ret {}
if {![dict exists $conflicts "0"]} { return $ret }
if {![dict exists $conflicts "-1"]} { return $ret }
foreach c [dict get $conflicts 0] {
if {$c eq "0"} continue
foreach c [dict get $conflicts -1] {
if {$c eq "-1"} continue
set s [rsv slot $c]
set s [$s name]
lappend ret $s

View File

@ -28,6 +28,8 @@ if {![exists -proc _del_bindir]} {
proc safe_delete {file {px ""}} {
global _del_dustbin
if {![file exists $file]} { return 1 }
# Check if undelete is installed and that the file being
# deleted is not already in the dustbin.
set dustbin 1

View File

@ -2,20 +2,6 @@
if {![exists -command class]} { package require oo }
if {![exists -command sqlite3.open]} { package require sqlite3 }
if {![file exists /mod/etc/webif.db]} {
set ::settingsdb [sqlite3.open /mod/etc/webif.db]
catch {
$::settingsdb query {
CREATE TABLE settings(name text, nval int, tval text);
}
$::settingsdb query {
CREATE UNIQUE INDEX key on settings(name);
}
}
} else {
set ::settingsdb [sqlite3.open /mod/etc/webif.db]
}
class settings {
hostname ""
channel_group 0
@ -51,10 +37,23 @@ class settings {
logsize 1048576
logkeep 2
logage 0
backupsage 15
rtschedule 0
noautoremove 0
}
proc {settings _create} {} {
global settingsdb
catch {
$settingsdb query {
CREATE TABLE settings(name text, nval int, tval text);
}
$settingsdb query {
CREATE UNIQUE INDEX key on settings(name);
}
}
}
proc {settings _safer_query} { queryText args } {
global settingsdb
@ -235,7 +234,8 @@ settings method nohelplinks {{val -1}} {
}
settings method notwitfeed {{val -1}} {
return [$self _nval_setting notwitfeed $val]
# return [$self _nval_setting notwitfeed $val]
return 1
}
settings method nounwatchedcount {{val -1}} {
@ -316,12 +316,15 @@ settings method audiomp3descr {val} {
settings method channel_groups {} {
set ret ""
set res ""
set db [sqlite3.open /var/lib/humaxtv/setup.db]
set res [$db query {
select itemText from TBL_MENUCONFIG
where itemName like 'FAV\_CUSTOM\_STR%%' ESCAPE '\'
order by itemName
}]
catch {
set res [$db query {
select itemText from TBL_MENUCONFIG
where itemName like 'FAV\_CUSTOM\_STR%%' ESCAPE '\'
order by itemName
}]
}
$db close
foreach g $res {
set g $g(itemText)
@ -419,9 +422,7 @@ settings method delacluser {user} {
}
settings method smartdata {} {
global settingsdb
set res [$settingsdb query "
set res [settings _safer_query "
select name, nval, tval from settings
where name like 'SMART_%%'
"]
@ -450,9 +451,33 @@ settings method logage {{num -1}} {
return $val
}
settings method backupsage {{num -1}} {
set val [$self _nval_setting backupsage $num]
if {$val == 0} {
return 15
}
return $val
}
settings method dedup_template {{pattern -1}} {
set val [$self _tval_setting dedup_template $pattern]
if {$val eq "0"} { set val "s%se%E - " }
return $val
}
set dbname /mod/etc/webif.db
if {![file exists $dbname]} {
set ::settingsdb [sqlite3.open $dbname]
settings _create
} else {
set ::settingsdb [sqlite3.open $dbname]
try {
# force use of index (SQLite3 extension) for validation
$::settingsdb query {
select name, nval, tval from settings indexed by key where name = '';
}
} on error {msg opts} {
settings _create
}
}

Some files were not shown because too many files have changed in this diff Show More