SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-04-2011, 08:05 AM
jusjoken jusjoken is offline
SageTVaholic
 
Join Date: Dec 2005
Location: Strathmore, AB
Posts: 2,727
WIcons API - display original Weather Icons

For any developers that would like to display the original weather icons using the new Google/NWS API here are the 2 calls available from the WIcons plugin that you are certainly welcome to use.

WIcons_Icons_GetWeatherIconURL(String) String
WIcons_Icons_GetWeatherIconURLDay(String) String

- this call takes a string but expects a url in the form that the GoogleWeather API returns from either Google or NWS.
- it will return a string that is the path to the original weather icon image if a match was found. If no match then the returned string is the original url passed in.
- the ...URLDay call will ignore the current time of day and always return the Day Icon which is useful for forecasts.

WIcons_Icons_GetWeatherIconNoURL(String) String
WIcons_Icons_GetWeatherIconNoURLDay(String) String

- these calls are the same as those above however they only return a number (as a string) that represents the Icon Image to use.
- if no match is found these calls return "-1"

Sample Google call...

Code:
sage_google_weather_GoogleWeather_getGWCurrentCondition(GoogleWeatherInstance, "iconURL")

Replace with...

WIcons_Icons_GetWeatherIconURL(sage_google_weather_GoogleWeather_getGWCurrentCondition(GoogleWeatherInstance, "iconURL"))
Sample NWS forecast call...

Code:
sage_google_weather_GoogleWeather_getNWSForecastCondition(GoogleWeatherInstance,ForecastPeriod,"icon_url")

Replace with...

WIcons_Icons_GetWeatherIconURLDay(sage_google_weather_GoogleWeather_getNWSForecastCondition(GoogleWeatherInstance,ForecastPeriod,"icon_url"))
Note:

WIcons_Icons_GetWeatherIconURL uses Day Icon images between 7am and 7pm local time by default.

You can override these times by adding properties to the sage properties file as follows...

WIcons/DayStartHour=7
WIcons/DayEndHour=19

Let me know if there are any questions.

k

Last edited by jusjoken; 12-04-2011 at 07:29 PM.
Reply With Quote
  #2  
Old 12-04-2011, 09:05 AM
jaminben jaminben is offline
Sage Icon
 
Join Date: Sep 2007
Location: Norwich, UK
Posts: 1,754
Send a message via MSN to jaminben
Cool, this is just what I'm looking for

Questions will follow I'm sure
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders
Reply With Quote
  #3  
Old 12-04-2011, 12:43 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Thanks much. I hope to make use of the API in the future.
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #4  
Old 12-04-2011, 01:00 PM
jaminben jaminben is offline
Sage Icon
 
Join Date: Sep 2007
Location: Norwich, UK
Posts: 1,754
Send a message via MSN to jaminben
I'm not sure if we need to report this to google or you.....

The locations I entered was Scotland and Edinburgh... it got the rest of the data ok.

WIcons: unhandled url - please report 'http://www.google.com'

CurrFolder: \SageTV\SageTV\STVs\Ortus\Themes\Default\Weather/Icons\ww

Other than that it works great.

Thanks

EDIT

I think the current weather condition should have been "Chance of Snow"
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders

Last edited by jaminben; 12-04-2011 at 01:02 PM.
Reply With Quote
  #5  
Old 12-04-2011, 02:12 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by jaminben View Post
The locations I entered was Scotland and Edinburgh... it got the rest of the data ok.
There's your problem. If you enter "Orlando-Florida" it will say "79 F, mostly sunny."
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #6  
Old 12-04-2011, 02:15 PM
jaminben jaminben is offline
Sage Icon
 
Join Date: Sep 2007
Location: Norwich, UK
Posts: 1,754
Send a message via MSN to jaminben
Quote:
Originally Posted by tmiranda View Post
There's your problem. If you enter "Orlando-Florida" it will say "79 F, mostly sunny."
LOl.... I wish
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders
Reply With Quote
  #7  
Old 12-04-2011, 05:36 PM
jaminben jaminben is offline
Sage Icon
 
Join Date: Sep 2007
Location: Norwich, UK
Posts: 1,754
Send a message via MSN to jaminben
Another quick question for you

