[PATCH] Ensure that loop always receives an array even if only one series

Mike Crowe mac at mcrowe.com
Tue Mar 13 12:30:44 EDT 2012


Similar to fee90b0f902a75d87022f91ef7978b17cfa00625, this fixes a
runtime error on pid b01d8jmz:

INFO: Brand pid detected
INFO:  Brand: 'Dirk Gently' (b01d8jmz)
Not an ARRAY reference at ./get_iplayer line 5622.

Signed-off-by: Mike Crowe <mac at mcrowe.com>
---
 get_iplayer |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/get_iplayer b/get_iplayer
index 089ea9c..6bcf18c 100755
--- a/get_iplayer
+++ b/get_iplayer
@@ -5619,7 +5619,7 @@ sub parse_rdf_brand {
 	my @pids = ();
 	my $bpid = extract_pid( $uri );
 	main::logger "INFO:  Brand: '".$rdf->{'po:Brand'}->{'dc:title'}."' ($bpid)\n";
-	for my $series_element ( @{ $rdf->{'po:Brand'}->{'po:series'} } ) {
+	for my $series_element ( ensure_array($rdf->{'po:Brand'}->{'po:series'}) ) {
 		main::logger "INFO: With Series pid '".$series_element->{'rdf:resource'}."'\n" if $opt->{debug};
 		push @pids, parse_rdf_series( $ua, $series_element->{'rdf:resource'} );
 	}
-- 
1.7.2.5




More information about the get_iplayer mailing list