Compare commits

...

16 Commits

Author SHA1 Message Date
hummypkg
0bca853384 1.0.1
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1534 2a923420-c742-0410-a762-8d5b09965624
2013-04-10 21:49:11 +00:00
hummypkg
38a079b0ba 1.0.0-2
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1524 2a923420-c742-0410-a762-8d5b09965624
2013-04-05 20:07:42 +00:00
hummypkg
cf0a6b5028 1.0.0 final
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1522 2a923420-c742-0410-a762-8d5b09965624
2013-04-04 22:44:16 +00:00
hummypkg
93cbf651ba synchronise scheduled event detection with RS code. Add blue shading
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1521 2a923420-c742-0410-a762-8d5b09965624
2013-04-04 22:20:41 +00:00
hummypkg
26ef83fbff add button links to foot of front page
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1520 2a923420-c742-0410-a762-8d5b09965624
2013-04-04 00:24:24 +00:00
hummypkg
a1e45d5e9c 1.0.0 rc
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1519 2a923420-c742-0410-a762-8d5b09965624
2013-04-03 23:50:25 +00:00
hummypkg
232546feef checkpoint on the way to 1.0.0
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1516 2a923420-c742-0410-a762-8d5b09965624
2013-04-03 22:42:15 +00:00
hummypkg
246112d68f new channelicons + nocase sort
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1502 2a923420-c742-0410-a762-8d5b09965624
2013-03-26 19:11:13 +00:00
hummypkg
b2c7be03a4 add thumbnail generation
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1445 2a923420-c742-0410-a762-8d5b09965624
2013-03-11 23:00:41 +00:00
hummypkg
ccf3cc1888 add thumbnail generation/display
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1442 2a923420-c742-0410-a762-8d5b09965624
2013-03-07 23:37:56 +00:00
hummypkg
9d3e52edd3 fix decrypt
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1441 2a923420-c742-0410-a762-8d5b09965624
2013-03-07 21:41:38 +00:00
hummypkg
612f9f8866 add automp3, fix ffmpeg
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1440 2a923420-c742-0410-a762-8d5b09965624
2013-03-06 22:49:28 +00:00
hummypkg
d4a4af756d fix ffmpeg
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1439 2a923420-c742-0410-a762-8d5b09965624
2013-03-06 19:46:44 +00:00
hummypkg
070fd7a749 update
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1436 2a923420-c742-0410-a762-8d5b09965624
2013-03-05 00:10:38 +00:00
hummypkg
2f570f6ea0 fix dedup fastpath, cross-device renames, undelete on usb drives, directory menu outside of media root
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1425 2a923420-c742-0410-a762-8d5b09965624
2013-02-27 23:15:37 +00:00
hummypkg
fa8b6d7e7c 0.13.0
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1423 2a923420-c742-0410-a762-8d5b09965624
2013-02-25 23:57:55 +00:00
72 changed files with 3152 additions and 398 deletions

View File

@@ -1,9 +1,9 @@
Package: webif
Priority: optional
Section: web
Version: 0.12.1
Version: 1.0.1
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.0.4-1),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73-1),jim-cgi(>=0.7),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.10),hmt(>=1.1.13),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools,tmenu(>=1.05)
Suggests: ffmpeg
Depends: webif-channelicons(>=1.0.5),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73-1),jim-cgi(>=0.7),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.13),hmt(>=1.1.13),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools,tmenu(>=1.05),ffmpeg,id3v2
Suggests:
Description: An evolving web interface for the Humax.

View File

@@ -1,5 +1,7 @@
#!/bin/sh
echo "Postinstall $*"
export tmpf=/tmp/cronf.$$
# Add cron jobs
@@ -17,15 +19,27 @@ grep -v webif/lib/bin/auto $cronf > $tmpf
# Add anacron jobs
ana=$PKG_ROOT/etc/anacrontab
grep -v 'backup/backup.jim' $ana > $tmpf
egrep -v 'backup/backup.jim|diskattrs' $ana > $tmpf
(
cat $tmpf
echo "1 8 sched_backup /mod/var/mongoose/cgi-bin/backup/backup.jim"
echo "1 5 diskattrs /mod/webif/lib/bin/diskattrs"
) > $ana
$PKG_ROOT/etc/init.d/S02anacron start < /dev/null > /dev/null 2>&1 &
[ -f /tmp/webif_auto.log ] && rm -f /tmp/webif_auto.log
if [ ! -f /mod/webif/.strip-updated ]; then
echo "*********************************"
echo "* Please wait while any shrunk recordings are flagged..."
echo "*********************************"
/mod/webif/lib/bin/strip-update
touch /mod/webif/.strip-updated
fi
/mod/webif/lib/bin/diskattrs
exit 0

View File

@@ -10,7 +10,7 @@ if [ -f $cronf ]; then
fi
ana=/mod/etc/anacrontab
grep -v 'backup/backup.jim' $ana > $tmpf
egrep -v 'backup/backup.jim|diskattrs' $ana > $tmpf
cp $tmpf $ana
exit 0

View File

