From 39d7dab2a9786775cccf9cd313e29e183e64f70a Mon Sep 17 00:00:00 2001 From: hummypkg Date: Sun, 17 Feb 2013 22:58:37 +0000 Subject: [PATCH] genre dedup git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1408 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 2 +- var/mongoose/cgi-bin/epg/search.jim | 11 ++++++++++- var/mongoose/cgi-bin/settings.jim | 23 +++++++++++++++++++++++ var/mongoose/cgi-bin/settings.js | 19 +++++++++++++++++++ var/mongoose/lib/settings.class | 5 +++++ 5 files changed, 58 insertions(+), 2 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index 18f03c16..cd57b116 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -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) diff --git a/var/mongoose/cgi-bin/epg/search.jim b/var/mongoose/cgi-bin/epg/search.jim index 1555c9bd..d0d5155a 100755 --- a/var/mongoose/cgi-bin/epg/search.jim +++ b/var/mongoose/cgi-bin/epg/search.jim @@ -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 } diff --git a/var/mongoose/cgi-bin/settings.jim b/var/mongoose/cgi-bin/settings.jim index f10158fe..fc9d5559 100755 --- a/var/mongoose/cgi-bin/settings.jim +++ b/var/mongoose/cgi-bin/settings.jim @@ -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 "> " +puts " + +

+
+ + EPG Settings + + +" + puts " @@ -256,6 +268,17 @@ puts " " +puts -nonewline " + + + + +" + puts "
De-duplicate genre search results? +
+
diff --git a/var/mongoose/cgi-bin/settings.js b/var/mongoose/cgi-bin/settings.js index 842ab4ee..933121d7 100644 --- a/var/mongoose/cgi-bin/settings.js +++ b/var/mongoose/cgi-bin/settings.js @@ -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'); + }); + }); }); diff --git a/var/mongoose/lib/settings.class b/var/mongoose/lib/settings.class index 2ef80ff0..a729e5a9 100644 --- a/var/mongoose/lib/settings.class +++ b/var/mongoose/lib/settings.class @@ -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] }