Index: mythweather/weather.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythweather/mythweather/weather.cpp,v
retrieving revision 1.53
diff -u -r1.53 weather.cpp
--- mythweather/weather.cpp	25 Feb 2005 01:13:16 -0000	1.53
+++ mythweather/weather.cpp	14 Mar 2005 08:51:28 -0000
@@ -135,8 +135,7 @@
     else
     {
         QString temp = findNamebyAccid(locale);
-        if (debug == true)
-                cerr << "MythWeather: --- Locale: " << locale << endl;
+        VERBOSE(VB_ALL, "MythWeather: --- Locale: " << locale << endl);
     }
 
     if (debug == true)
@@ -158,8 +157,7 @@
     nextpageIntArrow = 20;
     currentPage = 0;
 
-    if (debug == true)
-        cerr << "MythWeather: Loading Weather Types.\n";
+    VERBOSE(VB_ALL, "MythWeather: Loading Weather Types.\n");
     loadWeatherTypes();
    
     con_attempt = 0;
@@ -167,6 +165,16 @@
     showtime_timeout();
     showLayout(0);
 
+    VERBOSE(VB_ALL, "MythWeather: Loading Weather Data URL's."); 
+
+    weatherDataURL = gContext->GetSetting("WeatherDataURL",
+          "http://www.msnbc.com/m/chnk/d/weather_d_src.asp?acid=%LOCALE%");
+    weatherDataURL.replace(QRegExp("%LOCALE%"), locale);
+    weatherMapServer = gContext->GetSetting("WeatherMapServer",
+                                             "www.weather.com");
+    weatherImageServer = gContext->GetSetting("WeatherImageServer",
+                                           "image.weather.com");
+
     if (debug == true)
         cerr << "MythWeather: Setting up timers.\n";
     QTimer *showtime_Timer = new QTimer(this);
@@ -186,8 +194,7 @@
 
     setNoErase();
 