@@ -7,7 +7,8 @@ require settings.class plugin system.class
httpheader
if {[cgi_get act] eq "https"} {
if {[cgi_get val off] eq "off"} {
set val [cgi_get val off]
if {$val in {0 off}} {
file delete /mod/etc/mongoose.cert
puts "HTTPS Server will be disabled after next reboot."
} else {
@@ -18,7 +19,8 @@ if {[cgi_get act] eq "https"} {
}
if {[cgi_get act] eq "xtelnet"} {
if {[cgi_get val off] eq "off"} {
set val [cgi_get val off]
if {$val in {0 off}} {
file delete /mod/boot/xtelnet
puts "Telnet server expert mode will be disabled after next reboot."
} else {
@@ -37,9 +39,11 @@ set epg_style [$settings epg_style]
set pkgdev [$settings pkgdev]
set notoolbar [$settings notoolbar]
set nomobile [$settings nomobile]
set nohelplinks [$settings nohelplinks]
set xepghours [$settings xepghours]
if {$xepghours == 0} { set xepghours 4 }
set genrededup [$settings genrededup]
set autolog [$settings autolog]
# Handle updates
@@ -79,7 +83,9 @@ handle_str_update epg_style $epg_style "EPG Type"
handle_int_update pkgdev $pkgdev "Development Package Display"
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 genrededup $genrededup "Genre search dedup"
handle_int_update autolog $autolog "Auto-processing log level"
set acluser [cgi_get acluser "-"]
set aclpass [cgi_get aclpass "-"]
@@ -120,6 +126,22 @@ puts {
<link href=/css/iphone-style-checkboxes.css rel=stylesheet type=text/css />
}
proc setting_toggle {name attr checked {invert 0} {val 0}} {
puts -nonewline "
<tr>
<th class=key>$name</th>
<td><input class=setting_toggle type=checkbox value=yes"
if {$checked} { puts -nonewline " checked" }
puts -nonewline " attr=$attr"
if {$invert} { puts -nonewline " invert=1" }
if {$val} { puts -nonewline " useval=1" }
puts -nonewline ">
<div id=${attr}_output></div>
</td>
</tr>
"
}
puts "
<fieldset style=\"display: inline\">
<legend>
@@ -144,36 +166,36 @@ puts "
</tr>
"
puts -nonewline "
<tr>
<th class=key>HTTPS web server?</th>
<td><input id=https_toggle name=https type=checkbox value=yes"
if {[file exists /mod/etc/mongoose.cert]} { puts -nonewline " checked" }
puts ">
<div id=https_output></div>
</td>
</tr>
"
setting_toggle "HTTPS web server?" "https" \
[file exists /mod/etc/mongoose.cert] 0 1
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
puts -nonewline "
<tr>
<th class=key>Slide-down toolbar?</th>
<td><input id=toolbar_toggle name=toolbar type=checkbox value=yes"
if {$notoolbar == 0} { puts -nonewline " checked" }
puts ">
<div id=toolbar_output></div>
</td>
</tr>
<form class=auto id=autolog method=get action=$env(REQUEST_URI)>
<th class=key>Auto-processing log level</th>
<td><select id=autolog name=autolog
class=\"text ui-widget-content ui-corner-all\">
"
puts -nonewline "
<tr>
<th class=key>Mobile link on main page?</th>
<td><input id=mobile_toggle name=mobile type=checkbox value=yes"
if {$nomobile == 0} { puts -nonewline " checked" }
puts ">
<div id=mobile_output></div>
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 == 1} { puts " selected" }
puts ">Debugging information\n"
puts "
</select>
<small>
<input name=autolog value=\"set\" type=submit>
</small>
<div id=autolog_output></div>
</td>
</form>
</tr>
"
@@ -268,49 +290,43 @@ puts "
</tr>
"
puts -nonewline "
<tr>
<th class=key>De-duplicate genre search results?</th>
<td><input id=genrededup_toggle name=genrededup type=checkbox value=yes"
if {$genrededup == 1} { puts -nonewline " checked" }
puts ">
<div id=genrededup_output></div>
</td>
</tr>
"
setting_toggle "De-duplicate genre search results?" genrededup $genrededup
puts "
</table>
</fieldset>
<br><br>
<fieldset style=\"display: inline\">
<legend> Email Settings </legend>
<table>
"
puts "
<tr>
<form class=auto id=smtp_server method=get action=$env(REQUEST_URI)>
<th class=key>SMTP Server for outbound email</th>
<td><input name=smtp_server value=\"$smtp_server\"
class=\"text ui-widget-content ui-corner-all\"
length=20 maxlength=50>
<small>
<input id=smtp_server_submit value=\"change\" type=submit>
</small>
<div id=smtp_server_output></div>
</td>
</form>
</tr>
"
#puts "
# <fieldset style=\"display: inline\">
# <legend> Email Settings </legend>
# <table>
#"
#
#puts "
# <tr>
# <form class=auto id=smtp_server method=get action=$env(REQUEST_URI)>
# <th class=key>SMTP Server for outbound email</th>
# <td><input name=smtp_server value=\"$smtp_server\"
# class=\"text ui-widget-content ui-corner-all\"
# length=20 maxlength=50>
# <small>
# <input id=smtp_server_submit value=\"change\" type=submit>
# </small>
# <div id=smtp_server_output></div>
# </td>
# </form>
# </tr>
#"
#
#puts "
# </table>
# </fieldset>
# <br><br>
#"
puts "
</table>
</fieldset>
"
puts "
<br><br>
<fieldset style=\"display: inline\">
<legend> Web Interface User Access Control </legend>
<table>
@@ -405,34 +421,16 @@ puts -nonewline "
<fieldset style=\"display: inline\">
<legend> Advanced Settings </legend>
<table>
<tr>
<th class=key>Show development and advanced packages?</th>
<td><input name=pkgdev id=pkgdev value=1 type=checkbox
"
if {$pkgdev} { puts -nonewline " checked" }
puts ">
</td>
</tr>
"
setting_toggle "Show development and advanced packages?" "pkgdev" $pkgdev
if {[system modversion 1] >= 214} {
puts -nonewline "
<tr>
<th class=key>Expert mode telnet server?</th>
<td><input id=xtelnet_toggle name=xtelnet type=checkbox value=yes"
if {[file exists /mod/boot/xtelnet]} { puts -nonewline " checked" }
puts ">
<div id=xtelnet_output></div>
</td>
</tr>
"
setting_toggle "Expert mode telnet server?" "xtelnet" \
[file exists /mod/boot/xtelnet] 0 1
}
puts "
</table>
<div id=pkgdev_output></div>
</fieldset>
"

View File

@@ -41,117 +41,33 @@ $(document).ready(function () {
});
});
$('#pkgdev').change(function() {
$('.setting_toggle').change(function() {
var arg = '0';
var urlargs;
if ($(this).attr('checked'))
arg = '1';
$(this).disable();
if ($(this).attr('invert'))
arg = arg == "0" ? "1" : "0";
$('#pkgdev_output')
.empty()
.show('slow')
.load('/cgi-bin/settings.jim?pkgdev=' + arg,
function() {
$('#pkgdev').enable();
$('#pkgdev_output')
.css('font-style', 'italic')
.delay(2000).fadeOut('slow');
});
});
var el = $(this);
var attr = $(this).attr('attr');
var output = '#' + attr + '_output';
$('#https_toggle').change(function() {
var arg = 'off';
if ($(this).attr('checked'))
arg = 'on';
if ($(this).attr('useval'))
urlargs = 'act=' + attr + '&val=' + arg;
else
urlargs = attr + '=' + arg;
$(this).disable();
$('#https_output')
.empty()
.html('<img src=/img/loading.gif>Please Wait...')
.show('slow')
.load('/cgi-bin/settings.jim?act=https&val=' + arg,
function() {
$('#https_toggle').enable();
$('#https_output')
.css('font-style', 'italic')
.delay(2000).fadeOut('slow');
});
});
$('#xtelnet_toggle').change(function() {
var arg = 'off';
if ($(this).attr('checked'))
arg = 'on';
$(this).disable();
$('#xtelnet_output')
.empty()
.html('<img src=/img/loading.gif>Please Wait...')
.show('slow')
.load('/cgi-bin/settings.jim?act=xtelnet&val=' + arg,
function() {
$('#xtelnet_toggle').enable();
$('#xtelnet_output')
.css('font-style', 'italic')
.delay(2000).fadeOut('slow');
});
});
$('#toolbar_toggle').change(function() {
var arg = '1';
if ($(this).attr('checked'))
arg = '0';
$(this).disable();
$('#toolbar_output')
$(output)
.empty()
.show('slow')
.load('/cgi-bin/settings.jim?notoolbar=' + arg,
.load('/cgi-bin/settings.jim?' + urlargs,
function() {
$('#toolbar_toggle').enable();
$('#toolbar_output')
.css('font-style', 'italic')
.delay(2000).fadeOut('slow');
});
});
$('#mobile_toggle').change(function() {
var arg = '1';
if ($(this).attr('checked'))
arg = '0';
$(this).disable();
$('#mobile_output')
.empty()
.show('slow')
.load('/cgi-bin/settings.jim?nomobile=' + arg,
function() {
$('#mobile_toggle').enable();
$('#mobile_output')
.css('font-style', 'italic')
.delay(2000).fadeOut('slow');
});
});
$('#genrededup_toggle').change(function() {
var arg = '0';
if ($(this).attr('checked'))
arg = '1';
$(this).disable();
$('#genrededup_output')
.empty()
.show('slow')
.load('/cgi-bin/settings.jim?genrededup=' + arg,
function() {
$('#genrededup_toggle').enable();
$('#genrededup_output')
$(el).enable();
$(output)
.css('font-style', 'italic')
.delay(2000).fadeOut('slow');
});

View File

@@ -63,7 +63,10 @@ if {[llength $data]} {
foreach name [array names ndata] {
if {![dict exists $seen $name]} { set seen($name) 0 }
if {![dict exists $data $name]} { set data($name) 0 }
if {$ndata($name) == -1} {
if {[file exists "/mod/tmp/webif_auto/decrypting.$name.ts"]} {
set mode "Decrypting"
set icon "178_1_00_Icon_Lock.png style=\"padding: 0 0.2em 0 0.5em\""
} elseif {$ndata($name) == -1} {
incr rec
incr play
set mode "Chase Playing"

View File

@@ -173,7 +173,10 @@ foreach e $records {
clock format $ee -format "%H:%M"])"
if {$showing} { append hxt " ($perc%)" }
puts "<div class=\"xeprog $bg\"
set lbg $bg
if {[$e scheduled]} { set lbg "blueshade" }
puts "<div class=\"xeprog $lbg\"
style=\"width: [expr $px - 4]px;\" title=\"$htxt\">
<a class=event href=# xs=[$e get service_id]
xe=[$e get event_id] sch=[$e get sched_type]
@@ -221,7 +224,7 @@ puts "
onSelect: function(val, sel) {
var stt = \$(this).attr('stt');
// Extract date part
dval = ~~(val / 86400000);
dval = Math.round(val / 86400000.0);
// Extract current time part
var tm = ~~(stt % 86400);

View File

@@ -21,10 +21,14 @@ if {$model eq "HDR"} {
}
if {[system pkginst ffmpeg]} {
puts {
<li><a href=#audio>Extract Audio</a></li>
<li><a href=#mpg>Extract to MPG</a></li>
<li class=mp3><a href=#audio>Extract Audio</a></li>
<li class=mpg><a href=#mpg>Extract to MPG</a></li>
<li class=thm><a href=#thm>Set Thumbnail</a></li>
}
}
puts { <li><a href=#vthm>View Thumbnail</a></li> }
if $nicesplice {
puts {
<li class="cut"><a href=#crop>Crop</a></li>
@@ -45,6 +49,14 @@ puts {
<li><a href=#download>Download</a></li>
</ul>
<ul id=dooptmenu class=contextMenu style="width: 250px">
<li class=delete><a href=#delete>Delete</a></li>
<li class=cut><a href=#cut>Cut to clipboard</a></li>
<li class=pwcopy><a href=#copy>Copy to clipboard</a></li>
<li class=pwpaste><a href=#paste>Paste to folder</a></li>
<li class=separator><a href=#rename>Rename</a></li>
</ul>
<ul id=doptmenu class=contextMenu style="width: 250px">
<li class=delete><a href=#delete>Delete</a></li>
<li class=cut><a href=#cut>Cut to clipboard</a></li>
@@ -69,7 +81,16 @@ if $flatten {
puts {
<li class=clock><a href=#expire>Auto-Expire</a></li>
<li class=mpg><a href=#mpg>Auto-MPG Extract</a></li>
}
if {[system pkginst ffmpeg]} {
puts {
<li class=mp3><a href=#mp3>Auto-Audio Extract</a></li>
<li class=mpg><a href=#mpg>Auto-MPG Extract</a></li>
}
}
puts {
</ul>
<div id=renameform title="Rename media file" style="display: none">
@@ -270,5 +291,9 @@ Please wait...
</center>
</div>
<div id=bmpdialogue title="Recording Thumbnail" class=hidden>
<img id=thmbmp class=doublebmp src="about:blank">
</div>
}

View File

@@ -0,0 +1,19 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require cat
set file [cgi_get file]
set file "[file rootname $file].thm"
if {![file exists $file]} {
httpheader "text/plain"
puts "No such file, $file"
exit
}
httpheader "image/bmp"
cat "/mod/webif/lib/bmpheader"
cat $file

View File

@@ -11,7 +11,7 @@ set rfile [cgi_get file]
set ts [ts fetch $rfile]
set dir [file dirname $rfile]
set len [$ts duration 1]
lassign [$ts dlnaloc] url
lassign [$ts dlnaloc "127.0.0.1"] url
puts "
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />

View File

@@ -11,7 +11,7 @@ set rfile [cgi_get file]
set ts [ts fetch $rfile]
set dir [file dirname $rfile]
set len [$ts duration 1]
lassign [$ts dlnaloc] url
lassign [$ts dlnaloc "127.0.0.1"] url
if {$url eq ""} {
puts "This file has not been indexed by the media server.

View File

@@ -23,7 +23,12 @@ if {$type eq "ts"} {
<table class=keyval>
<tr>
<th>Title</th>
<td>[$ts get title]</td>
<td class=va>
"
if {[file exists "[file rootname $file].thm"]} {
puts "<img class=\"bmp va\" width=70 height=39 src=\"bmp.jim?file=$file\">"
}
puts "[$ts get title]</td>
</tr><tr>
<th>Synopsis</th>
<td>[$ts get synopsis]</td>
@@ -146,7 +151,7 @@ puts "
</table>
"
set url "/bin/browse/ffmpeg.jim?file=[cgi_quote_url $file]"
set url "/browse/ffmpeg.jim?file=[cgi_quote_url $file]"
puts { <script type="text/javascript"> }
puts "var url = \"$url\";"
puts {

View File

@@ -56,9 +56,15 @@ proc directory {file bfile tbfile} {
puts [join $icons ""]
puts "</span>"
if {[string first $::mroot $file] >= 0} {
set class dopt
} else {
set class doopt
}
puts -nonewline "
<a href=#>
<img class=\"dopt va\" border=0 width=45 "
<img class=\"$class va\" border=0 width=45 "
puts -nonewline [join $attrs " "]
puts "
src=/images/181_1_00_Help5_OPT_Plus.png>
@@ -90,11 +96,13 @@ proc entry {file} {{i 0}} {
set base [file rootname $file]
set thmok 0
if {$ext eq ".ts" && [file exists "${base}.nts"]} {
set type ts
set ts [ts fetch $file 1]
set img Video_TS
set omenu opt
if {[file exists "${base}.thm"]} { set thmok 1 }
} elseif {$ext eq ".hmt"} {
if {[file exists "${base}.ts"]} { continue }
# Sole hmt file indicates failure to track.
@@ -146,6 +154,7 @@ proc entry {file} {{i 0}} {
set def unknown
set bx 0
set dlna 0
set shrunk 0
if {$type eq "ts"} {
set genre [$ts get genre]
set glist [ts genrelist]
@@ -198,12 +207,11 @@ proc entry {file} {{i 0}} {
set dlna 1
}
# Shrunk (shown when necessary via Ajax)
icon "/img/compress.png" "Shrunk" \
"id=\"sp_$tbfile\"" "va hidden"
# Timeshifted (shown when necessary via Ajax)
# icon "/img/clock.png" "Time-shifted Recording" \
# "id=\"tsr_$tbfile\"" "va hidden"
# Shrunk
if {[$ts flag Shrunk]} {
icon "/img/compress.png" "Shrunk"
set shrunk 1
}
set bx [$ts get bookmarks]
}
@@ -214,8 +222,8 @@ proc entry {file} {{i 0}} {
<a href=#>
<img class=\"$omenu va\" border=0 width=45 type=$type did=$i
locked=$locked encd=$encd def=$def new=$new bx=$bx
rsize=$rsz
odencd=$odencd dlna=$dlna
shrunk=$shrunk rsize=$rsz
odencd=$odencd dlna=$dlna thmok=$thmok
src=/images/181_1_00_Help5_OPT_Plus.png>
</a>
<div class=\"results blood\" style=\"margin: 0 0 0 5em\"></div>
@@ -223,7 +231,8 @@ proc entry {file} {{i 0}} {
puts "</div>"
}
set dir [cgi_get dir [system mediaroot]]
set mroot [system mediaroot]
set dir [cgi_get dir $mroot]
######################################################################
# Render web page
@@ -242,6 +251,7 @@ source assets.jim
puts "
<span style=\"display:none\" id=dir>$dir</span>
<span style=\"display:none\" id=mediaroot>$mroot</span>
<fieldset class=cleft style=\"margin: 0 1em 1em 1em\">
<legend style=\"font-size: 1.5em; padding: 0 0.5em 0.5em 0.5em;\">
"
@@ -298,7 +308,7 @@ proc s_time {a b} {
set files [readdir -nocomplain $dir]
switch $order {
1 { set files [lsort -command s_time $files] }
default { set files [lsort $files] }
default { set files [lsort -nocase $files] }
}
foreach file $files { entry "$dir/$file" }

View File

@@ -33,12 +33,12 @@ function reloadclipboard()
if ($('#clipclear').length)
{
$('#paste').enable();
$('#doptmenu').enableContextMenuItems('#paste');
$('#doptmenu,#dooptmenu').enableContextMenuItems('#paste');
}
else
{
$('#paste').disable();
$('#doptmenu').disableContextMenuItems('#paste');
$('#doptmenu,#dooptmenu').disableContextMenuItems('#paste');
}
$('#clipclear').button().click(function() {
@@ -125,23 +125,23 @@ function new_folder_callback(data, status, xhr)
$.each(data, set_folder_new);
}
function insert_shrunk(file, perc)
{
if (perc == 0)
{
file = file.replace(/[ ]/g, '');
file = file.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1');
//console.log("File: (%s) = (%s)", file, perc);
$('#sp_' + file).show();
}
}
//function insert_shrunk(file, perc)
//{
// if (perc == 0)
// {
// file = file.replace(/[ ]/g, '');
// file = file.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1');
// //console.log("File: (%s) = (%s)", file, perc);
// $('#sp_' + file).show();
// }
//}
function shrunk_callback(data, status, xhr)
{
//console.log("Status: %s", status);
//console.dir(data);
$.each(data, insert_shrunk);
}
//function shrunk_callback(data, status, xhr)
//{
// //console.log("Status: %s", status);
// //console.dir(data);
// $.each(data, insert_shrunk);
//}
function delete_callback(file, dir, id)
{
@@ -178,6 +178,20 @@ function new_callback(file, type, id)
$.get(url, function() { window.location.reload(true); });
}
function thumbnail_callback(file, type, id)
{
var el = 'div.bf#' + id;
var results = el + ' .results';
$(results)
.html('<img src=/img/loading.gif>Generating thumbnail, ' +
'please wait...')
.slideDown('slow')
.load('/browse/thumbnail.jim?file=' + file)
.delay(3000)
.slideUp('slow');
$('div.bf#' + id + ' img.opt').attr('thmok', 1);
}
function rename_submit()
{
var s = $('#renameform_form').serialize();
@@ -257,6 +271,16 @@ function preparemenu(el, menu)
else
$(menu).disableContextMenuItems('#crop');
if (el.attr('odencd') == 0)
$(menu).enableContextMenuItems('#thm');
else
$(menu).disableContextMenuItems('#thm');
if (el.attr('thmok') == 1)
$(menu).enableContextMenuItems('#vthm');
else
$(menu).disableContextMenuItems('#vthm');
$(menu).enableContextMenuItems('#strip');
if (el.attr('rsize') > 4294967296)
@@ -358,6 +382,7 @@ function preparedmenu(el, menu)
fixdmenu(el, menu, 'autodedup', '#dedup', 'Auto-dedup', 0);
fixdmenu(el, menu, 'autodecrypt', '#decrypt', 'Auto-decrypt', 1);
fixdmenu(el, menu, 'autompg', '#mpg', 'Auto-mpg', 0);
fixdmenu(el, menu, 'automp3', '#mp3', 'Auto-audio', 0);
fixdmenu(el, menu, 'autoexpire', '#expire', 'Auto-expire', 0);
}
@@ -423,6 +448,19 @@ var menuclick = function(action, el, pos)
$('#renameform').dialog('open');
break;
case 'thm':
window.location.href = '/browse/thumbnail/index.jim?file=' +
file;
break;
case 'vthm':
// window.open('/browse/bmpw.jim?file=' + file, 'hxwebifbmp',
// 'height=156,width=280,toolbar=no,' +
// 'scrollbars=no,menubar=no,location=no,titlebar=no');
$('#thmbmp').attr('src', 'bmp.jim?file=' + file);
$('#bmpdialogue').dialog('open');
break;
case 'download':
window.location.href = '/browse/download.jim?file=' +
file + '&base=' +
@@ -569,6 +607,10 @@ var dmenuclick = function(action, el, pos)
flagdir(file, 'autompg', iconset, results, el);
break;
case 'mp3':
flagdir(file, 'automp3', iconset, results, el);
break;
case 'shrink':
flagdir(file, 'autoshrink', iconset, results, el);
break;
@@ -625,6 +667,15 @@ var dmenuclick = function(action, el, pos)
dmenuclick
);
$('img.doopt').contextMenu(
{
menu: 'dooptmenu',
leftButton: true,
beforeShow: preparedmenu
},
dmenuclick
);
// Disable items which are not yet implemented.
$('#optmenu').disableContextMenuItems('#title');
@@ -734,6 +785,18 @@ var dmenuclick = function(action, el, pos)
close: function() { $('#savestream_name').val(''); }
});
$('#bmpdialogue').dialog({
autoOpen: false,
height: 'auto', width: 'auto',
modal: true,
buttons: {
"Close": function() {
$(this).dialog('close');
}
},
close: function() { $('#thmbmp').attr('src', 'about:blank'); }
});
// Create re-usable confirmation dialogue.
$confirm = $('#confirm').dialog({
modal: true, autoOpen: false,
@@ -747,8 +810,8 @@ var dmenuclick = function(action, el, pos)
folder_size_callback);
// Flag shrunk recordings
$.getJSON('/browse/shrunk.jim?dir=' + encodeURIComponent(dir),
shrunk_callback);
// $.getJSON('/browse/shrunk.jim?dir=' + encodeURIComponent(dir),
// shrunk_callback);
// Flag folders with unwatched items
$.getJSON('/browse/newdir.jim?dir=' + encodeURIComponent(dir),

View File

@@ -2,18 +2,29 @@
package require cgi
source /mod/webif/lib/setup
require ts.class
httpheader "application/json"
set dir [cgi_get dir "/media/My Video/Children"]
set dir [cgi_get dir "-"]
if {$dir eq "-"} exit
puts "{"
foreach file [readdir -nocomplain $dir] {
if {![string match {*.ts} $file]} { continue }
set xfile [file rootname $file]
if {[catch {set eit [exec /mod/bin/stripts -cq "$dir/$xfile"]}]} {
continue
if {[catch {set ts [ts fetch "$dir/$file"]}]} continue
set eit 1
if {[$ts flag "Shrunk"]} { set eit 0 }
if {$eit} {
set xfile [file rootname $file]
if {[catch {set eit [\
exec /mod/bin/stripts -cq "$dir/$xfile"]}]} {
continue
}
if {!$eit} { $ts set_shrunk }
}
puts " \"$file\": $eit,"

View File

@@ -43,6 +43,7 @@ set newname "$shname-[clock seconds]"
puts "Renaming file group to $newname"
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]
puts "Time taken: $striptime"

View File

@@ -0,0 +1,19 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require ts.class cat
httpheader "image/bmp"
set rfile [cgi_get file]
set pos [cgi_get pos 0]
if {![catch {set ts [ts fetch $rfile]}]} {
$ts mkbmp $pos ".pos$pos"
set f "[file rootname $rfile].pos$pos.bmp"
cat $f
file delete $f
}

View File

@@ -0,0 +1,17 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require cat
httpheader "image/bmp"
set rfile [cgi_get file]
set pos [cgi_get pos 0]
set f "[file rootname $rfile].pos$pos.bmp"
if {[file exists $f]} {
cat $f
file delete $f
}

View File

@@ -0,0 +1,98 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require ts.class pretty_size
header
set rfile [cgi_get file]
set ts [ts fetch $rfile]
set dir [file dirname $rfile]
set len [$ts duration 1]
lassign [$ts bookmarks] book
if {$book eq ""} { set book 0 }
set pos [cgi_get pos $book]
set pos $($pos + 0)
if {$pos < 0} { set pos 0 }
puts "
<script type=text/javascript src=script.js></script>
<script type=text/javascript src=/js/enadis.js></script>
<fieldset class=cleft>
<legend>Replace Thumbnail</legend>
<table class=keyval cellpadding=5>
<tr><th>File:</th><td>
<span class=hidden id=dir>[file dirname $rfile]</span>
<span id=file>$rfile</span>
</td></tr>
<tr><th>Length:</th><td>[clock format $len -format %T]</td></tr>
<tr><th>Size:</th><td>[pretty_size [$ts size]] ([$ts get definition])</td></tr>
<tr><th>Bookmarks:</th><td>[$ts get bookmarks] ($book second(s))</td></tr>
<tr><th>Thumbnail:</th><td>
<img class=doublebmp src=\"../bmp.jim?file=[cgi_quote_url $rfile]\">
</td></tr>
</table>
"
if {[$ts get definition] eq "HD"} {
set start $($pos - 0.5)
set incr 1.0
} else {
set start $($pos - 1)
set incr 2.0
}
if {$start < 0} { set start 0 }
set limit $($start + $incr)
puts "<div style=\"width=100%; text-align: center\">
<button id=back>Back to media browser</button>
<br /> <br />
<form method=get action=index.jim>
<input type=hidden name=file value=\"$rfile\">
Thumbnails from around
<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 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>
</div>
<span id=start class=hidden>$start</span>
<span id=end class=hidden>$limit</span>
<table class=keyval cellpadding=5>
<tr>
"
for {set i [expr $start + 0.0]} {$i <= $limit} {set i [expr $i + 0.5]} {
lappend times $i
puts "<th style=\"text-align: center\">
@ <span class=mark>$i</span>s</th>"
}
puts "</tr><tr>"
foreach i $times {
puts "<td>
<img class=bmp src=/img/generating.png pos=$i>
</td>"
}
puts "</tr><tr>"
foreach i $times {
puts "<td style=\"text-align: center\">
<button class=usethm pos=\"$i\">Use</button>
</td>"
}
puts "</tr>"
puts "</table>"

View File

@@ -0,0 +1,21 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require ts.class
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]
if {![catch {set ts [ts fetch $rfile]}]} {
$ts cleanbmp
for {set n [expr $s + 0.0]} {$n <= $e} {set n [expr $n + $i]} {
puts "Generating thumbnail for pos $n"
$ts mkbmp $n ".pos$n"
}
}

View File

@@ -0,0 +1,58 @@
$(document).ready(function() {
var dir = $('#dir').text();
var file = $('#file').text();
$('button').button();
function go(pos)
{
window.location.href = 'index.jim?file=' +
encodeURIComponent(file) + '&pos=' + pos;
}
$('button.mvpos').disable().on('click', function(e) {
e.preventDefault();
var pos = $(this).attr('pos');
go(pos);
});
$('#repos').disable().on('click', function(e) {
e.preventDefault();
var pos = $('#pos').val();
go(pos);
});
$('#back').on('click', function(e) {
e.preventDefault();
window.location.href = '/browse/index.jim?dir=' +
encodeURIComponent(dir);
});
$('button.usethm').disable().on('click', function(e) {
e.preventDefault();
var pos = $(this).attr('pos');
$('button,input').disable();
$.get('set.jim?file=' + encodeURIComponent(file) + '&pos=' + pos,
function() {
window.location.href = '/browse/index.jim?dir=' +
encodeURIComponent(dir);
});;
});
var start = $('#start').text();
var end = $('#end').text();
$.get('mkrange.jim?file=' + encodeURIComponent(file) +
'&s=' + start + '&e=' + end, function() {
$('img.bmp').each(function(i) {
var pos = $(this).attr('pos');
$(this).attr('src',
'fetch.jim?file=' + encodeURIComponent(file) +
'&pos=' + pos);
});
$('button').enable();
});
});

View File

@@ -0,0 +1,15 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require ts.class
httpheader
set file [cgi_get file]
set pos [cgi_get pos 0]
if {![catch {set ts [ts fetch $file]}]} {
$ts mkthm $pos
}

View File

@@ -70,6 +70,8 @@
.contextMenu LI.decrypt A { background-image: url(/img/context/decrypt.png); }
.contextMenu LI.decryptr A { background-image: url(/img/context/decryptr.png); }
.contextMenu LI.mpg A { background-image: url(/img/context/mpg.png); }
.contextMenu LI.mp3 A { background-image: url(/img/context/mp3.png); }
.contextMenu LI.clock A { background-image: url(/img/context/clock.png); }
.contextMenu LI.thm A { background-image: url(/img/context/thumb.png); }

View File

@@ -65,13 +65,33 @@ div.footer
padding-top: 2em;
}
div.warningbox
div.owarningbox
{
background: url('/img/redshade.png') repeat-x;
padding: 0.5em;
margin: 1em;
}
div.warningbox
{
width: 60%;
background: url('/img/redshade.png') repeat-x;
background-size: 100%;
#color: #005000;
border: 1px solid #7a4707;
padding: 10px;
position: relative;
top: -2px;
left: -2px;
font-weight: bold;
z-index: 30;
box-shadow: 2px 2px 11px #666;
-moz-box-shadow: 2px 2px 11px #666;
-webkit-box-shadow: 2px 2px 11px #666;
border-radius: 5px;
-moz-border-radius: 5px;
}
table
{
empty-cells: show;
@@ -410,3 +430,18 @@ div#restart_block
z-index: 31;
}
img.bmp, img.doublebmp
{
transform: scaleY(-1);
-webkit-transform: scaleY(-1);
-o-transform: scaleY(-1);
height: 78px;
width: 140px;
}
img.doublebmp
{
height: 156px;
width: 280px;
}

View File

@@ -68,6 +68,7 @@ foreach file [readdir $dir] {
# Dooooo, it.
$ts settitle $syn
ts renamegroup $file $fn
$ts set_deduped
puts -nonewline "Done"
}
}

View File

@@ -6,8 +6,11 @@ proc dedupprocess {file} {{seen {}}} {
set ts [ts fetch $file 1]
if {[$ts flag "Deduped"]} {
lappend seen [file rootname [file tail $file]]
return [list nothing $ts "" ""]
# Fast track content which has already been de-duped.
set fn [file rootname [file tail $file]]
if {$fn in $seen} { set stat dup } else { set stat nothing }
lappend seen $fn
return [list $stat $ts "" $fn]
}
set dir [file dirname $file]

View File

@@ -9,10 +9,12 @@ set logdirs {/var/log /mod/tmp /mnt/hd3}
set logext {.log}
set log [cgi_get file 0]
set unlink [cgi_get unlink 0]
set ldir [file dirname $log]
if {[file dirname $log] in $logdirs && [file extension $log] in $logext} {
file copy -force "/dev/null" $log
if {$unlink} { file delete $log }
puts "Cleared $log"
exit
}

View File

@@ -2,12 +2,12 @@
package require cgi
source /mod/webif/lib/setup
require system.class
require system.class settings.class
header
set space [system diskspace]
set device [string range [lindex $space 5] 0 end-1]
set device [system disk]
set settings [settings]
set smart Unknown
set line ""
@@ -16,9 +16,11 @@ catch { set line [exec /mod/bin/smartctl -H $device | sed -n 5p] } msg
if {$msg ne "" && $line eq ""} { set line $msg }
if {$line ne ""} {
set smart [string range [lindex [split $line :] 1] 1 end]
$settings _tval_setting "SMART_status" $smart
}
puts "
<script type=text/javascript src=/js/enadis.js></script>
<h3 class=va>
<img class=va width=100 src=/img/disc.png>
SMART data read from device $device
@@ -99,9 +101,22 @@ foreach line [split [exec /mod/bin/smartctl -A $device] "\n"] {
id name flags val worst thresh type updated when rval
set class normal
switch $id {
5 { if {$rval > 0} { set class orangeshade } }
197 { if {$rval > 0} { set class redshade } }
198 { if {$rval > 0} { set class redshade } }
5 {
$settings _nval_setting "SMART_realloc" $rval
if {$rval > 0} { set class orangeshade }
}
10 {
$settings _nval_setting "SMART_spinretry" $rval
if {$rval > 0} { set class orangeshade }
}
197 {
$settings _nval_setting "SMART_pending" $rval
if {$rval > 0} { set class redshade }
}
198 {
$settings _nval_setting "SMART_offline" $rval
if {$rval > 0} { set class redshade }
}
}
puts "<tr class=$class>"
puts "
@@ -144,6 +159,7 @@ 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
puts "<tr>
<td>$id</td>
<td>$name</td>
@@ -157,6 +173,28 @@ foreach line [split $msg "\n"] {
puts {
</table>
</fieldset>
<div class=cleft style="padding-top: 2em">
<button id=diskack>Acknowledge any current disk faults.</button>
</div>
<script type=text/javascript>
$(function() {
$('#diskack')
.button()
.on('click', function(e) {
e.preventDefault();
$('button').disable();
$.get('diskack.jim', function() {
window.location.reload(true);
});
});
});
</script>
}
footer

View File

@@ -0,0 +1,16 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require settings.class
httpheader
set settings [settings]
foreach attr {realloc pending offline} {
set val [$settings _nval_setting "SMART_$attr"]
if {$val <= 0} continue
$settings _nval_setting "SMART_ack_$attr" $val
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@@ -0,0 +1 @@
context/mp3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View File

@@ -19,7 +19,6 @@ $(document).ready(function() {
</script>
<!--#exec cmd="/mod/webif/include/menuicons.jim" -->
<!--#exec cmd="/mod/webif/include/menuplugins.jim" -->
</div>
<div class=footer>

View File

@@ -14,8 +14,8 @@
//
// For details, visit http://creativecommons.org/licenses/by/3.0/us/
// Modified by Andy Fiddaman to support left click and
// support modification of menu items.
// Modified by af123 to support left click, modification of menu items and
// utilise jQuery.ui.position for smart element positioning.
if (jQuery) (function() {
$.extend($.fn, {
@@ -53,31 +53,17 @@ if (jQuery) (function() {
if (o.beforeShow) o.beforeShow(el, menu);
// Detect mouse position
var d = {}, x, y;
if (self.innerHeight) {
d.pageYOffset = self.pageYOffset;
d.pageXOffset = self.pageXOffset;
d.innerHeight = self.innerHeight;
d.innerWidth = self.innerWidth;
} else if (document.documentElement &&
document.documentElement.clientHeight) {
d.pageYOffset = document.documentElement.scrollTop;
d.pageXOffset = document.documentElement.scrollLeft;
d.innerHeight = document.documentElement.clientHeight;
d.innerWidth = document.documentElement.clientWidth;
} else if (document.body) {
d.pageYOffset = document.body.scrollTop;
d.pageXOffset = document.body.scrollLeft;
d.innerHeight = document.body.clientHeight;
d.innerWidth = document.body.clientWidth;
}
(e.pageX) ? x = e.pageX : x = e.clientX + d.scrollLeft;
(e.pageY) ? y = e.pageY : x = e.clientY + d.scrollTop;
// Show the menu
$(document).unbind('click');
$(menu).css({ top: y, left: x }).fadeIn(o.inSpeed);
// $(menu).css({ top: y, left: x }).fadeIn(o.inSpeed);
$(menu).css('display', 'block').position({
my: "left top",
at: "right bottom",
of: this,
offset: "0 5",
collision: "fit"
}).css('display', 'none').fadeIn(o.inSpeed);
// Hover events
$(menu).find('A').mouseover(function() {
$(menu).find('LI.hover').removeClass('hover');

View File

@@ -25,6 +25,8 @@ source /mod/webif/html/lib/topbar.jim
puts "<div id=restart_block>"
source /mod/webif/include/restart.jim
puts "</div>"
source /mod/webif/include/diskcheck.jim
source /mod/webif/include/notify.jim
puts {
<div style="clear: both">

View File

@@ -0,0 +1,21 @@
.context-menu-item.icon-pwedit { background-image: url(/img/context/page_white_edit.png); }
.context-menu-item.icon-pwcopy { background-image: url(/img/context/page_white_copy.png); }
.context-menu-item.icon-pwpaste { background-image: url(/img/context/page_white_paste.png); }
.context-menu-item.icon-pwdelete { background-image: url(/img/context/page_white_delete.png); }
.context-menu-item.icon-edit { background-image: url(/img/context/edit.png); }
.context-menu-item.icon-copy { background-image: url(/img/context/copy.png); }
.context-menu-item.icon-paste { background-image: url(/img/context/paste.png); }
.context-menu-item.icon-delete { background-image: url(/img/context/delete.png); }
.context-menu-item.icon-cut { background-image: url(/img/context/cut.png); }
.context-menu-item.icon-quit { background-image: url(/img/context/door.png); }
.context-menu-item.icon-compress { background-image: url(/img/context/compress.png); }
.context-menu-item.icon-compressr { background-image: url(/img/context/compressr.png); }
.context-menu-item.icon-dedup { background-image: url(/img/context/dedup.png); }
.context-menu-item.icon-decrypt { background-image: url(/img/context/decrypt.png); }
.context-menu-item.icon-decryptr { background-image: url(/img/context/decryptr.png); }
.context-menu-item.icon-mpg { background-image: url(/img/context/mpg.png); }
.context-menu-item.icon-mp3 { background-image: url(/img/context/mp3.png); }
.context-menu-item.icon-clock { background-image: url(/img/context/clock.png); }
.context-menu-item.icon-thm { background-image: url(/img/context/thumb.png); }

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 620 B

View File

@@ -0,0 +1,142 @@
/*!
* jQuery contextMenu - Plugin for simple contextMenu handling
*
* Version: git-master
*
* Authors: Rodney Rehm, Addy Osmani (patches for FF)
* Web: http://medialize.github.com/jQuery-contextMenu/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
* GPL v3 http://opensource.org/licenses/GPL-3.0
*
*/
.context-menu-list {
margin:0;
padding:0;
min-width: 120px;
max-width: 250px;
display: inline-block;
position: absolute;
list-style-type: none;
border: 1px solid #DDD;
background: #EEE;
-webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
-ms-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
-o-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
}
.context-menu-item {
padding: 2px 2px 2px 24px;
background-color: #EEE;
position: relative;
-webkit-user-select: none;
-moz-user-select: -moz-none;
-ms-user-select: none;
user-select: none;
}
.context-menu-separator {
padding-bottom:0;
border-bottom: 1px solid #DDD;
}
.context-menu-item > label > input,
.context-menu-item > label > textarea {
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
}
.context-menu-item.hover {
cursor: pointer;
background-color: #39F;
}
.context-menu-item.disabled {
color: #666;
}
.context-menu-input.hover,
.context-menu-item.disabled.hover {
cursor: default;
background-color: #EEE;
}
.context-menu-submenu:after {
content: ">";
color: #666;
position: absolute;
top: 0;
right: 3px;
z-index: 1;
}
/* icons
#protip:
In case you want to use sprites for icons (which I would suggest you do) have a look at
http://css-tricks.com/13224-pseudo-spriting/ to get an idea of how to implement
.context-menu-item.icon:before {}
*/
.context-menu-item.icon { min-height: 18px; background-repeat: no-repeat; background-position: 4px 2px; }
.context-menu-item.icon-edit { background-image: url(images/page_white_edit.png); }
.context-menu-item.icon-cut { background-image: url(images/cut.png); }
.context-menu-item.icon-copy { background-image: url(images/page_white_copy.png); }
.context-menu-item.icon-paste { background-image: url(images/page_white_paste.png); }
.context-menu-item.icon-delete { background-image: url(images/page_white_delete.png); }
.context-menu-item.icon-add { background-image: url(images/page_white_add.png); }
.context-menu-item.icon-quit { background-image: url(images/door.png); }
/* vertically align inside labels */
.context-menu-input > label > * { vertical-align: top; }
/* position checkboxes and radios as icons */
.context-menu-input > label > input[type="checkbox"],
.context-menu-input > label > input[type="radio"] {
margin-left: -17px;
}
.context-menu-input > label > span {
margin-left: 5px;
}
.context-menu-input > label,
.context-menu-input > label > input[type="text"],
.context-menu-input > label > textarea,
.context-menu-input > label > select {
display: block;
width: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
}
.context-menu-input > label > textarea {
height: 100px;
}
.context-menu-item > .context-menu-list {
display: none;
/* re-positioned by js */
right: -5px;
top: 5px;
}
.context-menu-item.hover > .context-menu-list {
display: block;
}
.context-menu-accesskey {
text-decoration: underline;
}

File diff suppressed because it is too large Load Diff

View File

@@ -8,12 +8,13 @@ puts {
<h2>Backup/Restore</h2>
<div id=restore_warning class="hidden warningbox">
<div>
<center>
<b>!!!!!!!!!!!!!! PLEASE NOTE !!!!!!!!!!!!!!
<br><br>
After restoring the scheduled recordings you <b>MUST</b> restart the box using
the link at the top of the screen or via the remote control.
</div>
</div></div>
<div style="clear: both; float: left; width: 40%; border: 1px solid grey;
padding: 1em">

View File

@@ -0,0 +1,78 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require system.class
if {[system model] eq "HDR"} {
require settings.class
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"} {
set smartattribs($name) $t
} else {
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)
set smartmsg ""
if {$smartattribs(SMART_status) ne "PASSED"} {
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))"
}
append smartmsg "\n"
}
}
if {$smartmsg ne ""} {
if {![dict exists $env REQUEST_URI]} { set env(REQUEST_URI) "" }
puts "
<div id=smartwarning class=warningbox><center>
!! WARNING !!
<br><br>
There appear to be some hardware problems with the internal hard disk on
this device.
<br><br>
[string map {"\n" "<br>"} $smartmsg]
"
if {$env(REQUEST_URI) ne "/diag/disk.jim"} {
puts "
<br>
<a href=/diag/disk.jim>Go to disk diagnostics</a>
"
} else {
puts "
<br>
Don't panic; for help, visit
<a target=_blank
href=http://wiki.hummy.tv/wiki/Disk_Problem>
wiki.hummy.tv
</a>
"
}
puts "
</center></div>
"
}
}

View File

@@ -4,7 +4,9 @@ source /mod/webif/lib/setup
require system.class
lassign [system diskspace] size used perc free fperc
set file [format "%02d" [expr {$perc * 25 / 100 + 1}]]
set dsindex $($perc * 25 / 100 + 1)
if {$dsindex > 25} { set dsindex 25 }
set dsfile [format "%02d" $dsindex]
# The HD model only has the USB images which are blue. I prefer the green
# one so use those if available.
@@ -19,7 +21,7 @@ puts "
<span style=\"float: right;
background:url('/images/345_1_27_ST_USB_BG.png')
no-repeat\">
<img src=/images/${prefix}_$file.png>
<img src=/images/${prefix}_$dsfile.png>
</span>
<span style=\"float: right\">

View File

@@ -1,9 +1,13 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require settings.class
require system.class settings.class plugin
proc menuitem {title icon link {width 217} {height 0} {extra ""}} {{num 0}} {
if {$title eq "-reset"} {
set num 0
return
}
incr num
if {$title eq ""} return
if {$num > 4} {
@@ -15,7 +19,8 @@ proc menuitem {title icon link {width 217} {height 0} {extra ""}} {{num 0}} {
<div class=left num=$num>
<center>
<a href=$link>
<img src=$icon ${extra}border=0 width=$width"
<img src=$icon ${extra}border=0 "
if {$width} { puts -nonewline " width=$width" }
if {$height} { puts -nonewline " height=$height" }
puts -nonewline ">
</a>
@@ -29,7 +34,9 @@ proc menuitem {title icon link {width 217} {height 0} {extra ""}} {{num 0}} {
"
}
if {[[settings] epg_style] eq "grid"} {
set settings [settings]
if {[$settings epg_style] eq "grid"} {
set epglink "/cgi-bin/xepg.jim"
} else {
set epglink "/epg.shtml"
@@ -62,3 +69,25 @@ menuitem "Settings" "/images/326_1_00_Menu_Settings.png" \
menuitem "Diagnostics" "/img/diagnostics.png" \
/diag/diag.jim 217 228
eval_plugins menu
if {[$settings nohelplinks] == 0} {
menuitem "-reset" "" ""
puts {</div><div style="clear: both; padding-top: 3em">}
menuitem "hummy.tv<br>Forums" "/img/forum.png" \
"http://hummy.tv/ target=_blank" 0 100 \
"style=\"padding: 1em\""
menuitem "hummy.tv<br>Wiki" "/img/wiki.png" \
"http://wiki.hummy.tv/ target=_blank" 0 100 \
"style=\"padding: 1em\""
menuitem "Things Every<br>Owner Should Know" "/img/started.png" \
"http://hummy.tv/forum/threads/1858/ target=_blank" 0 100 \
"style=\"padding: 1em\""
menuitem "Twitter<br>Feed" "/img/silver-twitter-bird-button.png" \
"http://twitter.com/HummyPkg target=_blank" 0 100 \
"style=\"padding: 1em\""
}

30
var/mongoose/include/notify.jim Executable file
View File

@@ -0,0 +1,30 @@
#!/mod/bin/jimsh
if {[file exists /mod/tmp/notify.log]} {
source /mod/webif/lib/setup
require cat
puts "
<div id=sysnotify class=warningbox><center>
!! WARNING !!
<br><br>
You have pending system notifications:
<br><br>
<pre>
"
cat /mod/tmp/notify.log
puts {
</pre>
<button id=sysnotify_ack>Acknowledge</button>
</center></div>
<script type=text/javascript>
$('#sysnotify_ack').button().on('click', function() {
$('#sysnotify').slideUp('slow');
$.get('/diag/clearlog.jim?file=/mod/tmp/notify.log&unlink=1');
});
</script>
}
}

View File

@@ -1,9 +1,10 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require lock system.class ts.class tdelete pretty_size browse.class safe_delete
require lock system.class ts.class tdelete pretty_size browse.class \
safe_delete settings.class
set debug 0
set loglevel [[settings] autolog]
if {![acquire_lock webif_auto]} {
puts "Cannot acquire exclusive lock, terminating."
@@ -18,8 +19,8 @@ if {[file exists $logfile] && [file size $logfile] > 2097152} {
}
set logfd [open "/mod/tmp/auto.log" "a+"]
proc log {msg {always 0}} {
if {!$::debug && !$always} return
proc log {msg {level 1}} {
if {$level > $::loglevel} return
puts $::logfd "[\
clock format [clock seconds] -format "%d/%m/%Y %H:%M"\
] - $msg"
@@ -41,7 +42,7 @@ proc endclock {size} {
}
set scanstart [clock milliseconds]
log "-------------------------------------------------------" 1
log "-------------------------------------------------------"
# is_listening is relatively expensive so it is checked once globally at
# the start and then if the server is not listening then no decrypt
@@ -51,13 +52,13 @@ log "-------------------------------------------------------" 1
# of the run.
if {[system is_listening 9000]} {
set dlnaok 1
if {$::debug} { log "DLNA Server is running." }
log "DLNA Server is running." 2
} else {
set dlnaok 0
if {$::debug} { log "DLNA Server is NOT running." }
log "DLNA Server is NOT running." 2
}
log "Media scan starting, DLNA server status: $dlnaok" 1
log "Media scan starting, DLNA server status: $dlnaok"
proc dsc {{size 0}} {
set free [system diskfree]
@@ -66,7 +67,7 @@ proc dsc {{size 0}} {
set req $($size * 3 + 1073741824)
if {$free < $req} {
log "Insufficient disk space. Require=$req, Free=$free" 1
log "Insufficient disk space. Require=$req, Free=$free" 0
exit
}
}
@@ -76,11 +77,11 @@ dsc
set tmp "/mod/tmp/webif_auto"
if {![file exists $tmp]} {
if {[catch {file mkdir $tmp} msg]} {
log "Cannot create temporary directory - $tmp ($msg)" 1
log "Cannot create temporary directory - $tmp ($msg)" 0
exit
}
} elseif {![file isdirectory $tmp]} {
log "Cannot create temporary directory - $tmp (file exists)" 1
log "Cannot create temporary directory - $tmp (file exists)" 0
exit
}
@@ -93,14 +94,14 @@ if {[system pkginst undelete]} {
set dustbin ""
}
log "Dustbin: $dustbin"
log "Dustbin: $dustbin" 2
proc dedup {dir} {
log "DEDUP: \[$dir]"
log "DEDUP: \[$dir]" 2
loop i 0 1 {
foreach line [split \
[exec /mod/webif/html/dedup/dedup -yes -auto $dir] "\n"] {
log $line 1
log $line 2
}
}
}
@@ -111,33 +112,41 @@ proc do_expire {ts} {
# Calculate the age of the file in days.
set age $(([clock seconds] - [$ts get start]) / 86400.0)
log " EXPIRE: $file (age = $age)"
log " EXPIRE: $file (age = $age)" 2
if {$age > $ax_days} {
log " EXPIRE: $file ($age > $ax_days)" 1
if {[$ts inuse]} {
log " In use." 1
log " EXPIRE: $file ($age > $ax_days)"
log " In use."
return
}
if {[safe_delete $file]} {
log " Deleted." 1
log " EXPIRE: $file ($age > $ax_days)" 0
log " Deleted." 0
}
}
}
proc do_shrink {ts} {
global tmp dustbin tsgroup
set file [$ts get file]
if {[$ts flag "Shrunk"]} {
log " Already shrunk."
log " $file - already shrunk." 2
return
}
set file [file rootname [$ts get file]]
if {[$ts inuse]} {
log " $file - in use." 2
return
}
if {[catch {
set perc [exec /mod/bin/stripts -aq $file]
} msg]} {
log " Error: $msg" 1
log " Error: $msg" 0
return
}
if {[string match {*%} $perc]} {
@@ -147,28 +156,25 @@ proc do_shrink {ts} {
}
if {$perc == 0} {
log " Already shrunk."
log " $file - already shrunk." 2
$ts set_shrunk
return
}
if {[$ts inuse]} {
log " In use." 1
return
}
set size [$ts size]
dsc $size
startclock
log " SHRINK: $file" 1
log " Estimate $perc% saving." 1
log " Shrinking..." 1
log " SHRINK: $file" 0
log " Estimate $perc% saving." 0
log " Shrinking..." 0
if {[catch {
foreach line [split \
[exec nice -n 19 /mod/bin/stripts -q $file $tmp/shrunk] \
"\n"] {
log $line 1
log $line 0
}
} msg]} {
log "Error during shrink: $msg" 1
log "Error during shrink: $msg" 0
system notify "$file - auto-shrink - error $msg."
return
}
@@ -194,7 +200,7 @@ proc do_shrink {ts} {
}
}
$ts set_shrunk
log "Done... [endclock $size]" 1
log "Done... [endclock $size]" 0
}
proc do_decrypt {ts} {
@@ -205,35 +211,73 @@ proc do_decrypt {ts} {
set bfile [file tail $file]
if {![$ts flag "ODEncrypted"]} {
log " Already decrypted."
log " $file - Already decrypted." 2
return
}
lassign [$ts dlnaloc] url
lassign [$ts dlnaloc "127.0.0.1"] url
if {$url eq ""} {
log " Not yet indexed."
log " $file - Not yet indexed."
return
}
if {![system is_listening 9000]} {
log " DLNA Server not running."
log " $file - DLNA Server not running." 2
set ::dlnaok 0
return
}
if {[$ts inuse]} {
log " In use." 1
log " $file - In use."
return
}
# Check that the file is not already decrypted by analysing it.
set anencd [exec /mod/bin/stripts -qE $rfile]
if {$anencd != "1"} {
log " $file - already decrypted but the HMT flag is wrong." 0
system notify "$file - auto-decrypt - file is already decrypted but the HMT flag is wrong."
return
}
# Perform the decryption by requesting the file from the DLNA server.
set size [$ts size]
dsc $size
set flagfile "$tmp/decrypting.$bfile"
exec /mod/bin/busybox/touch $flagfile
startclock
log " DECRYPT: $rfile" 1
log " DLNA: $url" 1
log " DECRYPT: $rfile" 0
log " DLNA: $url" 0
exec wget -O "$tmp/$bfile" $url
if {[file size $file] != [file size "$tmp/$bfile"]} {
log " File size mismatch." 1
log " $file - File size mismatch." 0
file delete "$tmp/$bfile"
file delete $flagfile
return
}
# Check if the file is in use. It is possible that the file is
# now being played even though it was free when decryption started.
if {[$ts inuse]} {
log " $file - In use."
file delete "$tmp/$bfile"
file delete $flagfile
return
}
# Copy the HMT file over for stripts
set thmt "$tmp/[file rootname $bfile].hmt"
file copy "$rfile.hmt" $thmt
# Check that the file is no longer encrypted by analysing it.
set anencd [exec /mod/bin/stripts -qE "$tmp/[file rootname $bfile]"]
file delete $thmt
if {$anencd != "0"} {
log " $file - File did not decrypt properly." 0
system notify "$file - auto-decrypt failed."
file delete "$tmp/$bfile"
file delete $flagfile
return
}
@@ -244,7 +288,7 @@ proc do_decrypt {ts} {
# Patch the HMT - quickest way to get back to a playable file.
exec /mod/bin/hmt -encrypted "$rfile.hmt"
log " Removing/binning old copy."
log " Removing/binning old copy." 0
# Move the old recording to the bin if undelete is installed.
if {$dustbin ne ""} {
set bin [_del_bindir $file "webif_autodecrypt"]
@@ -263,7 +307,8 @@ proc do_decrypt {ts} {
} else {
tdelete "$rfile.encrypted"
}
log "Done... [endclock $size]" 1
log "Done... [endclock $size]" 0
file delete $flagfile
}
proc do_mpg {ts} {
@@ -277,33 +322,34 @@ proc do_mpg {ts} {
}
if {[$ts flag "ODEncrypted"]} {
log " Not decrypted."
log " $file - Not decrypted." 2
return
}
if {[$ts get definition] eq "HD"} {
# Cannot extract a useful MP3 from a HD recording.
# Cannot extract a useful MPG from a HD recording.
return
}
if {[$ts inuse]} {
log " In use." 1
log " $file - In use."
return
}
dsc [$ts size]
log " MPG: $file" 1
log " Converting..." 1
log " MPG: $file" 0
log " Converting..." 0
if {[catch {
foreach line [split \
[exec nice -n 19 /mod/bin/ffmpeg -y -benchmark -v 0 \
-i $file.ts \
-map 0:0 -map 0:1 \
-vcodec copy -acodec copy $tmp/mpg.mpg] "\n"] {
log $line 1
log $line 0
}
} msg]} {
log "Error during mpg extract: $msg" 1
log "Error during mpg extract: $msg" 0
system notify "$file - auto-mpg - error $msg."
return
}
@@ -311,6 +357,61 @@ proc do_mpg {ts} {
file rename $tmp/mpg.mpg $file.mpg
}
proc do_mp3 {ts} {
global tmp tsgroup
set file [file rootname [$ts get file]]
if {[file exists $file.mp3]} {
# Already done.
return
}
if {[$ts flag "ODEncrypted"]} {
log " $file - Not decrypted." 2
return
}
if {[$ts get definition] eq "HD"} {
# Cannot extract a useful MP3 from a HD recording.
log " $file - High definition." 2
return
}
if {[$ts inuse]} {
log " $file - In use."
return
}
dsc [$ts size]
log " MP3: $file" 0
log " Converting..." 0
if {[catch {
foreach line [split \
[exec nice -n 19 /mod/bin/ffmpeg -y -benchmark -v 0 \
-i $file.ts \
-f mp3 -vn -acodec copy $tmp/mp3.mp3] "\n"] {
log $line 0
}
} msg]} {
log "Error during mp3 extract: $msg" 0
system notify "$file - auto-mp3 - error $msg."
return
}
if {[system pkginst id3v2]} {
log [exec /mod/bin/id3v2 \
--song "[$ts get title]" \
--comment "[$ts get synopsis]" \
--album "[$ts get channel_name]" \
--year "[clock format [$ts get start] -format {%Y}]" \
"$tmp/mp3.mp3"] 0
}
# Move the MP3 into the local directory
file rename $tmp/mp3.mp3 $file.mp3
}
proc entries {dir callback} {
foreach entry [readdir -nocomplain $dir] {
if {![string match {*.ts} $entry} continue
@@ -321,23 +422,28 @@ proc entries {dir callback} {
}
proc shrink {dir} {
log "SHRINK: \[$dir]"
log "SHRINK: \[$dir]" 2
entries $dir do_shrink
}
proc decrypt {dir} {
log "DECRYPT: \[$dir]"
log "DECRYPT: \[$dir]" 2
if {$::dlnaok} { entries $dir do_decrypt }
}
proc mpg {dir} {
log "MPG: \[$dir]"
log "MPG: \[$dir]" 2
entries $dir do_mpg
}
proc mp3 {dir} {
log "MP3: \[$dir]" 2
entries $dir do_mp3
}
proc expire {dir} {
global ax_days
log "EXPIRE: \[$dir]"
log "EXPIRE: \[$dir]" 2
set ax_days [{dir expiry} $dir]
entries $dir do_expire
@@ -348,10 +454,10 @@ proc scan {dir attr {force 0}} {{indent 0}} {
incr indent 2
log "[string repeat " " $indent]\[$dir]"
log "[string repeat " " $indent]\[$dir]" 2
if {$dir eq $dustbin} {
log "Dustbin, skipping."
log "Dustbin, skipping." 2
return
}
@@ -359,18 +465,18 @@ proc scan {dir attr {force 0}} {{indent 0}} {
# Special folder
file stat "$dir/" st
if {$st(dev) != $::rootdev} {
log "Special folder on different device, skipping."
log "Special folder on different device, skipping." 2
return
}
if {$force} {
set force 0
log "Special folder, overriding recursion."
log "Special folder, overriding recursion." 2
}
}
# Recursion
if {!$force && [file exists "$dir/.auto${attr}r"]} {
log "[string repeat " " $indent] (R)"
log "[string repeat " " $indent] (R)" 2
set force 1
}
@@ -390,20 +496,20 @@ proc scan {dir attr {force 0}} {{indent 0}} {
set root [system mediaroot]
file stat "$root/" rootstat
set rootdev $rootstat(dev)
#log "Root device: $rootdev" 1
log "Root device: $rootdev" 2
if {[llength $argv] > 0} {
set debug 1
set loglevel 2
foreach arg $argv { scan $root $arg }
} else {
foreach arg {dedup decrypt shrink mpg expire} {
foreach arg {dedup decrypt shrink mpg mp3 expire} {
set st [clock milliseconds]
scan $root $arg
log "$arg scan completed in [elapsed $st] seconds." 1
log "$arg scan completed in [elapsed $st] seconds."
}
}
release_lock webif_auto
log "Media scan completed in [elapsed $scanstart] seconds." 1
log "Media scan completed in [elapsed $scanstart] seconds."

47
var/mongoose/lib/bin/diskattrs Executable file
View File

@@ -0,0 +1,47 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require system.class settings.class
if {[system model] eq "HD"} exit
set disk [system disk]
set settings [settings]
# Extract overall SMART status.
set smart ""
set line ""
# smartctl uses non-zero exit status to indicate health hence catch.
catch { set line [exec /mod/bin/smartctl -H $disk | sed -n 5p] } msg
if {$msg ne "" && $line eq ""} { set line $msg }
if {$line ne ""} {
set smart [string range [lindex [split $line :] 1] 1 end]
$settings _tval_setting "SMART_status" $smart
}
foreach line [split [exec /mod/bin/smartctl -A -f brief $disk] "\n"] {
regsub -all -- {[[:space:]]+} $line " " line
regsub -all -- {^[[:space:]]+} $line "" line
lassign [split $line] id name flags val worst thresh when rval
if {![string is integer $id]} continue
set attrs($id) $rval
}
#puts "Attrs: ($attrs)"
puts "SMART: ($smart)"
foreach a {
{5 "realloc"}
{10 "spinretry"}
{197 "pending"}
{198 "offline"}
} {
lassign $a id attr
if {![dict exists $attrs $id]} continue
puts "$attr: $attrs($id)"
$settings _nval_setting "SMART_$attr" $attrs($id)
if {$attrs($id) < [$settings _nval_setting "SMART_ack_$attr"]} {
$settings _nval_setting "SMART_ack_$attr" $attrs($id)
}
}

View File

@@ -0,0 +1,59 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require system.class ts.class
proc do_shrink {ts} {
if {[$ts flag "Shrunk"]} { return }
set file [file rootname [$ts get file]]
if {[$ts inuse]} { return }
if {[catch {
set perc [exec /mod/bin/stripts -aq $file]
} msg]} {
return
}
if {[string match {*%} $perc]} {
set perc [string range $perc 0 end-1]
} else {
set perc 0
}
if {$perc == 0} {
puts " Flagging $file as shrunk..."
$ts set_shrunk
}
}
proc entries {dir callback} {
foreach entry [readdir -nocomplain $dir] {
if {![string match {*.ts} $entry} continue
if {[catch {set ts [ts fetch "$dir/$entry"]}]} continue
if {$ts == 0} continue
$callback $ts
}
}
proc scan {dir} {
puts "Scanning $dir..."
file stat "$dir/" st
if {$st(dev) != $::rootdev} { return }
entries $dir do_shrink
foreach entry [readdir -nocomplain $dir] {
if {[file isdirectory "$dir/$entry"]} {
scan "$dir/$entry"
}
}
}
set root [system mediaroot]
file stat "$root/" rootstat
set rootdev $rootstat(dev)
scan $root

BIN
var/mongoose/lib/bmpheader Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 B

View File

@@ -83,6 +83,13 @@ proc {dir iconset} {dir} {
lappend attrs "autompg=1"
}
set automp3 0
if {[file exists "$dir/.automp3"]} {
set automp3 1
lappend icons [_addicon "/img/mp3.png" "Auto-Audio Extract"]
lappend attrs "automp3=1"
}
set autoexpire 0
if {[file exists "$dir/.autoexpire"]} {
set days [{dir expiry} $dir]

View File

@@ -2,7 +2,7 @@
if {![exists -proc cat]} {
proc cat {file} {
if {[catch {set fp [open $file r}]} { return }
puts [read $fp]
puts -nonewline [read $fp]
close $fp
}
}

View File

@@ -5,7 +5,6 @@ if {![exists -proc sqlite3.open]} { package require sqlite3 }
require settings.class progressbar rsv.class mwildcard
set ::epgpath /mnt/hd1/dvbepg/epg.dat
set ::epgdbpath /mnt/hd1/epg.db
set ::hdepgpath /media/drive1/epgsavedata
@@ -22,8 +21,6 @@ if {[file exists $::epgdbpath]} {
set ::qepg 1
}
set ::rsvlookup [rsv lookuptab]
# * service_id, event_id, start, duration, encrypted, name, text
# * warning, content code, content type,
# * event CRID, series CRID, rec CRID
@@ -48,7 +45,7 @@ class epg {
channel_crid ""
channel_hsvc 0
sched_type 0
sched_type -1
rsv 0
}
@@ -175,13 +172,45 @@ epg method get_rsv {} {
}
epg method process_sched {} {
$self scheduled
}
set rsvlookup ""
epg method scheduled {} {
global rsvlookup
if {$sched_type >= 0} { return $sched_type }
set sched_type 0
if {$event_crid ne "" && "$channel_hsvc$event_crid" in $::rsvlookup} {
set sched_type 1
} elseif {$series_crid ne "" &&
"$channel_hsvc$series_crid" in $::rsvlookup} {
set sched_type 2
if {$rsvlookup eq ""} {
set rsvlookup [rsv lookuptab]
#puts $rsvlookup
}
set p 0
foreach key [list \
"$service_id:$event_id" \
[string tolower "$service_id:$channel_crid$series_crid"] \
[string tolower "$service_id:$channel_crid$event_crid"] \
] {
#puts "Check key ($key)"
if {[dict exists $rsvlookup $key]} {
set p $rsvlookup($key)
#puts "FOUND ($p)"
break
}
}
switch $p {
S { set sched_type 2 }
E { set sched_type 1 }
default { set sched_type 0 }
}
#puts "SCHED_TYPE: ($sched_type)"
return $sched_type
}
epg method icon_set {{height 0}} {

View File

@@ -1,21 +0,0 @@
proc {file copy} {{force {}} source target} {
try {
if {$force ni {{} -force}} {
error "bad option \"$force\": should be -force"
}
if {![file exists $source]} {
error "source file does not exist."
}
if {$force eq "" && [file exists $target]} {
error "error copying \"$source\" to \"$target\": file already exists"
}
exec /mod/bin/busybox/cp $source $target
} on error {msg opts} {
incr opts(-level)
return {*}$opts $msg
}
}

49
var/mongoose/lib/fileops Normal file
View File

@@ -0,0 +1,49 @@
proc {file copy} {{force {}} source target} {
try {
if {$force ni {{} -force}} {
error "bad option \"$force\": should be -force"
}
if {![file exists $source]} {
error "source file does not exist."
}
if {$force eq "" && [file exists $target]} {
error "error copying \"$source\" to \"$target\": file already exists"
}
exec /mod/bin/busybox/cp $source $target
} on error {msg opts} {
incr opts(-level)
return {*}$opts $msg
}
}
proc {file rename} {{force {}} source target} {
try {
if {$force ni {{} -force}} {
error "bad option \"$force\": should be -force"
}
if {![file exists $source]} {
error "source file does not exist."
}
if {$force eq "" && [file exists $target]} {
error "error copying \"$source\" to \"$target\": file already exists"
}
exec /mod/bin/busybox/mv $source $target
} on error {msg opts} {
incr opts(-level)
return {*}$opts $msg
}
}
local proc file {cmd args} {
switch $cmd {
"rename" { tailcall {file rename} {*}$args }
"copy" { tailcall {file copy} {*}$args }
default { tailcall upcall file $cmd {*}$args }
}
}

View File

@@ -1,21 +0,0 @@
proc {file rename} {{force {}} source target} {
try {
if {$force ni {{} -force}} {
error "bad option \"$force\": should be -force"
}
if {![file exists $source]} {
error "source file does not exist."
}
if {$force eq "" && [file exists $target]} {
error "error copying \"$source\" to \"$target\": file already exists"
}
exec /mod/bin/busybox/mv $source $target
} on error {msg opts} {
incr opts(-level)
return {*}$opts $msg
}
}

View File

@@ -318,6 +318,40 @@ proc {rsv list} {{table tbl_reservation} {extra ""}} {
}
proc {rsv lookuptab} {} {
set records {}
foreach tab {tbl_reservation pending} {
set res [$::rsvdb query "
select usSvcId, usevtid, ucCRIDType, szCRID,
ucRecKind
from $tab left join channel.TBL_SVC
on $tab.hSvc = channel.TBL_SVC.hSvc
where ersvtype <= 3
"]
foreach rec $res {
if {$rec(ucRecKind) == 4} {
set p "S"
} else {
set p "E"
}
set records("$rec(usSvcId):$rec(usevtid)") $p
if {$rec(szCRID) eq ""} continue
if {$rec(ucCRIDType) == 49} {
set p "E"
} elseif {$rec(ucCRIDType) == 50} {
set p "S"
} else {
continue
}
set records([\
string tolower "$rec(usSvcId):$rec(szCRID)"]) $p
}
}
return $records
}
proc {rsv xlookuptab} {} {
set records {}
foreach tab {tbl_reservation pending} {
set res [$::rsvdb query "

View File

@@ -24,8 +24,10 @@ class settings {
pkgdev 0
notoolbar 0
nomobile 0
nohelplinks 0
xepghours 4
genrededup 0
autolog 0
}
settings method hostname {{name ""}} {
@@ -100,6 +102,29 @@ settings method _nval_setting {name {val -1}} {
}
}
settings method _tval_setting {name {val -1}} {
global settingsdb
if {$val == -1} {
# Get
set res [$settingsdb query "
select tval from settings
where name = '$name'
"]
if {$res ne ""} {
return [lindex [lindex $res end] end]
}
return 0
} else {
# Set
$settingsdb query "
replace into settings(name,tval)
values('$name', '%s')
" $val
return 0
}
}
settings method channel_group {{group -1}} {
return [$self _nval_setting channel_group $group]
}
@@ -136,10 +161,18 @@ settings method nomobile {{val -1}} {
return [$self _nval_setting nomobile $val]
}
settings method nohelplinks {{val -1}} {
return [$self _nval_setting nohelplinks $val]
}
settings method sortorder {{val -1}} {
return [$self _nval_setting sortorder $val]
}
settings method autolog {{level -1}} {
return [$self _nval_setting autolog $level]
}
settings method channel_groups {} {
set ret ""
set db [sqlite3.open /var/lib/humaxtv/setup.db]
@@ -232,3 +265,14 @@ settings method delacluser {user} {
return $msg
}
settings method smartdata {} {
global settingsdb
set res [$settingsdb query "
select name, nval, tval from settings
where name like 'SMART_%%'
"]
return $res
}

View File

@@ -17,9 +17,9 @@ if {![exists -proc require]} {
puts -nonewline "Pragma: no-cache\r\n"
puts -nonewline "Cache-Control: no-cache\r\n"
} else {
puts "Content-Type: $type; charset=\"UTF-8\"\r\n"
puts -nonewline "Content-Type: $type; charset=\"UTF-8\"\r\n"
}
puts -nonewline $extra
if {$extra ne ""} { puts -nonewline "$extra" }
puts -nonewline "\r\n"
set done 1
}
@@ -41,13 +41,6 @@ if {![exists -proc require]} {
uplevel source /mod/webif/html/m/lib/footer.jim
}
# Replace the built-in jim {file copy} command with one that is
# largefile safe.
require filecopy
# and {file rename} with one that supports cross-filesystem moves.
require filerename
require fileops
}

View File

@@ -82,8 +82,7 @@ proc {system pkginst} {pkg} {{cache {}} {ncache {}}} {
} else break
}
if {$status eq "unknown"} {
puts "Could not get opkg lock after 5 seconds."
exit
error "Could not get opkg lock after 5 seconds."
}
if {$status ne ""} {
@@ -140,6 +139,10 @@ proc {system diskspace} {} {
return [list $size $used $perc $free $fperc $dev]
}
proc {system disk} {} {
return [string range [lindex [system diskspace] 5] 0 end-1]
}
proc {system diskfree} {} {
switch [system model] {
HDR { set part /mnt/hd2 }
@@ -245,3 +248,11 @@ proc {system is_listening} {mport} {
return [llength [system listening $mport]]
}
proc {system notify} {msg} {
set logfd [open "/mod/tmp/notify.log" "a+"]
puts $logfd "[\
clock format [clock seconds] -format "%d/%m/%Y %H:%M"\
] - $msg"
$logfd close
}

View File

@@ -235,6 +235,53 @@ ts method dlnaloc {{urlbase 0}} {
if {$url ne "" } { return [list $url $mime] } else { return {} }
}
ts method cleanbmp {} {
set bfile [file rootname $file]
foreach f [glob -nocomplain "${bfile}*.bmp"] {
file delete $f
}
}
ts method mkbmps {{offset 0}} {
set bfile [file rootname $file]
if {[catch {
exec /mod/bin/ffmpeg -loglevel fatal -ss $offset -i $file \
-vf fps=fps=2 -frames 5 \
-pix_fmt argb -vf vflip -s 140x78 "${bfile}%d.bmp"
} msg]} {
puts "ERROR: $msg"
return 0
}
return 1
}
ts method mkbmp {{offset 0} {ext ""}} {
set bfile [file rootname $file]
if {[catch {
exec /mod/bin/ffmpeg -loglevel fatal -ss $offset -i $file \
-frames 1 -pix_fmt argb -vf vflip -s 140x78 "$bfile$ext.bmp"
} msg]} {
puts "ERROR: $msg"
return 0
}
return 1
}
ts method mkthm {{offset 0}} {
if {![$self mkbmp $offset]} { return 0 }
set bfile [file rootname $file]
if {[catch {
exec /bin/dd if=$bfile.bmp of=$bfile.thm~ bs=54 skip=1
} msg]} {
puts "ERROR: $msg"
return 0
}
exec /bin/echo -n " " >> $bfile.thm~
file rename -force $bfile.thm~ $bfile.thm
tdelete $bfile.bmp
return 1
}
proc {ts renamegroup} {from to} {
global tsgroup