LcdStudio.Com Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Weather Plugin (WIP) Pt.2
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
 
Reply to topic    LcdStudio.Com Forum Index » Plugins View previous topic
View next topic
Weather Plugin (WIP) Pt.2
Author Message
Abnormal1



Joined: 20 Feb 2006
Posts: 180
Location: Kent, England

Post Reply with quote
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
Sun Aug 12, 2007 3:35 pm View user's profile Send private message
56KSurfer



Joined: 11 Aug 2007
Posts: 13
Location: Germany

Post Reply with quote
Quote:
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
Sun Aug 12, 2007 3:48 pm View user's profile Send private message
Oggy



Joined: 16 Jul 2007
Posts: 28
Location: Germany

Post Reply with quote
I'm interested in this!
Wed Aug 15, 2007 9:57 am View user's profile Send private message
56KSurfer



Joined: 11 Aug 2007
Posts: 13
Location: Germany

Post Reply with quote
My PHP Script wth short explanations:

Code:

   $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:


#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... Very Happy
Code:

   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:
   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:

(Click on the Image, worked for me althoug it shows 404)
Sat Aug 18, 2007 11:32 am View user's profile Send private message
56KSurfer



Joined: 11 Aug 2007
Posts: 13
Location: Germany

Post Reply with quote
Some news? Plans for direct support of AcccuWeather?
I ask because I don't like my workaround, HTML-Reader takes too long to startup.
Sun Oct 28, 2007 7:54 pm View user's profile Send private message
Abnormal1



Joined: 20 Feb 2006
Posts: 180
Location: Kent, England

Post Reply with quote
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
Mon Oct 29, 2007 10:32 am View user's profile Send private message
56KSurfer



Joined: 11 Aug 2007
Posts: 13
Location: Germany

Post Reply with quote
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..
Mon Oct 29, 2007 1:35 pm View user's profile Send private message
FTO



Joined: 14 Jan 2008
Posts: 4

Post Reply with quote
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


_________________
FTO
Thu Mar 13, 2008 3:44 pm View user's profile Send private message Send e-mail MSN Messenger
UNOPARATOR
Homo Moderatus


Joined: 19 Jul 2005
Posts: 915
Location: Istanbul, Turkey

Post Reply with quote
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)...
Thu Mar 13, 2008 3:56 pm View user's profile Send private message
Archades



Joined: 20 Mar 2008
Posts: 2

Post Reply with quote
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°c - High temp°c | Current temp°c
and if one of the fields isn't there, like currently my locations high temp is showign as N/A i'd like it to be like
Low temp°c - X | Current temp°c if possible.

Thanks.
Thu Mar 20, 2008 3:23 pm View user's profile Send private message
spock
Site Admin


Joined: 17 Feb 2003
Posts: 4526
Location: Athens, Greece

Post Custom Reply with quote
It is possible. You can "synthesise" the string on your own, like:
Code:
return "Low temp "+Weather.CC.Low+"°C"+ (Weather.CC.High != "NC" ? " - High temp "+Weather.CC.High+"°C" : " - X") +" | Current temp "+Weather.CC.Now+"°C"

...where you'd have to replace the Weather.CC.whatever parts with actual data feeds.
Cheers!

_________________
Live long and prosper...
Thu Mar 20, 2008 7:12 pm View user's profile Send private message Send e-mail Visit poster's website ICQ Number
Archades



Joined: 20 Mar 2008
Posts: 2

Post Reply with quote
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"))+"°C";

Which returns 23 - 27 | 30°C at the moment, decided to cut a few degree celcius signs out to save room on my g15
Once again thankyou very much Smile
Fri Mar 21, 2008 4:29 am View user's profile Send private message
spineman



Joined: 10 Mar 2008
Posts: 9
Location: Newcastle UK

Post Sinking faster than titanic Reply with quote
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:
Quote:
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
Mon Apr 28, 2008 10:39 pm View user's profile Send private message Send e-mail
blap_psx



Joined: 20 Feb 2006
Posts: 85

Post Reply with quote
Right clic / save as ?

_________________
Admin of G15 french wiki
Tue Apr 29, 2008 12:30 pm View user's profile Send private message
spineman



Joined: 10 Mar 2008
Posts: 9
Location: Newcastle UK

Post Reply with quote
Quote:
Right clic / save as ?


Yes tried that, only downloads/copies a single GIF. As in following
Quote:
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
Tue Apr 29, 2008 1:03 pm View user's profile Send private message Send e-mail
Display posts from previous:    
Reply to topic    LcdStudio.Com Forum Index » Plugins All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
Page 8 of 10

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.