show new folders

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@211 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2011-06-29 23:53:16 +00:00
parent 43db44d742
commit 4e42dcf655
5 changed files with 58 additions and 27 deletions

View File

@ -17,10 +17,11 @@ cgi_input
#set _cgi(dir) "/media/My Video/Chuggington" #set _cgi(dir) "/media/My Video/Chuggington"
proc directory {file bfile} { proc directory {file bfile} {
regsub -all " +" $bfile "" tbfile
puts "<div class=va>" puts "<div class=va>"
puts "<a href=$::env(REQUEST_URI)?dir=[cgi_quote_url $file]>" puts "<a href=$::env(REQUEST_URI)?dir=[cgi_quote_url $file]>"
puts "<img border=0 class=va src=/images/711_1_09_Media_Folder.png>" puts "<img border=0 class=va id=\"img$tbfile\"
regsub -all " +" $bfile "" tbfile src=/images/711_1_09_Media_Folder.png>"
puts "$bfile</a><span class=filesize id=\"$tbfile\"> puts "$bfile</a><span class=filesize id=\"$tbfile\">
</span></div>" </span></div>"
} }

View File

@ -35,6 +35,21 @@ function folder_size_callback(data, status, xhr)
$.each(data, insert_folder_size); $.each(data, insert_folder_size);
} }
function set_folder_new(folder, cnt)
{
folder = folder.replace(/ /g, '');
folder = folder.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1');
console.log("Folder: (%s) = (%s)", folder, cnt);
$('#img' + folder).attr('src', '/images/711_1_09_Media_Folder_C.png');
}
function new_folder_callback(data, status, xhr)
{
//console.log("Status: %s", status);
//console.dir(data);
$.each(data, set_folder_new);
}
function delete_callback(file, type, id) function delete_callback(file, type, id)
{ {
var el = 'div.bf#' + id; var el = 'div.bf#' + id;
@ -218,5 +233,9 @@ var menuclick = function(action, el, pos)
// Load folder sizes // Load folder sizes
$.getJSON('/cgi-bin/browse/sizes.jim?dir=' + encodeURIComponent(dir), $.getJSON('/cgi-bin/browse/sizes.jim?dir=' + encodeURIComponent(dir),
folder_size_callback); folder_size_callback);
// Flag folders with unwatched items
$.getJSON('/cgi-bin/browse/newdir.jim?dir=' + encodeURIComponent(dir),
new_folder_callback);
}); });

View File

@ -1,25 +0,0 @@
#!/mod/bin/jimsh
package require cgi
puts "Content-Type: application/json"
puts ""
cgi_input
#cgi_dump
set _cgi(dir) "/media/My Video"
set dir [dict get $_cgi dir]
# Strip double slashes
regsub -all -- {\/+} "$dir/*" "/" dir
puts "{"
foreach subdir [glob -nocomplain "$dir"] {
set new 0
foreach hmt [glob -nocomplain "$subdir/*.hmt"] {
puts "HMT: $hmt"
}
}
puts "}"

View File

@ -0,0 +1,34 @@
#!/mod/bin/jimsh
package require cgi
package require pack
puts "Content-Type: application/json"
puts ""
cgi_input
#cgi_dump
#set _cgi(dir) "/media/My Video"
set root [dict get $_cgi dir]
# Strip double slashes
regsub -all -- {\/+} "$root/*" "/" root
puts "{"
foreach dir [glob -nocomplain "$root"] {
if {[file exists "$dir/.series"]} {
set fd [open "$dir/.series"]
set bytes [read $fd 8]
set recs [unpack $bytes -uintle 0 32]
set plays [unpack $bytes -uintle 32 32]
set diff $($recs - $plays)
if {$diff != 0} {
set node [lindex [split $dir /] end]
puts "\"$node\": $diff,"
}
}
}
puts "\"dummy\" : 0"
puts "}"

View File

@ -79,6 +79,8 @@ if {[llength $res] > 0} {
puts "<tr><td>Keyword Searches</td>" puts "<tr><td>Keyword Searches</td>"
foreach keyword $res { foreach keyword $res {
set kw [string range [lindex $keyword 1] 1 end] set kw [string range [lindex $keyword 1] 1 end]
# Attempt to clean the keyword string.
regsub -all {[\000-\037]} $kw "" kw
puts "<td><a href=/cgi-bin/epg_search.jim?term=[cgi_quote_url $kw]>$kw puts "<td><a href=/cgi-bin/epg_search.jim?term=[cgi_quote_url $kw]>$kw
</a></td>" </a></td>"
} }