Weather Plugin (WIP) Pt.2

All your questions about LcdStudio 2.0 Plugins

Moderator: LcdStudio2 Experts

Postby Abnormal1 » Sun Aug 12, 2007 3:35 pm

That Accuweather looks promising. I will keep it in mind so that if I ever work on my weather Plugin I will try and add it.

However don't expect anything soon as I do not use LCDStudio at the moment and have many non-LCDStudio projects that I want to work on.

Abnormal1
Abnormal1
 
Posts: 180
Joined: Mon Feb 20, 2006 1:23 pm
Location: Kent, England

Postby 56KSurfer » Sun Aug 12, 2007 3:48 pm

That Accuweather looks promising
Yeah! :wink: Worldwide Locationcodes!
But I will wait... *sniff* No, just a joke! Did a workaround for me, created a PHP script, hosted on my local webserver which takes the accuweahter-xml, puts the relevant data in a simple CSV-String and offers it to the HTML Plugin. Some Custom Variables... And it works!
If anyone is interested, I Could post the PHP script..

Greets
56KSurfer
 
Posts: 13
Joined: Sat Aug 11, 2007 3:56 pm
Location: Germany

Postby Oggy » Wed Aug 15, 2007 9:57 am

I'm interested in this!
Oggy
 
Posts: 28
Joined: Mon Jul 16, 2007 3:39 pm
Location: Germany

Postby 56KSurfer » Sat Aug 18, 2007 11:32 am

My PHP Script wth short explanations:

Code: Select all
   $xml = simplexml_load_file('http://vwidget.accuweather.com/widget/vista1/weather_data_v2.asp?location=*** YOUR ACCUWEATHER LOCATION CODE HERE*&metric=1');
   
   if (!$xml->currentconditions->wxc->attributes()->ptend)
   {
      die();
   }   
   
   header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
   header("Pragma: no-cache");
   header("Cache-Control: no-store, no-cache,max-age=0, must-revalidate");

Load the XML from Accuweather
Stop the script if for example this attribute fails to get
Some header which tell the reader not to cache this site.


Code: Select all

#TENDENCY OUTPUT FOR ANIMATED-GIF AS ANIMATION INDEX

   $tendenz = $xml->currentconditions->wxc->attributes()->ptend;
   switch ($tendenz)
   {
      case "Steady": print "3"; break;
      case "Decreasing": print "4"; break;
      case "Rising": print "2"; break;
      default: print "3"; break;
   }
   print "#";


#WEATHER DESCRIPTION OUTPUT TRANSLATED

   $text = $xml->currentconditions->wxc->attributes()->text;
   print return_transl_condition($text)."#";   
   

#'TEMPERATURE
   $temperatur = $xml->currentconditions->wxc->attributes()->temp;
   print $temperatur."#";


#WINDDIRECTION RETURNED AS ICON INDEX
   $windrichtung = $xml->currentconditions->wxc->attributes()->wdir;
   print return_winddir_icon($windrichtung)."#";
...



As you see this script has a simple '#'-separated output which can easily been parsed with Custom Variables in LCDStudio after reading it with the html reader

I also build up an icon-translation table fpr accuweather-iconindex to the icon index of the weather animation-gif from the beginning of the thread
Its still not complete but it grows... :D
Code: Select all
   function return_weather_icon($wettericon)
   {
      switch ($wettericon)
      {
         case "02": return "29"; break;
         case "03": return "27"; break;
         case "04": return "27"; break;
         case "06": return "33"; break;
         case "07": return "25"; break;
         case "15": return "0"; break;
         case "12": return "10"; break;
         case "16"; return "10"; break;
         case "17": return "36"; break;
         case "18": return "11"; break;
         case "11": return "20"; break;
         case "35": return "28"; break;
         case "36": return "26"; break;
         case "38": return "26"; break;
         default: return $wettericon; break;
      }   
   }


And a basic function to translate these english terms to german for my display:
Code: Select all
   function return_transl_condition($text)
   {
      $von = array('Considerable cloudiness', 'rather', 'overcast', 'Morning', 'Thickening', 'showers', 'Nice', 'breezy', 'thunderstorms', 'A couple of', 'clouds', 'sun', 'Times of', 'Mostly', 'Partly', 'partly', 'Sunny', 'sunny', 'Cloudy', 'cloudy','rain', 'Rain', 'Light', 'Fog', 'and', 'delightful','around', 'to ', 'with a','with', 'shower', 'then', 'most of the time') ;
      $nach = array('Starke Bewoelkung', 'eher', 'bewoelkt', 'morgens', 'verdichtende', 'regen', 'Heiter', 'windig', 'Gewitterstuerme', 'Einige', 'Wolken', 'Sonne', 'Zeitweise', 'meist', 'teils', 'teils', 'sonnig', 'sonnig', 'wolkig', 'wolkig','Regen', 'Regen', 'leichter', 'Nebel', 'und', 'angenehm','verteilt', 'bis ', 'mit einem','mit', 'Regenschauer', 'dann', 'die meiste zeit');

      for($x = 0; $x < count($von); $x++){
         $text = str_replace($von[$x], $nach[$x], $text);
      }

      return $text;
   }


put everything in a php-script, to a webserver with PHP in a Version >= 5.1 (because of SimpleXML) and... use it!

PS:

Here screenshot of my T6963:

At the top you see today weather and at the bottom the forecast for 2 days:
Image
(Click on the Image, worked for me althoug it shows 404)
56KSurfer
 
