[RELEASE] The Weather Channel (TWC) - Supplemental Script

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Jaco2k Offline
Senior Member
Posts: 112
Joined: Mar 2009
Reputation: 0
Post: #151
Hi there,

Anyone else getting corrupted layout for temperatures on the 10 day preview?

This happens using Celsius...


Cheers,
J
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #152
Quote:
[TWC Supplemental]

-changed: version - 1.5.5
-fixed: 10 day forecast high temp(why did it ever work)
-fixed: weekend forecast
-added: Greek language strings, thanks to Ydatografida

@Ydatografida, thanks for the strings

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
rwparris2 Offline
Team-XBMC Python Developer
Posts: 1,333
Joined: Jan 2008
Reputation: 2
Location: US
Post: #153
rwparris2 Wrote:In whatever skin you're using, you could point the weather button/item to this script instead of where it normally points to.

If you need help post what skin you're using and I'll tell what to change in the xml.

Edit -- or better yet PM me or I'll forget to look here.

As requested, for PM3.HD open Home.xml in xbmc/skin/PM3.HD/720p, then search for "Weather Push Button".

Under that change line 696 from
Code:
<onclick>ActivateWindow(Weather)</onclick>
to
Code:
<onclick>RunScript(C:\Documents and Settings\rwparris2\Application Data\XBMC\scripts\TWC Supplemental\default.py)</onclick>
Obviously you'll need to substitute that path to fit your system.

Always read the XBMC online-manual, FAQ and search and search the forum before posting.
For troubleshooting and bug reporting please read how to submit a proper bug report.

If you're interested in writing addons for xbmc, read docs and how-to for plugins and scripts ||| http://code.google.com/p/xbmc-addons/
find quote
ThickHead Offline
Junior Member
Posts: 19
Joined: Feb 2009
Reputation: 0
Post: #154
Hello,
First let me say that this is my most used script, so Thank You Nuka1195! I was wondering if you would consider adding the "local interactive maps" from weather.com to the list of map choices? The classic maps for my locale are too wide of a range. The interactive maps even have a new "future" selection that makes them perfect for seeing storms coming.
Thanks!
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #155
i don't beleive it's possible.

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
tmc701 Offline
Member
Posts: 91
Joined: May 2009
Reputation: 0
Post: #156
Is there a way to increase the font size within the script? I scanned this thread, but didn't see anything.
or is the font size tied to the skin in which it's invoked? (currently using in jezz_x's mediastream_redux)

edit: Nevermind, went poking around the skin directory within the script's folder and replaced the instances of 'font10' with 'font12' and voila! it became readable at distance again.
(This post was last modified: 2009-07-07 18:03 by tmc701.)
find quote
Jezz_X Online
Team-XBMC Skinner
Posts: 5,289
Joined: Jun 2006
Reputation: 57
Location: Earth
Post: #157
I got a problem with Metric Units and Values shown If you turn on Metric Units it still shows imperial "Fanrenheit" in the 36 hour forcast and the weekend Outlook sections
See Image (red circles)

[Image: screenshot023.jpg]
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #158
weather.com doesn't localise those.

the "plugin" (which skins almost the same) does do more, but i haven't figured a good way to handle those. converting "low 60s" would be what in celcius?

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
Jezz_X Online
Team-XBMC Skinner
Posts: 5,289
Joined: Jun 2006
Reputation: 57
Location: Earth
Post: #159
Well my guess is 60's and 40s are just 60 degree and 40 degree in fahrenheit
so according to google 60 degrees Fahrenheit = 15.5555556 degrees Celsius
so I guess highs in the low 10s :\
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #160
Yeah i know how to convert. the problem is/was if it's low 60s, then is it 60 or 63, same with mid or high.

this is how i did it, if someone has a better way, please post.

this is only available in the plugin as this script is depreciated and does not have these localized functions. what weather.com returns is what i use.

skinning the plugin isn't much different and an easy check to see if the plugin is available is !IsEmpty(Weather.Plugin) i think is what it is.

PHP Code:
def _normalize_outlookoutlook ):
    
# if we're debugging xbmc module is not available
    
tid "F"
    
sid "mph"
    
if ( not DEBUG ):
        
tid xbmc.getRegionid="tempunit" )[ -]
        
sid xbmc.getRegionid="speedunit" )
    
# enumerate thru and localize values
    
for counttmp_outlook in enumerateoutlook ):
        
# calculate the localized temp if C is required
        
temps re.findall"[0-9]+F"tmp_outlook )
        for 
temp in temps:
            
tmp_outlook re.subtemp_localize_unittemp ) + tidtmp_outlook)
        
# calculate the localized temp ranges if C is required
        
temps re.findall"[low|mid|high]+ [0-9]+s"tmp_outlook )
        
add = { "l"3"m"6"h"}
        for 
temp in temps:
            
new_temp _localize_unitstrintre.findall"[0-9]+"temp )[ ] ) + add.gettemp], ) ) )
            
