[mythtv] Little bug with MythWeather...

Bolton Emlyn (Nokia-TP-MSW/Vancouver) emlyn.bolton at nokia.com
Wed Jun 2 19:42:31 EDT 2004

Hi all,

I've been using Mythweather since 0.14 and there's a bit of a problem
with setting the area.  When selecting the city, the UI will happily
select the city (in my case, "Vancouver").  I then see that on the
weather display, the city that has been selected is "North Vancouver"

A quick look through the code, I found in mythweather.cpp:

QString Weather::findAccidbyName(QString name)
    QString accid;
    if (noACCID == false)
        char temp[1024];
        char *hold;
        while (!accidFile.eof())
                accidFile.getline(temp, 1023);
                if (strstr(temp, name) != NULL)
                        hold = strtok(temp, "::");
                        hold = strtok(NULL, "::");
                        accid = hold;
                        hold = strtok(NULL, "::");
                        return accid;
     accid = "<NOTFOUND>";
     return name;

>From what I can tell, this reads the file of codes to cities, a line at
a time and then searches for the city name.  Once found, the id is

So the problem is that "North Vancouver" comes before "Vancouver" in the
file that is used - for my case.  However this only works around the
issue.  Would an xml file of this information be a better way forward or
should the file just be rearranged to ensure the correct city is found

I'm happy to do a patch / fix, the three possible solutions I can see:

1. Move the city data file around (least effort, least change)
2. Convert the data file to XML and use a parser
3. Prompt the user for the case when duplicates occur in the data

Any strong opinions on any of these solutions?



More information about the mythtv-dev mailing list