BoomX2;574160 Wrote: 
> 
> mgb,
> 
> what weather location are you using?
> 
> Don

mbg;574234 Wrote: 
> caxx1006

Looks like weather.com might be finalizing their updates to their new
website layout.  I noticed that BETA is removed from the top of the
page now.  It also looks like they made a change to how they are
addressing the past 24hr precipitation section of the page on locations
outside the US.  They were stuffing "N/A" in for the values, now they
have this text in the same area: "Past 24-hr precip is only available
for the contiguous U.S.".

If you want to try it out I've posted a code snippet below that seems
to address the issue.  I've only tried it on my US location and
caxx1006.

Find this code in the gotWeather sub of plugin.pm.


Code:
--------------------
    
                        #Precipitation - rain & snow
                        $pass_one = $tree->look_down("_tag", "dl", "class", 
"twc-first");
                        @matches = $pass_one->look_down( "_tag", "dd", "class", 
"twc-line-precip" );
  
                        $outcome_txt = $matches[0]->as_HTML;
                        if ($outcome_txt =~ m/Precip:<\/strong> (\d+.?\d?\d? 
in).*Snow:<\/strong> (\d+.?\d?\d? in)/) {
                                $wetData{'rain'} = $1;
                                $wetData{'snow'} = $2;
                        }
                        elsif ($outcome_txt =~ m/Precip:<\/strong> 
(N\/A).*Snow:<\/strong> (N\/A)/) {
                                $wetData{'rain'} = $1;
                                $wetData{'snow'} = $2;
                        }
                        else {
                                $status = '-';
                                $log->warn('Error parsing weather details - 
precip amounts');
                        }
--------------------


add in this code.


Code:
--------------------
    
                        elsif ($outcome_txt =~ m/Past 24-hr precip is only 
available/) {
                                $wetData{'rain'} = 'NA';
                                $wetData{'snow'} = 'NA';
                        }
  
  
--------------------


The final section should look like:

Code:
--------------------
    
                        #Precipitation - rain & snow
                        $pass_one = $tree->look_down("_tag", "dl", "class", 
"twc-first");
                        @matches = $pass_one->look_down( "_tag", "dd", "class", 
"twc-line-precip" );
  
                        $outcome_txt = $matches[0]->as_HTML;
                        if ($outcome_txt =~ m/Precip:<\/strong> (\d+.?\d?\d? 
in).*Snow:<\/strong> (\d+.?\d?\d? in)/) {
                                $wetData{'rain'} = $1;
                                $wetData{'snow'} = $2;
                        }
                        elsif ($outcome_txt =~ m/Past 24-hr precip is only 
available/) {
                                $wetData{'rain'} = 'NA';
                                $wetData{'snow'} = 'NA';
                        }
                        elsif ($outcome_txt =~ m/Precip:<\/strong> 
(N\/A).*Snow:<\/strong> (N\/A)/) {
                                $wetData{'rain'} = $1;
                                $wetData{'snow'} = $2;
                        }
                        else {
                                $status = '-';
                                $log->warn('Error parsing weather details - 
precip amounts');
                        }
--------------------


Hope this helps.

Don


-- 
BoomX2
------------------------------------------------------------------------
BoomX2's Profile: http://forums.slimdevices.com/member.php?userid=33529
View this thread: http://forums.slimdevices.com/showthread.php?t=14327

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to