[PATCH 1/2] Web PVR: Allow Search = .* with additional advanced search criteria

dinkypumpkin dinkypumpkin at gmail.com
Wed Feb 15 09:47:04 EST 2012


Allow user to enter Search = .* as long as additional advanced search
criteria are used (e.g., search by category).  Search = .* is not allowed
with Programme Version = default.
---
 get_iplayer.cgi |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/get_iplayer.cgi b/get_iplayer.cgi
index 56455f0..adc7db8 100755
--- a/get_iplayer.cgi
+++ b/get_iplayer.cgi
@@ -3094,11 +3094,22 @@ sub search_progs {
 		},
 		'Play Remote'
 	);
+	# check for an non-whitespace advanced search entries
+	# excluding Programme Version and Search Future Schedule
+	my $num_adv_srch = grep /\S/, (
+		$opt->{EXCLUDE}->{current},
+		$opt->{EXCLUDECATEGORY}->{current},
+		$opt->{CATEGORY}->{current},
+		$opt->{CHANNEL}->{current},
+		$opt->{EXCLUDECHANNEL}->{current},
+		$opt->{SINCE}->{current},
+		$opt->{BEFORE}->{current}
+	);
 	$action_button{'Add Search to PVR'} = a(
 		{
 			-class => 'action'.$add_search_class_suffix,
 			-title => 'Create a persistent PVR search using the current search terms (i.e. all below programmes)',
-			-onClick => "if ('$opt->{SEARCH}->{current}' == '.*') { alert('Search = .* will download all available programmes.  Please enter a more specific search term.'); return false; } if ('$opt->{SEARCH}->{current}' == '') { alert('Please enter a search term.'); return false; } if ( $matchcount > 30 ) { alert('Please limit your search to result in no more than 30 current programmes'); return false; }  BackupFormVars(form); form.NEXTPAGE.value='pvr_add'; form.submit(); RestoreFormVars(form);",
+			-onClick => "var version = '$opt->{VERSIONLIST}->{current}'; if ('$opt->{SEARCH}->{current}' == '.*' && $num_adv_srch == 0 && version.toLowerCase().indexOf('default') != -1) { alert('Search = .* will download all available programmes.  Please enter a more specific search term or additional advanced search criteria (excluding $opt->{FUTURE}->{title}).'); return false; } if ('$opt->{SEARCH}->{current}' == '' ) { alert('Please enter a search term. Use Search = .* to record all programmes matching advanced search criteria.'); return false; } if ( $matchcount > 30 ) { alert('Please limit your search to result in no more than 30 current programmes'); return false; }  BackupFormVars(form); form.NEXTPAGE.value='pvr_add'; form.submit(); RestoreFormVars(form);",
 		},
 		'Add Search to PVR'
 	);
-- 
1.7.5.4




More information about the get_iplayer mailing list