-    if (debug == true)
-        cerr << "MythWeather: Finish Object Initialization.\n";
+    VERBOSE(VB_ALL,"MythWeather: Finish Object Initialization.\n");
 
     if (readReadme == true || appCode == 2)
     {
@@ -1794,8 +1801,7 @@
 void Weather::update_timeout()
 {
     bool result = false;
-    if (debug == true)
-        cerr << "MythWeather: update_timeout() : Updating....\n";
+    VERBOSE(VB_ALL, "MythWeather: update_timeout() : Updating....\n");
 
     LayerSet *container = theme->GetSet("weatherpages");
 
@@ -1803,8 +1809,7 @@
     {
         if (container)
             SetText(container, "updatetime", tr("Obtaining initial weather data..."));
-        if (debug == true)
-                cerr << "MythWeather: First run, reset timer to updateInterval.\n";
+        VERBOSE(VB_ALL, "MythWeather: First run, reset timer to updateInterval.\n");
         update_Timer->changeInterval((int)(1000 * 60 * updateInterval));
     }
     else
@@ -2112,8 +2117,7 @@
     bool wantRetry = true;
     
     allowkeys = false;
-    if (debug == true)
-        cerr << "MythWeather: COMMS : GetWeatherData() ...\n";
+    VERBOSE(VB_ALL, "MythWeather: COMMS : GetWeatherData() ...\n");
     
     while((haveData == false)&& (wantRetry == true))
     {
@@ -2317,7 +2321,6 @@
             weatherType[i - 15] = holdings[i];
     
         setWeatherTypeIcon(weatherType);
-        setWeatherIcon(description);
     
         return true;
 
@@ -2329,7 +2332,7 @@
 void Weather::setWeatherTypeIcon(QString wt[5])
 {
     bool isSet = false;
-    int start = 1;
+    int start = 0;
     if (pastTime == true)
             start = 0;
 
@@ -2353,29 +2356,7 @@
             weatherIcon[i] = "weather/unknown.png";
         }
     }
-}
-
-void Weather::setWeatherIcon(QString txtType)
-{
-    for (int j = 0; j < 128; j++)
-    {
-        if (txtType.replace(QRegExp("  "),  "" ) == 
-            (wData[j].typeName).replace(QRegExp("  "),  "" ))
-        {
-            curIcon = "weather/" + wData[j].typeIcon;
-            description = tr(wData[j].typeName);
-            return;
-        }
-        
-        if (txtType.toInt() == wData[j].typeNum)
-        {
-            curIcon = "weather/" + wData[j].typeIcon;
-            description = tr(wData[j].typeName);
-            return;
-        }
-    }
-    
-    curIcon = "weather/unknown.png";
+    curIcon = weatherIcon[0];
 }
 
 QString Weather::GetString(QString tag)
@@ -2423,8 +2404,7 @@
 bool Weather::GetWeatherData()
 {
     
-    
-    QUrl weatherDataURL("http://www.msnbc.com/m/chnk/d/weather_d_src.asp?acid=" + locale);
+    QUrl weatherDataURL(weatherDataURL);
 
     INETComms *weatherData = new INETComms(weatherDataURL);
 
@@ -2476,10 +2456,12 @@
 
 bool Weather::GetStaticRadarMap()
 {
-    QUrl weatherMapLink1URL(QString("http://w3.weather.com/weather/map/%1"
+
+    QUrl weatherMapLink1URL(QString("http://%1/weather/map/%2"
                                     "?from=LAPmaps&setcookie=1 HTTP/1.1\n"
-                                    "Connection: close\nHost: w3.weather.com\n\n\n")
-                                    .arg(locale));
+                                    "Connection: close\nHost: %3\n\n\n")
+                                    .arg(weatherMapServer).arg(locale)
+                                    .arg(weatherMapServer));
 
     INETComms *weatherMapLink1 = new INETComms(weatherMapLink1URL);
 
@@ -2500,7 +2482,7 @@
     if (mapLoc == "<NULL>")
         return true;
      
-    QUrl weatherMapLink2URL("http://w3.weather.com/" + mapLoc); 
+    QUrl weatherMapLink2URL("http://" + weatherMapServer + "/" + mapLoc); 
      
     if (debug)
         cerr << "MythWeather: Grabbing Weather Map Link (part 2) From: " 
@@ -2522,7 +2504,7 @@
     delete weatherMapLink2;
     weatherMapLink2 = NULL;
 
-    QString imageLoc = parseData(tempData2, "<IMG NAME=\"mapImg\" SRC=\"http://image.weather.com", "\"");
+    QString imageLoc = parseData(tempData2, "<IMG NAME=\"mapImg\" SRC=\"http://" + weatherImageServer + "/", "\"");
     if (imageLoc == "<NULL>")
     {
         VERBOSE(VB_IMPORTANT, "MythWeather: Warning: Failed to find link to map image.");
@@ -2549,7 +2531,7 @@
     
     VERBOSE(VB_NETWORK, QString("MythWeather: Copying map file from server (%1)").arg(imageLoc));
      
-    QString sURL("http://image.weather.com/" + imageLoc);
+    QString sURL("http://" + weatherImageServer + "/" + imageLoc);
     QString sFilename(fileprefix + "radar.jpg");
 
     if (!HttpComms::getHttpFile(sFilename, sURL, weatherTimeoutInt))
@@ -2581,7 +2563,7 @@
          return false;
 
      // find radar maps url's
-     QString sURL = "http://w3.weather.com/weather/map/" + locale +
+     QString sURL = "http://" + weatherMapServer + "/weather/map/" + locale +
         "?name=index_large_animated&day=1";
      QString tempData = "";
 
@@ -2594,7 +2576,7 @@
      if (mapLoc == "<NULL>")
          return false;
 
-     mapLoc = "http://w3.weather.com/" + mapLoc;
+     mapLoc = "http://" + weatherMapServer + "/" + mapLoc;
      if (debug)
         cerr << "MythWeather: Grabbing Weather Map Link (part 2) From: "
            << mapLoc << endl;
@@ -2635,7 +2617,7 @@
      for (int x = 1; x <= 6; x++)
      {
          QString sFile = QString(fileprefix + "/radar%1.jpg").arg(x);
-         sURL = QString("http://image.weather.com" + imageLoc + "%1L.jpg").arg(x);
+         sURL = QString("http://" + weatherImageServer + "/" + imageLoc + "%1L.jpg").arg(x);
          if (!HttpComms::getHttpFile(sFile, sURL, weatherTimeoutInt))
              cerr << "Failed to download image from:" << sURL << endl;
      }
@@ -2690,4 +2672,18 @@
      return;
 }
 
+QString Weather::getWeatherDataURL()
+{
+     return weatherDataURL;
+}
+
+QString Weather::getWeatherMapServer()
+{
+     return weatherMapServer;
+}
+
+QString Weather::getWeatherImageServer()
+{
+     return weatherImageServer;
+}
 
Index: mythweather/weather.h
===================================================================
RCS file: /var/lib/mythcvs/mythweather/mythweather/weather.h,v
retrieving revision 1.22
diff -u -r1.22 weather.h
--- mythweather/weather.h	25 Feb 2005 01:13:16 -0000	1.22
+++ mythweather/weather.h	14 Mar 2005 08:51:28 -0000
@@ -81,6 +81,13 @@
     XMLParse *theme;
     QDomElement xmldata;
     UIAnimatedImageType* AnimatedImage;
+    QString weatherDataURL;
+    QString weatherMapServer;
+    QString weatherImageServer;
+
+    QString getWeatherDataURL();
+    QString getWeatherMapServer();
+    QString getWeatherImageServer();
 
     void SetText(LayerSet *, QString, QString);
 
@@ -139,7 +146,6 @@
     bool GetStaticRadarMap();
     bool gotDataHook;
     void setWeatherTypeIcon(QString[]);
-    void setWeatherIcon(QString);
     void backupCity(int);
     void updateAggr();
     void showCityName();
