| 1 | package Yahoo::Music::Ratings; | ||||||||||||||||||||||
| 2 | |||||||||||||||||||||||
| 3 | 1 | ▶ | use LWP::UserAgent; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 4 | 1 | ▶ | use XML::Simple; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 7 | |||||||||||||||||||||||
| 8 | 1 | our $VERSION = '2.00'; | |||||||||||||||||||||
| 9 | |||||||||||||||||||||||
| 10 | |||||||||||||||||||||||
| 11 | # Preloaded methods go here. | ||||||||||||||||||||||
| 12 | |||||||||||||||||||||||
| 13 | 1 | ▶ | sub new { | ||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||
| 14 | 1 | my $class = shift; | |||||||||||||||||||||
| 15 | 1 | my $this = bless {}, $class; | |||||||||||||||||||||
| 16 | |||||||||||||||||||||||
| 17 | # Set sessions options | ||||||||||||||||||||||
| 18 | 1 | $this->{options} = shift; | |||||||||||||||||||||
| 19 | |||||||||||||||||||||||
| 20 | print '-' x 80, | ||||||||||||||||||||||
| 21 | "\nYahoo::Music::Ratings Progress Output Enabled\n", | ||||||||||||||||||||||
| 22 | '-' x 80, | ||||||||||||||||||||||
| 23 | 1 | ▶ | "\n" if $this->{options}->{progress}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 24 | |||||||||||||||||||||||
| 25 | 1 | return $this; | |||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||
| 27 | |||||||||||||||||||||||
| 28 | 0 | ▶ | sub findMemberId { | ||||||||||||||||||||
|
Subroutine
findMemberId: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||
| 29 | 0 | my $this = shift; | |||||||||||||||||||||
| 30 | |||||||||||||||||||||||
| 31 | 0 | ▶ | unless ( $this->{memberid} ){ | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 32 | 0 | my $ua = LWP::UserAgent->new; | |||||||||||||||||||||
| 33 | 0 | $ua->timeout(10); | |||||||||||||||||||||
| 34 | 0 | $ua->env_proxy; | |||||||||||||||||||||
| 35 | |||||||||||||||||||||||
| 36 | 0 | $ua->max_redirect(0); | |||||||||||||||||||||
| 37 | |||||||||||||||||||||||
| 38 | 0 | my $url = 'http://music.yahoo.com/launchcast/membersearch.asp?memberName='.$this->{options}->{memberName}; | |||||||||||||||||||||
| 39 | 0 | ▶ | print "Fetching web page\n" if $this->{options}->{progress}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 40 | 0 | my $response = $ua->get( $url ); | |||||||||||||||||||||
| 41 | |||||||||||||||||||||||
| 42 | 0 | ▶ | if ($response->is_success) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 43 | #print $response->status_line; | ||||||||||||||||||||||
| 44 | 0 | $this->{errorMessage} = "\nLooks like either Yahoo is down, the membername provided is down or they've changed their site which means this module no longer works. Sorry :("; | |||||||||||||||||||||
| 45 | 0 | ▶ | print "$this->{errorMessage}\n" if $this->{options}->{progress}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 46 | 0 | return( 0 ); | |||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||
| 48 | else { | ||||||||||||||||||||||
| 49 | 0 | ($this->{memberid}) = $response->header('Location') =~ m/station\.asp\?u=(\d+)/g; | |||||||||||||||||||||
| 50 | 0 | ▶ | print "Found $this->{options}->{memberName}'s memberId: $this->{memberid}\n" if $this->{options}->{progress}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 51 | 0 | return( $this->{memberid} ); | |||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||
| 55 | |||||||||||||||||||||||
| 56 | # Backward Compatibility with version 1.00 | ||||||||||||||||||||||
| 57 | 0 | ▶ | sub getRatings { | ||||||||||||||||||||
|
Subroutine
getRatings: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||
| 58 | 0 | my $this = shift; | |||||||||||||||||||||
| 59 | 0 | return $this->getSongs(); | |||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||
| 61 | |||||||||||||||||||||||
| 62 | # Display a list of Song Rankings | ||||||||||||||||||||||
| 63 | 0 | ▶ | sub getSongs { | ||||||||||||||||||||
|
Subroutine
getSongs: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||
| 64 | 0 | my $this = shift; | |||||||||||||||||||||
| 65 | |||||||||||||||||||||||
| 66 | # Check if we have a member id, if not, return 0 | ||||||||||||||||||||||
| 67 | 0 | ▶ | return 0 unless $this->_checkIfMemberId() ; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 68 | |||||||||||||||||||||||
| 69 | # Reset the data hash as to not colide with old data | ||||||||||||||||||||||
| 70 | 0 | undef($this->{data}); | |||||||||||||||||||||
| 71 | |||||||||||||||||||||||
| 72 | 0 | ▶ | print "Loading Ratings Pages\n" if $this->{options}->{progress}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 73 | 0 | ▶ | if ( $this->_parseRatings( 0, 1 ) ){ | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 74 | 0 | ▶ | for(my $i=1; $i < $this->{totalPages}; $i++){ | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 75 | 0 | $this->_parseRatings( $i, 1 ); | |||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||
| 77 | |||||||||||||||||||||||
| 78 | 0 | return( $this->{data} ); | |||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||
| 80 | else { | ||||||||||||||||||||||
| 81 | 0 | return( 0 ); | |||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||
| 83 | |||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||
| 85 | |||||||||||||||||||||||
| 86 | # Display a list of Album Rankings | ||||||||||||||||||||||
| 87 | 0 | ▶ | sub getAlbums { | ||||||||||||||||||||
|
Subroutine
getAlbums: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||
| 88 | 0 | my $this = shift; | |||||||||||||||||||||
| 89 | |||||||||||||||||||||||
| 90 | # Check if we have a member id, if not, return 0 | ||||||||||||||||||||||
| 91 | 0 | ▶ | return 0 unless $this->_checkIfMemberId() ; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 92 | |||||||||||||||||||||||
| 93 | # Reset the data hash as to not colide with old data | ||||||||||||||||||||||
| 94 | 0 | undef($this->{data}); | |||||||||||||||||||||
| 95 | |||||||||||||||||||||||
| 96 | 0 | ▶ | print "Loading Ratings Pages\n" if $this->{options}->{progress}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 97 | 0 | ▶ | if ( $this->_parseRatings( 0, 2 ) ){ | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 98 | 0 | ▶ | for(my $i=1; $i < $this->{totalPages}; $i++){ | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 99 | 0 | $this->_parseRatings( $i, 2 ); | |||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||
| 101 | |||||||||||||||||||||||
| 102 | 0 | return( $this->{data} ); | |||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||
| 104 | else { | ||||||||||||||||||||||
| 105 | 0 | return( 0 ); | |||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||
| 107 | |||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||
| 109 | |||||||||||||||||||||||
| 110 | # Display a list of Artist Rankings | ||||||||||||||||||||||
| 111 | 0 | ▶ | sub getArtists { | ||||||||||||||||||||
|
Subroutine
getArtists: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||
| 112 | 0 | my $this = shift; | |||||||||||||||||||||
| 113 | |||||||||||||||||||||||
| 114 | # Check if we have a member id, if not, return 0 | ||||||||||||||||||||||
| 115 | 0 | ▶ | return 0 unless $this->_checkIfMemberId() ; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 116 | |||||||||||||||||||||||
| 117 | # Reset the data hash as to not colide with old data | ||||||||||||||||||||||
| 118 | 0 | undef($this->{data}); | |||||||||||||||||||||
| 119 | |||||||||||||||||||||||
| 120 | 0 | ▶ | print "Loading Ratings Pages\n" if $this->{options}->{progress}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 121 | 0 | ▶ | if ( $this->_parseRatings( 0, 3 ) ){ | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 122 | 0 | ▶ | for(my $i=1; $i < $this->{totalPages}; $i++){ | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 123 | 0 | $this->_parseRatings( $i, 3 ); | |||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||
| 125 | |||||||||||||||||||||||
| 126 | 0 | return( $this->{data} ); | |||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||
| 128 | else { | ||||||||||||||||||||||
| 129 | 0 | return( 0 ); | |||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||
| 131 | |||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||
| 133 | |||||||||||||||||||||||
| 134 | # Display a list of Song Rankings | ||||||||||||||||||||||
| 135 | 0 | ▶ | sub getGenres { | ||||||||||||||||||||
|
Subroutine
getGenres: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||
| 136 | 0 | my $this = shift; | |||||||||||||||||||||
| 137 | |||||||||||||||||||||||
| 138 | # Check if we have a member id, if not, return 0 | ||||||||||||||||||||||
| 139 | 0 | ▶ | return 0 unless $this->_checkIfMemberId() ; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 140 | |||||||||||||||||||||||
| 141 | 0 | $this->{errorMessage} = "Genre Listing Is not Yet Enabled. This is partly becuase Yahoo has yet to provide much of usfulness."; | |||||||||||||||||||||
| 142 | 0 | ▶ | print "$this->{errorMessage}\n" if $this->{options}->{progress}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 143 | |||||||||||||||||||||||
| 144 | 0 | return( 0 ); | |||||||||||||||||||||
| 145 | |||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||
| 147 | |||||||||||||||||||||||
| 148 | # Internal Function to check if we have a member ID yet. | ||||||||||||||||||||||
| 149 | 0 | ▶ | sub _checkIfMemberId { | ||||||||||||||||||||
|
Subroutine
_checkIfMemberId: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||
| 150 | 0 | my $this = shift; | |||||||||||||||||||||
| 151 | |||||||||||||||||||||||
| 152 | # check to see if we have a memberId for this user, | ||||||||||||||||||||||
| 153 | # if not fetch one | ||||||||||||||||||||||
| 154 | 0 | ▶ | unless ( $this->{memberid} ){ | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 155 | 0 | ▶ | unless ( $this->findMemberId() ){ | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 156 | # if we were unable to fetch a memberId then return negativly | ||||||||||||||||||||||
| 157 | # User should check $foo->error_message() for errors | ||||||||||||||||||||||
| 158 | 0 | return( 0 ); | |||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||
| 162 | |||||||||||||||||||||||
| 163 | # Parse Yahoo XML feed | ||||||||||||||||||||||
| 164 | # Arguments: | ||||||||||||||||||||||
| 165 | # int, pageNumber | ||||||||||||||||||||||
| 166 | # int, search type - 1 = song | ||||||||||||||||||||||
| 167 | # 2 = album | ||||||||||||||||||||||
| 168 | # 3 = artist | ||||||||||||||||||||||
| 169 | # 4 = genre | ||||||||||||||||||||||
| 170 | 0 | ▶ | sub _parseRatings { | ||||||||||||||||||||
|
Subroutine
_parseRatings: not called CC=14 SCAR=53.5
| |||||||||||||||||||||||
| 171 | 0 | my $this = shift; | |||||||||||||||||||||
| 172 | 0 | my $page = shift; | |||||||||||||||||||||
| 173 | 0 | my $type = shift; | |||||||||||||||||||||
| 174 | |||||||||||||||||||||||
| 175 | 0 | my $xs = new XML::Simple(); | |||||||||||||||||||||
| 176 | 0 | my $ua = LWP::UserAgent->new; | |||||||||||||||||||||
| 177 | 0 | $ua->timeout(10); | |||||||||||||||||||||
| 178 | 0 | $ua->env_proxy; | |||||||||||||||||||||
| 179 | |||||||||||||||||||||||
| 180 | 0 | my $url = 'http://yme.us.music.yahoo.com/profile/rating_xml.asp?type='. $type .'&uid='. $this->{memberid} .'&p='. $page .'&g=undefined>=1'; | |||||||||||||||||||||
| 181 | 0 | ▶ | print "Fetching web page " if $this->{options}->{progress}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 182 | |||||||||||||||||||||||
| 183 | 0 | my $response = $ua->get( $url ); | |||||||||||||||||||||
| 184 | |||||||||||||||||||||||
| 185 | 0 | ▶ | if ($response->is_success) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 186 | 0 | my $ref = $xs->XMLin( $response->content ); | |||||||||||||||||||||
| 187 | |||||||||||||||||||||||
| 188 | # Search for type 1, songs | ||||||||||||||||||||||
| 189 | 0 | ▶ | if ($type == 1){ | ||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||
| 190 | 0 | $this->{totalPages} = $ref->{SONG_RATINGS}->{SONG_RATING_LIST}->{POSITION}->{PAGES}->{TOTAL}; | |||||||||||||||||||||
| 191 | 0 | $this->{currentPage} = $ref->{SONG_RATINGS}->{SONG_RATING_LIST}->{POSITION}->{PAGES}->{CURRENT}; | |||||||||||||||||||||
| 192 | 0 | ▶ | print "$this->{currentPage} of $this->{totalPages}\n" if $this->{options}->{progress}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 193 | |||||||||||||||||||||||
| 194 | 0 | foreach my $elem (@{$ref->{SONG_RATINGS}->{SONG_RATING_LIST}->{LIST}->{LIST_ROW}}) { | |||||||||||||||||||||
| 195 | # { | ||||||||||||||||||||||
| 196 | # 'VIEWER_RATING' => { | ||||||||||||||||||||||
| 197 | # 'VALUE' => '-1' | ||||||||||||||||||||||
| 198 | # }, | ||||||||||||||||||||||
| 199 | # 'SONG' => { | ||||||||||||||||||||||
| 200 | # 'ID' => '319952', | ||||||||||||||||||||||
| 201 | # 'ALBUM' => { | ||||||||||||||||||||||
| 202 | # 'ID' => '115213', | ||||||||||||||||||||||
| 203 | # 'NAME' => 'The Slim Shady LP (Edited)' | ||||||||||||||||||||||
| 204 | # }, | ||||||||||||||||||||||
| 205 | # 'NAME' => 'My Name Is', | ||||||||||||||||||||||
| 206 | # 'HAS_SAMPLE' => {}, | ||||||||||||||||||||||
| 207 | # 'ARTIST' => { | ||||||||||||||||||||||
| 208 | # 'ID' => '289114', | ||||||||||||||||||||||
| 209 | # 'NAME' => 'Eminem' | ||||||||||||||||||||||
| 210 | # }, | ||||||||||||||||||||||
| 211 | # 'HAS_TETHDOWNLOAD' => {}, | ||||||||||||||||||||||
| 212 | # 'HAS_ODSTREAM' => {}, | ||||||||||||||||||||||
| 213 | # 'HAS_PERMDOWNLOAD' => {} | ||||||||||||||||||||||
| 214 | # }, | ||||||||||||||||||||||
| 215 | # 'USER_RATING' => { | ||||||||||||||||||||||
| 216 | # 'VALUE' => '100' | ||||||||||||||||||||||
| 217 | # } | ||||||||||||||||||||||
| 218 | # }, | ||||||||||||||||||||||
| 219 | |||||||||||||||||||||||
| 220 | 0 | push(@{$this->{data}}, [ | |||||||||||||||||||||
| 221 | $elem->{SONG}->{ARTIST}->{NAME}, | ||||||||||||||||||||||
| 222 | $elem->{SONG}->{NAME}, | ||||||||||||||||||||||
| 223 | $elem->{SONG}->{ALBUM}->{NAME}, | ||||||||||||||||||||||
| 224 | $elem->{USER_RATING}->{VALUE}, | ||||||||||||||||||||||
| 225 | 0 | ]); | |||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||
| 227 | |||||||||||||||||||||||
| 228 | 0 | return( 1 ); | |||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||
| 230 | # Search for type 2, albums | ||||||||||||||||||||||
| 231 | elsif ( $type == 2 ){ | ||||||||||||||||||||||
| 232 | 0 | $this->{totalPages} = $ref->{ALBUM_RATINGS}->{ALBUM_RATING_LIST}->{POSITION}->{PAGES}->{TOTAL}; | |||||||||||||||||||||
| 233 | 0 | $this->{currentPage} = $ref->{ALBUM_RATINGS}->{ALBUM_RATING_LIST}->{POSITION}->{PAGES}->{CURRENT}; | |||||||||||||||||||||
| 234 | 0 | ▶ | print "$this->{currentPage} of $this->{totalPages}\n" if $this->{options}->{progress}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 235 | |||||||||||||||||||||||
| 236 | 0 | foreach my $elem (@{$ref->{ALBUM_RATINGS}->{ALBUM_RATING_LIST}->{LIST}->{LIST_ROW}}) { | |||||||||||||||||||||
| 237 | #{ | ||||||||||||||||||||||
| 238 | # 'ALBUM' => { | ||||||||||||||||||||||
| 239 | # 'ID' => '48792', | ||||||||||||||||||||||
| 240 | # 'NAME' => 'New Adventures In Hi-Fi', | ||||||||||||||||||||||
| 241 | # 'ARTIST' => { | ||||||||||||||||||||||
| 242 | # 'ID' => '261307', | ||||||||||||||||||||||
| 243 | # 'NAME' => 'R.E.M.' | ||||||||||||||||||||||
| 244 | # } | ||||||||||||||||||||||
| 245 | # }, | ||||||||||||||||||||||
| 246 | # 'VIEWER_RATING' => { | ||||||||||||||||||||||
| 247 | # 'VALUE' => '-1' | ||||||||||||||||||||||
| 248 | # }, | ||||||||||||||||||||||
| 249 | # 'USER_RATING' => { | ||||||||||||||||||||||
| 250 | # 'VALUE' => '90' | ||||||||||||||||||||||
| 251 | # } | ||||||||||||||||||||||
| 252 | #}, | ||||||||||||||||||||||
| 253 | |||||||||||||||||||||||
| 254 | 0 | push(@{$this->{data}}, [ | |||||||||||||||||||||
| 255 | $elem->{ALBUM}->{ARTIST}->{NAME}, | ||||||||||||||||||||||
| 256 | $elem->{ALBUM}->{NAME}, | ||||||||||||||||||||||
| 257 | $elem->{USER_RATING}->{VALUE}, | ||||||||||||||||||||||
| 258 | 0 | ]); | |||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||
| 260 | |||||||||||||||||||||||
| 261 | 0 | return( 1 ); | |||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||
| 263 | # Search for type 3, artist | ||||||||||||||||||||||
| 264 | elsif ( $type == 3 ){ | ||||||||||||||||||||||
| 265 | 0 | $this->{totalPages} = $ref->{ARTIST_RATINGS}->{ARTIST_RATING_LIST}->{POSITION}->{PAGES}->{TOTAL}; | |||||||||||||||||||||
| 266 | 0 | $this->{currentPage} = $ref->{ARTIST_RATINGS}->{ARTIST_RATING_LIST}->{POSITION}->{PAGES}->{CURRENT}; | |||||||||||||||||||||
| 267 | 0 | ▶ | print "$this->{currentPage} of $this->{totalPages}\n" if $this->{options}->{progress}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 268 | |||||||||||||||||||||||
| 269 | 0 | foreach my $elem (@{$ref->{ARTIST_RATINGS}->{ARTIST_RATING_LIST}->{LIST}->{LIST_ROW}}) { | |||||||||||||||||||||
| 270 | #{ | ||||||||||||||||||||||
| 271 | # 'VIEWER_RATING' => { | ||||||||||||||||||||||
| 272 | # 'VALUE' => '-1' | ||||||||||||||||||||||
| 273 | # }, | ||||||||||||||||||||||
| 274 | # 'ARTIST' => { | ||||||||||||||||||||||
| 275 | # 'ID' => '314672', | ||||||||||||||||||||||
| 276 | # 'NAME' => 'Bill Engvall' | ||||||||||||||||||||||
| 277 | # }, | ||||||||||||||||||||||
| 278 | # 'USER_RATING' => { | ||||||||||||||||||||||
| 279 | # 'VALUE' => '60' | ||||||||||||||||||||||
| 280 | # } | ||||||||||||||||||||||
| 281 | #}, | ||||||||||||||||||||||
| 282 | |||||||||||||||||||||||
| 283 | 0 | push(@{$this->{data}}, [ | |||||||||||||||||||||
| 284 | $elem->{ARTIST}->{NAME}, | ||||||||||||||||||||||
| 285 | $elem->{USER_RATING}->{VALUE}, | ||||||||||||||||||||||
| 286 | 0 | ]); | |||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||
| 288 | |||||||||||||||||||||||
| 289 | 0 | return( 1 ); | |||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||
| 291 | # Search for type 4, genre | ||||||||||||||||||||||
| 292 | elsif ( $type == 4 ){ | ||||||||||||||||||||||
| 293 | 0 | return( 0 ); | |||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||
| 296 | else { | ||||||||||||||||||||||
| 297 | 0 | $this->{errorMessage} = "\nLooks like either Yahoo is down or they've changed their site which means this module no longer works. Sorry :("; | |||||||||||||||||||||
| 298 | 0 | ▶ | print "$this->{errorMessage}\n" if $this->{options}->{progress}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 299 | 0 | return( 0 ); | |||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||
| 302 | |||||||||||||||||||||||
| 303 | 0 | ▶ | sub tab_output { | ||||||||||||||||||||
|
Subroutine
tab_output: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||
| 304 | 0 | my $this = shift; | |||||||||||||||||||||
| 305 | |||||||||||||||||||||||
| 306 | 0 | my @tabbed; | |||||||||||||||||||||
| 307 | |||||||||||||||||||||||
| 308 | 0 | foreach my $row (sort {uc($a->[0]) cmp uc($b->[0])} @{$this->{data}}){ | |||||||||||||||||||||
| 309 | 0 | push(@tabbed, join("\t", @{$row} ) ); | |||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||
| 311 | |||||||||||||||||||||||
| 312 | 0 | my $tabbed = join("\n", @tabbed); | |||||||||||||||||||||
| 313 | 0 | undef(@tabbed); | |||||||||||||||||||||
| 314 | 0 | return( $tabbed ); | |||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||
| 316 | |||||||||||||||||||||||
| 317 | 0 | ▶ | sub error_message { | ||||||||||||||||||||
|
Subroutine
error_message: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||
| 318 | 0 | my $this = shift; | |||||||||||||||||||||
| 319 | 0 | return( $this->{errorMessage} ); | |||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||
| 321 | |||||||||||||||||||||||
| 322 | |||||||||||||||||||||||
| 323 | 1 | 1; | |||||||||||||||||||||
| 324 | __END__ | ||||||||||||||||||||||