genre dedup

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1408 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2013-02-17 22:58:37 +00:00
parent 8ec75e783d
commit 39d7dab2a9
5 changed files with 58 additions and 2 deletions

View File

@ -1,7 +1,7 @@
Package: webif
Priority: optional
Section: web
Version: 0.12.0-2
Version: 0.12.0-3
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.12),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)

View File

@ -2,7 +2,7 @@
package require cgi
source /mod/webif/lib/setup
require epg.class spinner.class altrow
require epg.class spinner.class altrow settings.class
header
@ -41,8 +41,10 @@ require epg_popup
set cmd "search"
if {$searchfull} { set cmd "searchall" }
set dedup 0
if {$ct > 0 } {
set records [epg fetch dump -type $ct]
if {[[settings] genrededup]} { set dedup 1 }
} elseif {$crid ne ""} {
set records [epg fetch dump -crid $crid]
} elseif {$scrid ne ""} {
@ -78,8 +80,15 @@ proc rsort {v1 v2} {
return -1
}
set seen {}
set i 0
foreach record [lsort -command rsort $records] {
if {$dedup} {
set ename [$record get name]
if {$ename in $seen} continue
lappend seen $ename
}
if {$favlist != "" && [$record get service_id] ni $favlist} {
continue
}

View File

@ -39,6 +39,7 @@ set notoolbar [$settings notoolbar]
set nomobile [$settings nomobile]
set xepghours [$settings xepghours]
if {$xepghours == 0} { set xepghours 4 }
set genrededup [$settings genrededup]
# Handle updates
@ -78,6 +79,7 @@ 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 genrededup $genrededup "Genre search dedup"
set acluser [cgi_get acluser "-"]
set aclpass [cgi_get aclpass "-"]
@ -175,6 +177,16 @@ puts ">
</tr>
"
puts "
</table></fieldset>
<br><br>
<fieldset style=\"display: inline\">
<legend>
EPG Settings
</legend>
<table>
"
puts "
<tr>
<form class=auto id=epg_style method=get action=$env(REQUEST_URI)>
@ -256,6 +268,17 @@ 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>
"
puts "
</table>
</fieldset>

View File

@ -137,5 +137,24 @@ $(document).ready(function () {
.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')
.css('font-style', 'italic')
.delay(2000).fadeOut('slow');
});
});
});

View File

@ -25,6 +25,7 @@ class settings {
notoolbar 0
nomobile 0
xepghours 4
genrededup 0
}
settings method hostname {{name ""}} {
@ -127,6 +128,10 @@ settings method notoolbar {{val -1}} {
return [$self _nval_setting notoolbar $val]
}
settings method genrededup {{val -1}} {
return [$self _nval_setting genrededup $val]
}
settings method nomobile {{val -1}} {
return [$self _nval_setting nomobile $val]
}