BoomX2 wrote: > Greg, > > If you want to keep focusing on the weather.com changes I can help you > with the MLB fix. I have MLB scores working on my system again, but > want to check a couple more things before passing it on. > > Don
Thanks Don. Wish I had checked this first. I actually have it working on mine now too, but similar to you it's hard to know for certain if what I've done covers all the possibilities. Here's my current 'for' loop. Have a look if you don't mind. There's a lot of different ways to parse this stuff. Code: -------------------- for my $game_div ( @game_divs ) { next unless $game_div->look_down( "_tag", "div", "class", qr{game-header} ); my @clock = $game_div->look_down( "_tag", "p", "id", qr{statusLine1} ); my @teams = $game_div->look_down( "_tag", "a", "href", qr{/mlb/team/_/name/} ); my @scores = $game_div->look_down( "_tag", "li", "class", qr{finalScore} ); if ( (scalar (@clock) > 0) && (scalar (@teams) > 0) && (scalar (@scores) > 0) ) { #Make sure we got some good HTML to play with #my( $outcome_txt ) = $outcome[ 0 ]->content_list; my( $clock_time ) = $clock[ 0 ]->content_list; my( $away_team ) = $teams[ 0 ]->content_list; my( $home_team ) = $teams[ 1 ]->content_list; my( $away_score ) = $scores[ 1 ]->content_list; my( $home_score ) = $scores[ 2 ]->content_list; my $home_logo = $teams[1]->as_HTML; my $away_logo = $teams[0]->as_HTML; $home_logo =~ m/name\/(\w+)\//; $home_logo = 'http://assets.espn.go.com/i/teamlogos/mlb/sml/trans/' . $1 . '.gif'; $away_logo =~ m/name\/(\w+)\//; $away_logo = 'http://assets.espn.go.com/i/teamlogos/mlb/sml/trans/' . $1 . '.gif'; $sportsData{'MLB'}{$home_team.$clock_time}{'homeTeam'} = $home_team; $sportsData{'MLB'}{$home_team.$clock_time}{'awayTeam'} = $away_team; $sportsData{'MLB'}{$home_team.$clock_time}{'homeLogoURL'} = $home_logo; $sportsData{'MLB'}{$home_team.$clock_time}{'awayLogoURL'} = $away_logo; #For now we'll just set the game logo to the home team logo $sportsData{'MLB'}{$home_team.$clock_time}{'gameLogoURL'} = $home_logo; #Check to see if home score is a numeric, otherwise there isn't a score yet and set to blanks #if( $home_score =~ /^\d/ ) { if( $clock_time =~ /ET$/ ) { $sportsData{'MLB'}{$home_team.$clock_time}{'homeScore'} =''; $sportsData{'MLB'}{$home_team.$clock_time}{'awayScore'} =''; $home_score = ''; $away_score = ''; } else { $sportsData{'MLB'}{$home_team.$clock_time}{'homeScore'} =$home_score; $sportsData{'MLB'}{$home_team.$clock_time}{'awayScore'} =$away_score; } $sportsData{'MLB'}{$home_team.$clock_time}{'gameTime'} = convertTime($clock_time); if ((teamCheck($home_team,\@MLBteams)==1) || (teamCheck($away_team,\@MLBteams)==1)) { displayLines($client, $clock_time, $away_team, $home_team, $away_score, $home_score, 'MLB', 'getMLB', \&shortenMLB, \%MLBmap); } } else { $status = '-'; $log->warn('Error parsing MLB data'); } } -------------------- ------------------------------------------------------------------------ GoCubs's Profile: http://forums.slimdevices.com/member.php?userid=312 View this thread: http://forums.slimdevices.com/showthread.php?t=14327 _______________________________________________ plugins mailing list plugins@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/plugins