Posts: 13
Joined: Sat Aug 11, 2007 3:56 pm
Location: Germany

Postby 56KSurfer » Sun Oct 28, 2007 7:54 pm

Some news? Plans for direct support of AcccuWeather?
I ask because I don't like my workaround, HTML-Reader takes too long to startup.
56KSurfer
 
Posts: 13
Joined: Sat Aug 11, 2007 3:56 pm
Location: Germany

Postby Abnormal1 » Mon Oct 29, 2007 10:32 am

Im sorry but it may never happen now, I have not had an LCD for a long time now and so have not had much interest in LCDStudio.

If i ever manage to get a LCD display that my high standards will accept (As in a LARGE Planar :wink: ) then I will start using LCDStudio.

Also you may be better off getting someone to write a new plugin for accuweather since for me to adapt my weather plugin would technically require me creating a new plugin anyway.

Sorry

Neil
Abnormal1
 
Posts: 180
Joined: Mon Feb 20, 2006 1:23 pm
Location: Kent, England

Postby 56KSurfer » Mon Oct 29, 2007 1:35 pm

ok, thanks for your answer... maybe I start by myself, creating this plugin. I never did C# before... just delphi and a little bit C.
Maybe I get it working. Greets..
56KSurfer
 
Posts: 13
Joined: Sat Aug 11, 2007 3:56 pm
Location: Germany

Postby FTO » Thu Mar 13, 2008 3:44 pm

hello.. i know its been 2006 for u to write in this forum but i really need some help with the wind direction of your weather plugin

i've added the custom variables in both wind-direction-icon and wind-direction and the end result i get is correct = 3 for SW.. however the arrow icon shows the South. not the SW.

is this normal? my configuration is like the image shown.

thanks in advance and sorry for any trouble caused
Image
FTO
FTO
 
Posts: 4
Joined: Mon Jan 14, 2008 7:24 pm

Postby UNOPARATOR » Thu Mar 13, 2008 3:56 pm

Trying adding or substracting 1 from your wind direction custom variable (if you have one, else create a custom variable that returns that value and use that with your wind direction image)...
UNOPARATOR
Homo Moderatus
 
Posts: 917
Joined: Tue Jul 19, 2005 7:11 pm
Location: Istanbul, Turkey

Postby Archades » Thu Mar 20, 2008 3:23 pm

Have to say i love this program and plugin.
I'm a noob at coding but i was wondering if it was possible to create a custom data thingie so i can have a single text field say
Low temp
Archades
 
Posts: 2
Joined: Thu Mar 20, 2008 3:18 pm

Custom

Postby spock » Thu Mar 20, 2008 7:12 pm

It is possible. You can "synthesise" the string on your own, like:
[code]return "Low temp "+Weather.CC.Low+"
Live long and prosper...
User avatar
spock
Site Admin
 
Posts: 4541
Joined: Mon Feb 17, 2003 6:01 pm
Location: Athens, Greece

Postby Archades » Fri Mar 21, 2008 4:29 am

Hi. Thanks for the quick reply
Thankyou so much for your help, the line i am using is
[code]return ((String)GetData("weather.location01.day01.ForecastLow"))+ (((String)GetData("weather.location01.day01.ForecastHigh")) != "NC" ? " - "+((String)GetData("weather.location01.day01.ForecastHigh")) : " - X") +" | "+((String)GetData("weather.location01.cc.Currenttemp"))+"
Archades
 
Posts: 2
Joined: Thu Mar 20, 2008 3:18 pm

Sinking faster than titanic

Postby spineman » Mon Apr 28, 2008 10:39 pm

I have so many questions about this, I feel like the little boy with his finger in a dyke... 'insert own obscene joke'... waiting hopefully for a flood of info & help. start at the begining, my knowledge goes downhill from here
The graphic/gifs at the start of Part 2 of this weather plug-in here:
Here are two nice Weather Gifs for the weather Items:

<= 49 Singelpictures
<= 48 Singelpictures


Here are several Pictures for the Moon / Winddirections / and Speed

<=361Singelpictures


How do I download the images? When you have finished laughing at my complete lack of knowledge please feel free to pass any pearls of wisdom.
By Strength & Guile
Learning to be a 'civvy' seems to be the most demanding training over the last 34 years
Water cooling PC's is fun, the sparks and instant darkness in the neighborhood makes it well worth the cost
spineman
 
Posts: 9
Joined: Mon Mar 10, 2008 7:37 pm
Location: Newcastle UK

Postby blap_psx » Tue Apr 29, 2008 12:30 pm

Right clic / save as ?
blap_psx
 
Posts: 85
Joined: Mon Feb 20, 2006 12:30 pm

Postby spineman » Tue Apr 29, 2008 1:03 pm

Right clic / save as ?


Yes tried that, only downloads/copies a single GIF. As in following
Here are two nice Weather Gifs for the weather Items:

<= 49 Singelpictures
<= 48 Singelpictures


Right click only saves 1 of the 49 single pictures

Thanks for suggestion
By Strength & Guile
Learning to be a 'civvy' seems to be the most demanding training over the last 34 years
Water cooling PC's is fun, the sparks and instant darkness in the neighborhood makes it well worth the cost
spineman
 
Posts: 9
Joined: Mon Mar 10, 2008 7:37 pm
Location: Newcastle UK

PreviousNext

Return to Plugins

Who is online

Users browsing this forum: No registered users and 1 guest

cron