Does it take into account the time of day (day/night) when using:
WIcons_Icons_GetWeatherIconURL(String)

The reason I ask is because I've got my weather URL:
http://www.google.com/ig/images/weat...tly_cloudy.gif

And Its currently night time but the image I get back is of a cloudy sun rather than a cloudy moon. I've checked the default Sage icons and its icon 28.png where as I think it should be icon 33.png.... thats if it uses day/night images.

Many Thanks

Ben
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders
Reply With Quote
  #8  
Old 12-04-2011, 05:42 PM
jusjoken jusjoken is offline
SageTVaholic
 
Join Date: Dec 2005
Location: Strathmore, AB
Posts: 2,727
Quote:
Originally Posted by jaminben View Post
I'm not sure if we need to report this to google or you.....

The locations I entered was Scotland and Edinburgh... it got the rest of the data ok.

WIcons: unhandled url - please report 'http://www.google.com'

CurrFolder: \SageTV\SageTV\STVs\Ortus\Themes\Default\Weather/Icons\ww

Other than that it works great.

Thanks

EDIT

I think the current weather condition should have been "Chance of Snow"
I added a little more debugging and it looks like it is Google weather as the url that is getting sent is 'http://www.google.com' ... it should be something like 'http://www.google.com/ig/images/weather/chance_of_snow.gif'.

I also tried SageTV without WIcons and you get a blank image for this location as well. Perhaps you can post something for Opus4 incase his API is catching an error or it could obviously be Google Weather istelf.

Glad it's working for you otherwise.

k
Reply With Quote
  #9  
Old 12-04-2011, 05:48 PM
jusjoken jusjoken is offline
SageTVaholic
 
Join Date: Dec 2005
Location: Strathmore, AB
Posts: 2,727
Quote:
Originally Posted by jaminben View Post
Another quick question for you

Does it take into account the time of day (day/night) when using:
WIcons_Icons_GetWeatherIconURL(String)

The reason I ask is because I've got my weather URL:
http://www.google.com/ig/images/weat...tly_cloudy.gif

And Its currently night time but the image I get back is of a cloudy sun rather than a cloudy moon. I've checked the default Sage icons and its icon 28.png where as I think it should be icon 33.png.... thats if it uses day/night images.

Many Thanks

Ben
Yes it does... however the time that Day starts and ends is defaulted to 7am and 7pm respectively. This should be local time.

You can override these times by adding properties as follows...

WIcons/DayStartHour=7
WIcons/DayEndHour=19

I will update the fist post as well with this information.

k
Reply With Quote
  #10  
Old 12-04-2011, 05:49 PM
jaminben jaminben is offline
Sage Icon
 
Join Date: Sep 2007
Location: Norwich, UK
Posts: 1,754
Send a message via MSN to jaminben
Quote:
Originally Posted by jusjoken View Post
I added a little more debugging and it looks like it is Google weather as the url that is getting sent is 'http://www.google.com' ... it should be something like 'http://www.google.com/ig/images/weather/chance_of_snow.gif'.

I also tried SageTV without WIcons and you get a blank image for this location as well. Perhaps you can post something for Opus4 incase his API is catching an error or it could obviously be Google Weather istelf.

Glad it's working for you otherwise.

k
Thanks for the quick reply

Ok, will do...

One other quickie... yes I'm a pain

Could you create a call that just exposes the image number? Although I've stripped away the bits I don't want it would be cleaner to just have the number... just a thought / feature request.

Thanks

Ben

EDIT

Quote:
Originally Posted by jusjoken View Post
Yes it does... however the time that Day starts and ends is defaulted to 7am and 7pm respectively. This should be local time.

You can override these times by adding properties as follows...

WIcons/DayStartHour=7
WIcons/DayEndHour=19

I will update the fist post as well with this information.

k
I thought I saw a moon image earlier when I was setting it up but the weather condition has since changed to Mostly Cloudy and its now showing a sun.... its 12pm here so still within your night parameters. Is there a way to check to see if its using the correct image?

EDIT 2

Scratch that... I was using the wrong call and thats why it was showing the sun (GetWeatherIconURLDay)..... Doh!!!

Sorry