temp_int intfloatnew_temp ) / 10 ) * 10
            temp_rem 
intfloatnew_temp ) % 10 )
            
temp_text = ( "low %ds""mid %ds""high %ds", )[ ( temp_rem >= ) + ( temp_rem >= ) ]
            
tmp_outlook re.subtemptemp_text % ( temp_int, ), tmp_outlook)
        
# calculate the localized wind if C is required
        
winds re.findall"[0-9]+ to [0-9]+ mph"tmp_outlook )
        for 
wind in winds:
            
speeds re.findall"[0-9]+"wind )
            for 
speed in speeds:
                
wind re.subspeed_localize_unitspeed"speed" ).split" " )[ ], wind)
            
tmp_outlook re.sub"[0-9]+ to [0-9]+ mph"wind.replace"mph"sid ), tmp_outlook)
        
# add our text back to the main variable
        
outlookcount ] = tmp_outlook
    
# return normalized text
    
return outlook
def _localize_unit
valueunit="temp" ):
    
# replace any invalid characters
    
value value.replacechr(176), "" ).replace"&deg;""" ).replace"F""" )
    
# do not convert invalid values
    
if ( not value or value.startswith"N/A" ) ):
        return 
value
    
# time conversion
    
if ( unit == "time" ):
        
# set default time
        
time value
        
# set our default temp unit
        
id "h:mm:ss xx"
        
# if we're debugging xbmc module is not available
        
if ( not DEBUG ):
            
id xbmc.getRegionid="time" )
        if ( 
id == "h:mm:ss xx" ):
            return 
time
        
# 24 hour ?
        
if ( id.startswith"H" ) ):
            
hour intvalue.split":" )[ ] ) + ( 12 * ( value.split" " )[ ] == "PM" ) )
            
time "%d:%s" % ( hourvalue.split" " )[ ].split":" )[ ], )
        if ( 
id.split" " )[ -] == "xx" ):
            
time "%s %s" % ( timevalue.split" " )[ ], ) 
        return 
time
    
else:
        
# we need an float
        
value floatvalue.replacechr(176), "" ).replace"&deg;""" ).replace"F""" ).replace"mph""" ).replace"in.""" ) )
        
# temp conversion
        
if ( unit == "temp" or  unit == "tempdiff" ):
            
# set our default temp unit
            
id "F"
            
# if we're debugging xbmc module is not available
            
if ( not DEBUG ):
                
id xbmc.getRegionid="tempunit" )[ -]
            
# calculate the localized temp if C is required
            
if ( id == "C" ):
                
# C/F difference or temperature conversion
                
if ( unit == "tempdiff" ):
                    
# 9 degrees of F equal 5 degrees of C
                    
value roundfloatvalue ) / )
                else:
                    
# convert to celcius
                    
value round( ( value 32 ) * ( float) / ) )
            
# get our sign, only + is needed for tempdiff
            
sign = ( """+", )[ value >= and unit == "tempdiff" ]
            
# return localized temp
            
return sign strintvalue ) )
        
# speed conversion
        
elif unit == "speed" ):
            
# set our default temp unit
            
id "mph"
            
# if we're debugging xbmc module is not available
            
if ( not DEBUG ):
                
id xbmc.getRegionid="speedunit" )
            
# calculate the localized speed
            
if ( id == "km/h" ):
                
value roundvalue 1.609344 )
            
elif id == "m/s" ):
                
value roundvalue 0.45 )
            
elif id == "ft/min" ):
                
value roundvalue 88 )
            
elif id == "ft/s" ):
                
value roundvalue 1.47 )
            
elif id == "yard/s" ):
                
value roundvalue 0.4883 )
            
# return localized speed
            
return "%d %s" % ( intvalue ), id, )
        
# length conversion
        
elif unit == "length" ):
            
# set our default length unit
            
id "in."
            
# if we're debugging xbmc module is not available
            
if ( not DEBUG ):
                
id = ( "in.""cm", )[ xbmc.getRegionid="tempunit" )[ -] == "C" ]
            
# calculate the localized length
            
if ( id == "cm" ):
                
value floatvalue 2.54 )
            
# return localized length
            
return "%.2f%s" % ( valueid, ) 

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
nytmar3 Offline
Junior Member
Posts: 24
Joined: Aug 2009
Reputation: 0
Post: #161
I can't get this to integrate into pm3.hd I can go to scripts and open it and check the weather and everything, but I'm not getting the fancier looking weather details on my home page like everyone is showing and bragging about?? Please help.

I'm on an xbox, most current svn build, installer, etc.

Thanks
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #162
Quote:
[TWC Supplemental]

-changed: version -> 1.5.7
-fixed: weekend forecast
-fixed: include .py not .pyo for other python platforms
*fixed just for you Jezz_X since you did such a nice job on the skin for it in Confluence

update

* This is still obsolete. skinners use the weather.com plugin
http://forum.xbmc.org/showthread.php?tid=52034

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
Post Reply