Index: scripts/.modules/script.module.weather/lib/xbmcweather/search.py =================================================================== --- scripts/.modules/script.module.weather/lib/xbmcweather/search.py (revision 30784) +++ scripts/.modules/script.module.weather/lib/xbmcweather/search.py (working copy) @@ -44,6 +44,9 @@ html = self._fetch_source() # get location name result = self.regex_geo.search( html ).groups( 1 ) + # raise an error if city not in database + if ( result[ 1 ].startswith( "-" ) ): + raise # if ip has not changed return old values if ( result[ 0 ] == self.Addon.getSetting( "ip_geo" ) ): return self.Addon.getSetting( "id_geo" ), result[ 0 ] @@ -53,7 +56,7 @@ return self.get_town( text=result[ 1 ] )[ 1 ], result[ 0 ] except: # use our fallback for any errors - return self.Addon.getSetting( "id_geo_fallback" ), "" + return self.Addon.getSetting( "id_geo_fallback" ), "None" def get_town( self, text=None ): try: Index: scripts/.modules/script.module.xbmcaddon/lib/xbmcaddon.py =================================================================== --- scripts/.modules/script.module.xbmcaddon/lib/xbmcaddon.py (revision 30784) +++ scripts/.modules/script.module.xbmcaddon/lib/xbmcaddon.py (working copy) @@ -35,18 +35,12 @@ self._set_addon_info( cwd, id ) def _get_root_dir( self ): - print "****************************" - print sys.argv - print xbmc.translatePath( os.path.dirname( sys.argv[ 0 ] ) ) - print "****************************" - print os.getcwd() - print "****************************" # get current working directory - cwd = xbmc.translatePath( os.path.dirname( sys.argv[ 0 ] ) )#os.getcwd() + cwd = xbmc.translatePath( os.path.dirname( sys.argv[ 0 ] ) ) # check if we're at root folder of addon if ( not os.path.isfile( os.path.join( cwd, "addon.xml" ) ) ): # we're not at root, assume resources/lib/ - cwd = os.path.dirname( os.path.dirname( cwd ) )#os.path.dirname( os.getcwd() ) ) + cwd = os.path.dirname( os.path.dirname( os.path.dirname( cwd ) ) # return result return cwd Index: skin/Confluence/720p/script.weather.com.plus/CommonValues.xml =================================================================== --- skin/Confluence/720p/script.weather.com.plus/CommonValues.xml (revision 30784) +++ skin/Confluence/720p/script.weather.com.plus/CommonValues.xml (working copy) @@ -50,7 +50,7 @@ - !IsTrue(Window.Property(Weather.IsFetched)) + !StringCompare(Window.Property(Weather.IsFetched),error) + !Weather.IsFetched + !StringCompare(Window.Property(Weather.IsFetched),error) TWC.LoadingLabelCommon Index: skin/Confluence/720p/script.weather.com.plus/Current.xml =================================================================== --- skin/Confluence/720p/script.weather.com.plus/Current.xml (revision 30784) +++ skin/Confluence/720p/script.weather.com.plus/Current.xml (working copy) @@ -208,7 +208,7 @@ VisibleChange - IsTrue(Window.Property(Weather.IsFetched)) + Weather.IsFetched -30 -20 @@ -465,7 +465,7 @@ 0 horizontal VisibleChange - IsTrue(Window.Property(Weather.IsFetched)) + Weather.IsFetched 168 Index: xbmc/GUIWindowWeather.cpp =================================================================== --- xbmc/GUIWindowWeather.cpp (revision 30784) +++ xbmc/GUIWindowWeather.cpp (working copy) @@ -21,57 +21,24 @@ #include "stdafx.h" #include "GUIWindowWeather.h" -#include "GUIImage.h" #include "utils/Weather.h" #include "GUISettings.h" #include "GUIWindowManager.h" -#include "Util.h" #include "lib/libPython/XBPython.h" #include "GUIDialogOK.h" #include "xbox/network.h" #define CONTROL_BTNREFRESH 2 #define CONTROL_SELECTLOCATION 3 -#define CONTROL_LABELUPDATED 11 -#define CONTROL_IMAGELOGO 101 -#define CONTROL_STATICTEMP 223 -#define CONTROL_STATICFEEL 224 -#define CONTROL_STATICUVID 225 -#define CONTROL_STATICWIND 226 -#define CONTROL_STATICDEWP 227 -#define CONTROL_STATICHUMI 228 - -#define CONTROL_LABELD0DAY 31 -#define CONTROL_LABELD0HI 32 -#define CONTROL_LABELD0LOW 33 -#define CONTROL_LABELD0GEN 34 -#define CONTROL_IMAGED0IMG 35 - -#define PARTNER_ID "1004124588" //weather.com partner id -#define PARTNER_KEY "079f24145f208494" //weather.com partner key - -#define MAX_LOCATION 3 -#define LOCALIZED_TOKEN_FIRSTID 370 -#define LOCALIZED_TOKEN_LASTID 395 - -DWORD timeToCallPlugin = 1000; +float timeToCallPlugin = 1000; bool forceRefresh = false; -/* -FIXME'S ->strings are not centered ->weather.com dev account is mine not a general xbmc one -*/ CGUIWindowWeather::CGUIWindowWeather(void) : CGUIWindow(WINDOW_WEATHER, "MyWeather.xml") { m_iCurWeather = 0; -#ifdef _USE_ZIP_ - - -#endif } CGUIWindowWeather::~CGUIWindowWeather(void) @@ -97,7 +64,7 @@ if (iControl == CONTROL_BTNREFRESH) { forceRefresh = true; - CallPlugin(); + Refresh(); } else if (iControl == CONTROL_SELECTLOCATION) { @@ -105,11 +72,11 @@ if (m_pluginTimer.IsRunning()) m_pluginTimer.Stop(); - CGUIMessage msg(GUI_MSG_ITEM_SELECTED,GetID(),CONTROL_SELECTLOCATION); + CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), CONTROL_SELECTLOCATION); g_windowManager.SendMessage(msg); m_iCurWeather = msg.GetParam1(); - CStdString strLabel=g_weatherManager.GetLocation(m_iCurWeather); + CStdString strLabel = g_weatherManager.GetLocation(m_iCurWeather); int iPos = strLabel.ReverseFind(", "); if (iPos) { @@ -132,7 +99,7 @@ { UpdateLocations(); SetProperties(); - if (IsActive()) + if (IsActive() && !forceRefresh) m_pluginTimer.StartZero(); else CallPlugin(); @@ -167,17 +134,15 @@ { if (!IsActive()) return; - CGUIMessage msg(GUI_MSG_LABEL_RESET,GetID(),CONTROL_SELECTLOCATION); + CGUIMessage msg(GUI_MSG_LABEL_RESET, GetID(), CONTROL_SELECTLOCATION); g_windowManager.SendMessage(msg); - CGUIMessage msg2(GUI_MSG_LABEL_ADD,GetID(),CONTROL_SELECTLOCATION); + CGUIMessage msg2(GUI_MSG_LABEL_ADD, GetID(), CONTROL_SELECTLOCATION); unsigned int maxLocations = g_weatherManager.GetMaxLocations(); for (unsigned int i = 0; i < maxLocations; i++) { - char *szLocation = g_weatherManager.GetLocation(i); - if (!szLocation) continue; - CStdString strLabel(szLocation); - if (strlen(szLocation) > 1) //got the location string yet? + CStdString strLabel = g_weatherManager.GetLocation(i); + if (strLabel.size() > 1) //got the location string yet? { int iPos = strLabel.ReverseFind(", "); if (iPos) @@ -192,13 +157,12 @@ else { strLabel.Format("AreaCode %i", i + 1); - msg2.SetLabel(strLabel); msg2.SetParam1(i); g_windowManager.SendMessage(msg2); } if (i==m_iCurWeather) - SET_CONTROL_LABEL(CONTROL_SELECTLOCATION,strLabel); + SET_CONTROL_LABEL(CONTROL_SELECTLOCATION, strLabel); } CONTROL_SELECT_ITEM(CONTROL_SELECTLOCATION, m_iCurWeather); @@ -207,7 +171,6 @@ void CGUIWindowWeather::UpdateButtons() { CONTROL_ENABLE(CONTROL_BTNREFRESH); - SET_CONTROL_LABEL(CONTROL_BTNREFRESH, 184); //Refresh } @@ -258,7 +221,7 @@ argv[0] = (char*)plugin.c_str(); // if plugin is running we wait for another timeout only when in weather window - if (g_windowManager.GetActiveWindow() == WINDOW_WEATHER) + if (IsActive()) { int id = g_pythonParser.getScriptId(argv[0]); if (id != -1 && g_pythonParser.isRunning(id)) Index: xbmc/utils/Weather.cpp =================================================================== --- xbmc/utils/Weather.cpp (revision 30784) +++ xbmc/utils/Weather.cpp (working copy) @@ -67,9 +67,9 @@ return 15 * 60 * 1000; } -char *CWeather::GetLocation(int iLocation) +CStdString CWeather::GetLocation(int iLocation) { - if (strlen(m_szLocation[iLocation]) == 0) + if (m_szLocation[iLocation].IsEmpty()) { CStdString cScriptPath = "special://home/plugins/weather/" + g_guiSettings.GetString("weather.plugin"); CScriptSettings* settings = new CScriptSettings(); @@ -77,7 +77,7 @@ settings->Load(cScriptPath); CStdString setting; setting.Format("town%i", iLocation + 1); - strcpy(m_szLocation[iLocation], settings->Get(setting).c_str()); + m_szLocation[iLocation] = settings->Get(setting); } return m_szLocation[iLocation]; } @@ -99,7 +99,7 @@ { for (int i = 0; i < MAX_LOCATION; i++) { - strcpy(m_szLocation[i], ""); + m_szLocation[i] = ""; } m_MaxLocations = -1; } Index: xbmc/utils/Weather.h =================================================================== --- xbmc/utils/Weather.h (revision 30784) +++ xbmc/utils/Weather.h (working copy) @@ -44,7 +44,7 @@ CWeather(void); virtual ~CWeather(void); - char *GetLocation(int iLocation); + CStdString GetLocation(int iLocation); bool IsFetched(); void Reset(); @@ -55,7 +55,7 @@ virtual CStdString TranslateInfo(int info) const; virtual DWORD TimeToNextRefreshInMs(); - char m_szLocation[10][100]; + CStdString m_szLocation[10]; unsigned int m_iCurWeather; int m_MaxLocations;