__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders

Last edited by jaminben; 12-04-2011 at 06:07 PM.
Reply With Quote
  #11  
Old 12-04-2011, 05:58 PM
jusjoken jusjoken is offline
SageTVaholic
 
Join Date: Dec 2005
Location: Strathmore, AB
Posts: 2,727
Quote:
Originally Posted by jaminben View Post
Thanks for the quick reply

Ok, will do...

One other quickie... yes I'm a pain

Could you create a call that just exposes the image number? Although I've stripped away the bits I don't want it would be cleaner to just have the number... just a thought / feature request.

Thanks

Ben

EDIT



I thought I saw a moon image ealier when I was setting it up but the weather condition has since changed to Mostly Cloudy and its now showing a sun.... its 12pm here so still within your night parameters. Is there a way to check to see if its using the correct image?
Can you add a DebugLog statement and capture the return of the WIcons_Icons_GetWeatherIconURL call and let me know the Icon number in the string being returned.

k
Reply With Quote
  #12  
Old 12-04-2011, 06:07 PM
jusjoken jusjoken is offline
SageTVaholic
 
Join Date: Dec 2005
Location: Strathmore, AB
Posts: 2,727
Quote:
Originally Posted by jaminben View Post
Thanks for the quick reply

Ok, will do...

One other quickie... yes I'm a pain

Could you create a call that just exposes the image number? Although I've stripped away the bits I don't want it would be cleaner to just have the number... just a thought / feature request.
Would you just want the return to be "33" or "33.png"

k
Reply With Quote
  #13  
Old 12-04-2011, 06:10 PM
jaminben jaminben is offline
Sage Icon
 
Join Date: Sep 2007
Location: Norwich, UK
Posts: 1,754
Send a message via MSN to jaminben
Quote:
Originally Posted by jusjoken View Post
Would you just want the return to be "33" or "33.png"

k
I made a mistake with my code from the above post about day/night images.... sorry (I edited it now).

Just 33... I use seperate images to the Provided Sage versions which are stored in their own folders but the folders still use the same numbering system. This way its pretty easy to create animated weather icons + backgrounds if needed.

Thanks

Ben
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders
Reply With Quote
  #14  
Old 12-04-2011, 06:22 PM
jusjoken jusjoken is offline
SageTVaholic
 
Join Date: Dec 2005
Location: Strathmore, AB
Posts: 2,727
Quote:
Originally Posted by jaminben View Post
I made a mistake with my code from the above post about day/night images.... sorry (I edited it now).

Just 33... I use seperate images to the Provided Sage versions which are stored in their own folders but the folders still use the same numbering system. This way its pretty easy to create animated weather icons + backgrounds if needed.

Thanks

Ben
No problem. I am in the middle of some other coding but could likely get something out later tonight as it is a small change. I will post something when I update the plugin.

k
Reply With Quote
  #15  
Old 12-04-2011, 07:30 PM
jusjoken jusjoken is offline
SageTVaholic
 
Join Date: Dec 2005
Location: Strathmore, AB
Posts: 2,727
Quote:
Originally Posted by jaminben View Post
Just 33... I use seperate images to the Provided Sage versions which are stored in their own folders but the folders still use the same numbering system. This way its pretty easy to create animated weather icons + backgrounds if needed.

Thanks

Ben
New 1.002 version of the WIcons API released to support this request. I have updated the 1st post with the call information.

k
Reply With Quote
  #16  
Old 12-05-2011, 05:15 AM
jaminben jaminben is offline
Sage Icon
 
Join Date: Sep 2007
Location: Norwich, UK
Posts: 1,754
Send a message via MSN to jaminben
Cool, those new calls worked a treat

Thankyou

__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Plugin: WIcons - enables Day/Night Weather Icons for default SageTV STV jusjoken SageTV v7 Customizations 28 10-17-2015 02:37 PM
Weather Icons saltlyck2 SageTV Customizations 3 06-05-2006 11:51 AM
Weather Icons DIBU SageTV Customizations 0 02-27-2005 08:14 AM
Weather Icons spike5884 SageTV Customizations 7 07-31-2004 03:05 AM


All times are GMT -6. The time now is 12:56 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.