Project

General

Profile

Bug #128 » incomplete.diff

nuka1195, 15/10/2010 02:17 PM

View differences:

language/English/strings.xml (working copy)
<string id="61">Nov</string>
<string id="62">Dec</string>
<string id="71">N</string>
<string id="72">NNE</string>
<string id="73">NE</string>
<string id="74">ENE</string>
<string id="75">E</string>
<string id="76">ESE</string>
<string id="77">SE</string>
<string id="78">SSE</string>
<string id="79">S</string>
<string id="80">SSW</string>
<string id="81">SW</string>
<string id="82">WSW</string>
<string id="83">W</string>
<string id="84">WNW</string>
<string id="85">NW</string>
<string id="86">NNW</string>
<string id="87">VAR</string>
<string id="88">North</string>
<string id="89">Northeast</string>
<string id="90">East</string>
<string id="91">Southeast</string>
<string id="92">South</string>
<string id="93">Southwest</string>
<string id="94">West</string>
<string id="95">Northwest</string>
<string id="96">Variable</string>
<string id="98">View: Auto</string>
<string id="99">View: Auto big</string>
<string id="100">View: Icons</string>
......
<string id="415">Downloading thumbnail...</string>
<string id="416">Not available</string>
<string id="417">View: Big icons</string>
<string id="418">Enable Library</string>
<string id="419"></string>
<string id="420"></string>
<string id="418">Low</string>
<string id="419">High</string>
<string id="420">HDMI</string>
<string id="421"></string>
<string id="422">Delete album info</string>
<string id="423">Delete CD information</string>
......
<string id="431">No cache</string>
<string id="432">Remove movie from library</string>
<string id="433">Really remove '%s'?</string>
<string id="434"></string>
<string id="435"></string>
<string id="436"></string>
<string id="434">From %s at %i %s</string> <!--From <wind dir.> at <speed> <unit>-->
<string id="435">From the %s at %i %s</string> <!--From the <wind dir.> at <speed> <unit>-->
<string id="436">Gust to %i %s</string> <!--Gust to <speed> <unit>-->
<string id="437">Removable disk</string>
<string id="438">Opening file</string>
<string id="439">Cache</string>
......
<string id="1417">Grains</string>
<string id="1418">T-Storms</string>
<string id="1419">T-Showers</string>
<string id="1420">Moderate</string>
<string id="1421">Very High</string>
<string id="1422">Windy</string>
<string id="1423">Mist</string>
<string id="1424">Blowing</string>
<string id="1440">Moon</string>
<string id="1441">Waning</string>
<string id="1442">Waxing</string>
<string id="1443">Full</string>
<string id="1444">New</string>
<string id="1445">First</string>
<string id="1446">Last</string>
<string id="1447">Quarter</string>
<string id="1448">Crescent</string>
<string id="1449">Gibbous</string>
<!-- strings through to 1450 reserved for weather translation -->
<string id="1450">Put display to sleep when idle</string>
......
<string id="21448">Subtitle language</string>
<string id="21449">Remote control sends keyboard presses</string>
<string id="21450">- Edit</string>
<string id="21451">Internet connection required.</string>
<string id="21800">File name</string>
<string id="21801">File path</string>
......
<string id="23105"></string>
<string id="23106"></string>
<string id="24020">Configure</string>
<string id="24021">Disable</string>
<string id="24022">Enable</string>
<string id="24023">Add-on disabled</string>
<!-- strings 29800 thru 29998 reserved strings used only in the default Project Mayhem III skin and not c++ code -->
<string id="29800">Library Mode</string>
<string id="29801">QWERTY keyboard</string>
......
<string id="33082">Path to script</string>
<string id="33083">Enable custom script button</string>
<string id="33200">mile</string>
<string id="33201">miles</string>
<string id="33202">kilometer</string>
<string id="33203">kilometers</string>
<string id="34005">Flac</string>
</strings>
xbmc/Application.cpp (working copy)
CreateDirectory("Q:\\plugins\\video", NULL);
CreateDirectory("Q:\\plugins\\pictures", NULL);
CreateDirectory("Q:\\plugins\\programs", NULL);
CreateDirectory("Q:\\plugins\\weather", NULL);
CreateDirectory("Q:\\language", NULL);
CreateDirectory("Q:\\visualisations", NULL);
CreateDirectory("Q:\\sounds", NULL);
xbmc/GUISettings.cpp (working copy)
// My Weather settings
AddGroup(2, 8);
AddCategory(2, "weather", 16000);
AddString(1, "weather.areacode1", 14019, "USNY0996 - New York, NY", BUTTON_CONTROL_STANDARD);
AddString(2, "weather.areacode2", 14020, "UKXX0085 - London, United Kingdom", BUTTON_CONTROL_STANDARD);
AddString(3, "weather.areacode3", 14021, "JAXX0085 - Tokyo, Japan", BUTTON_CONTROL_STANDARD);
AddSeparator(4, "weather.sep1");
AddString(5, "weather.plugin", 23000, "", SPIN_CONTROL_TEXT, true);
AddString(5, "weather.plugin", 8, DEFAULT_WEATHER_PLUGIN, SPIN_CONTROL_TEXT, true);
AddString(6, "weather.pluginsettings", 23001, "", BUTTON_CONTROL_STANDARD, true);
// My Music Settings
xbmc/GUIWindowSettingsCategory.cpp (working copy)
if (strSetting.Equals("screensaver.usedimonpause") && g_guiSettings.GetString("screensaver.mode").Equals("Dim"))
pControl->SetEnabled(false);
}
else if (strSetting.Left(16).Equals("weather.areacode"))
{
CSettingString *pSetting = (CSettingString *)GetSetting(strSetting)->GetSetting();
CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(GetSetting(strSetting)->GetID());
pControl->SetLabel2(g_weatherManager.GetAreaCity(pSetting->GetData()));
}
else if (strSetting.Equals("weather.plugin"))
{
CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
if (pControl->GetCurrentLabel().Equals(g_localizeStrings.Get(13611)))
if (pControl->GetCurrentLabel().Equals(g_localizeStrings.Get(13610)))
g_guiSettings.SetString("weather.plugin", "");
else
g_guiSettings.SetString("weather.plugin", pControl->GetCurrentLabel());
......
void CGUIWindowSettingsCategory::OnClick(CBaseSettingControl *pSettingControl)
{
CStdString strSetting = pSettingControl->GetSetting()->GetSetting();
if (strSetting.Left(16).Equals("weather.areacode"))
if (strSetting.Equals("weather.plugin"))
{
CStdString strSearch;
if (CGUIDialogKeyboard::ShowAndGetInput(strSearch, g_localizeStrings.Get(14024), false))
{
strSearch.Replace(" ", "+");
CStdString strResult = ((CSettingString *)pSettingControl->GetSetting())->GetData();
if (g_weatherManager.GetSearchResults(strSearch, strResult))
((CSettingString *)pSettingControl->GetSetting())->SetData(strResult);
g_weatherManager.ResetTimer();
}
}
else if (strSetting.Equals("weather.plugin"))
{
g_weatherManager.Reset();
g_weatherManager.ResetTimer();
}
else if (strSetting.Equals("weather.pluginsettings"))
{
// Create our base path
CStdString basepath = "special://home/plugins/weather/" + g_guiSettings.GetString("weather.plugin");
CGUIDialogPluginSettings::ShowAndGetInput(basepath);
// TODO: maybe have ShowAndGetInput return a bool if settings changed, then only reset weather if true.
g_weatherManager.ResetTimer();
if (CGUIDialogPluginSettings::ShowAndGetInput(basepath))
{
// TODO: maybe have ShowAndGetInput return a bool if settings changed, then only reset weather if true.
g_weatherManager.Reset();
g_weatherManager.ResetTimer();
}
}
else if (strSetting.Equals("lookandfeel.rssedit"))
CUtil::ExecBuiltIn("RunScript("RSSEDITOR_PATH")");
......
int k=0;
pControl->Clear();
// add our disable option
pControl->AddLabel(g_localizeStrings.Get(13611), j++);
pControl->AddLabel(g_localizeStrings.Get(13610), j++);
CFileItemList items;
if (CDirectory::GetDirectory("special://home/plugins/weather/", items, "/", false))
xbmc/GUIWindowWeather.cpp (working copy)
#include "GUIWindowManager.h"
#include "Util.h"
#include "lib/libPython/XBPython.h"
#include "GUIDialogOK.h"
#define CONTROL_BTNREFRESH 2
#define CONTROL_SELECTLOCATION 3
......
#define LOCALIZED_TOKEN_LASTID 395
DWORD timeToCallPlugin = 1000;
bool forceRefresh = false;
/*
FIXME'S
>strings are not centered
......
bool CGUIWindowWeather::OnAction(const CAction &action)
{
if (action.id == ACTION_PREVIOUS_MENU)
if (action.id == ACTION_PREVIOUS_MENU || action.id == ACTION_PARENT_DIR)
{
g_windowManager.PreviousWindow();
return true;
......
int iControl = message.GetSenderId();
if (iControl == CONTROL_BTNREFRESH)
{
Refresh(); // Refresh clicked so do a complete update
forceRefresh = true;
CallPlugin();
}
else if (iControl == CONTROL_SELECTLOCATION)
{
......
{
UpdateLocations();
SetProperties();
if (g_windowManager.GetActiveWindow() == WINDOW_WEATHER)
{
if (!g_guiSettings.GetString("weather.plugin").IsEmpty())
m_pluginTimer.StartZero();
}
if (IsActive())
m_pluginTimer.StartZero();
else
CallPlugin();
}
break;
case GUI_MSG_WINDOW_INIT:
{
if (g_guiSettings.GetString("weather.plugin").IsEmpty())
{
CGUIDialogOK::ShowAndGetInput(8,24023,20022,20022);
g_windowManager.PreviousWindow();
return true;
}
}
break;
default:
break;
}
return CGUIWindow::OnMessage(message);
......
g_windowManager.SendMessage(msg);
CGUIMessage msg2(GUI_MSG_LABEL_ADD,GetID(),CONTROL_SELECTLOCATION);
for (unsigned int i = 0; i < MAX_LOCATION; i++)
unsigned int maxLocations = g_weatherManager.GetMaxLocations();
for (unsigned int i = 0; i < maxLocations; i++)
{
char *szLocation = g_weatherManager.GetLocation(i);
if (!szLocation) continue;
......
SET_CONTROL_LABEL(CONTROL_BTNREFRESH, 184); //Refresh
SET_CONTROL_LABEL(WEATHER_LABEL_LOCATION, g_weatherManager.GetLocation(m_iCurWeather));
SET_CONTROL_LABEL(CONTROL_LABELUPDATED, g_weatherManager.GetLastUpdateTime());
SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_COND, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_COND));
SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_TEMP, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_TEMP) + g_langInfo.GetTempUnitString());
SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_FEEL, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_FEEL) + g_langInfo.GetTempUnitString());
SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_UVID, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_UVID));
SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_WIND, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_WIND));
SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_DEWP, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_DEWP) + g_langInfo.GetTempUnitString());
SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_HUMI, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_HUMI));
CGUIImage *pImage = (CGUIImage *)GetControl(WEATHER_IMAGE_CURRENT_ICON);
if (pImage) pImage->SetFileName(g_weatherManager.GetInfo(WEATHER_IMAGE_CURRENT_ICON));
//static labels
SET_CONTROL_LABEL(CONTROL_STATICTEMP, 401); //Temperature
SET_CONTROL_LABEL(CONTROL_STATICFEEL, 402); //Feels Like
SET_CONTROL_LABEL(CONTROL_STATICUVID, 403); //UV Index
SET_CONTROL_LABEL(CONTROL_STATICWIND, 404); //Wind
SET_CONTROL_LABEL(CONTROL_STATICDEWP, 405); //Dew Point
SET_CONTROL_LABEL(CONTROL_STATICHUMI, 406); //Humidity
for (int i = 0; i < NUM_DAYS; i++)
{
SET_CONTROL_LABEL(CONTROL_LABELD0DAY + (i*10), g_weatherManager.m_dfForcast[i].m_szDay);
SET_CONTROL_LABEL(CONTROL_LABELD0HI + (i*10), g_weatherManager.m_dfForcast[i].m_szHigh + g_langInfo.GetTempUnitString());
SET_CONTROL_LABEL(CONTROL_LABELD0LOW + (i*10), g_weatherManager.m_dfForcast[i].m_szLow + g_langInfo.GetTempUnitString());
SET_CONTROL_LABEL(CONTROL_LABELD0GEN + (i*10), g_weatherManager.m_dfForcast[i].m_szOverview);
pImage = (CGUIImage *)GetControl(CONTROL_IMAGED0IMG + (i * 10));
if (pImage) pImage->SetFileName(g_weatherManager.m_dfForcast[i].m_szIcon);
}
}
void CGUIWindowWeather::FrameMove()
......
{
// Current weather
SetProperty("Location", g_weatherManager.GetLocation(m_iCurWeather));
SetProperty("LocationIndex", int(m_iCurWeather + 1));
CStdString strSetting;
strSetting.Format("weather.areacode%i", m_iCurWeather + 1);
SetProperty("AreaCode", g_weatherManager.GetAreaCode(g_guiSettings.GetString(strSetting)));
SetProperty("Updated", g_weatherManager.GetLastUpdateTime());
SetProperty("Current.ConditionIcon", g_weatherManager.GetInfo(WEATHER_IMAGE_CURRENT_ICON));
SetProperty("Current.Condition", g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_COND));
SetProperty("Current.Temperature", g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_TEMP));
SetProperty("Current.FeelsLike", g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_FEEL));
SetProperty("Current.UVIndex", g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_UVID));
SetProperty("Current.Wind", g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_WIND));
SetProperty("Current.DewPoint", g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_DEWP));
SetProperty("Current.Humidity", g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_HUMI));
// we use the icons code number for fanart as it's the safest way
CStdString fanartcode = CUtil::GetFileName(g_weatherManager.GetInfo(WEATHER_IMAGE_CURRENT_ICON));
CUtil::RemoveExtension(fanartcode);
SetProperty("Current.FanartCode", fanartcode);
// Future weather
CStdString day;
for (int i = 0; i < NUM_DAYS; i++)
{
day.Format("Day%i.", i);
SetProperty(day + "Title", g_weatherManager.m_dfForcast[i].m_szDay);
SetProperty(day + "HighTemp", g_weatherManager.m_dfForcast[i].m_szHigh);
SetProperty(day + "LowTemp", g_weatherManager.m_dfForcast[i].m_szLow);
SetProperty(day + "Outlook", g_weatherManager.m_dfForcast[i].m_szOverview);
SetProperty(day + "OutlookIcon", g_weatherManager.m_dfForcast[i].m_szIcon);
fanartcode = CUtil::GetFileName(g_weatherManager.m_dfForcast[i].m_szIcon);
CUtil::RemoveExtension(fanartcode);
SetProperty(day + "FanartCode", fanartcode);
}
SetProperty("Location.Index", int(m_iCurWeather + 1));
}
void CGUIWindowWeather::CallPlugin()
{
if (!g_guiSettings.GetString("weather.plugin").IsEmpty())
{
// create the full path to the plugin
CStdString plugin = "special://home/plugins/weather/" + g_guiSettings.GetString("weather.plugin") + "/default.py";
SetProperty("Weather.IsFetched", false);
// initialize our sys.argv variables
unsigned int argc = 2;
char ** argv = new char*[argc];
argv[0] = (char*)plugin.c_str();
if (g_guiSettings.GetString("weather.plugin").IsEmpty()) return;
// if plugin is running we wait for another timeout only when in weather window
if (g_windowManager.GetActiveWindow() == WINDOW_WEATHER)
// create the full path to the plugin
CStdString plugin = "special://home/plugins/weather/" + g_guiSettings.GetString("weather.plugin") + "/default.py";
// initialize our sys.argv variables
unsigned int argc = 3;
char ** argv = new char*[argc];
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)
{
int id = g_pythonParser.getScriptId(argv[0]);
if (id != -1 && g_pythonParser.isRunning(id))
{
int id = g_pythonParser.getScriptId(argv[0]);
if (id != -1 && g_pythonParser.isRunning(id))
{
m_pluginTimer.StartZero();
return;
}
m_pluginTimer.StartZero();
return;
}
}
// get the current locations area code
CStdString strSetting;
strSetting.Format("weather.areacode%i", m_iCurWeather + 1);
const CStdString &areacode = g_weatherManager.GetAreaCode(g_guiSettings.GetString(strSetting));
argv[1] = (char*)areacode.c_str();
// get the current locations area code
CStdString strSetting;
strSetting.Format("%i", m_iCurWeather + 1);
argv[1] = (char*)strSetting.c_str();
argv[2] = (char*)(forceRefresh ? "1" : "0");
// call our plugin, passing the areacode
g_pythonParser.evalFile(argv[0], argc, (const char**)argv);
CLog::Log(LOGDEBUG, "%s - Weather plugin called: %s (%s)", __FUNCTION__, argv[0], argv[1]);
}
// call our plugin, passing the areacode
g_pythonParser.evalFile(argv[0], argc, (const char**)argv);
CLog::Log(LOGDEBUG, "%s - Weather plugin called: %s (%s)", __FUNCTION__, argv[0], argv[1]);
forceRefresh = false;
}
xbmc/Settings.h (working copy)
#define PRE_SKIN_VERSION_9_10_COMPATIBILITY 1
#define DEFAULT_SKIN "Project Mayhem III"
#define DEFAULT_WEATHER_PLUGIN "Weather.com (standard)"
#include "settings/VideoSettings.h"
#include "GUISettings.h"
xbmc/utils/Weather.cpp (working copy)
#include "GUIDialogSelect.h"
#include "DateTime.h"
#include "FileSystem/Directory.h"
#include "ScriptSettings.h"
#include "GUIDialogPluginSettings.h"
using namespace std;
using namespace DIRECTORY;
......
#define PARTNER_ID "1004124588" //weather.com partner id
#define PARTNER_KEY "079f24145f208494" //weather.com partner key
#define MAX_LOCATION 3
#define MAX_LOCATION 10
#define LOCALIZED_TOKEN_FIRSTID 370
#define LOCALIZED_TOKEN_LASTID 395
#define LOCALIZED_TOKEN_FIRSTID2 1396
......
*/
// USE THESE FOR ZIP
//#define WEATHER_BASE_PATH "Z:\\weather\\"
//#define WEATHER_USE_ZIP 1
//#define WEATHER_USE_RAR 0
//#define WEATHER_BASE_PATH "special://temp/weather/"
//#define WEATHER_SOURCE_FILE "special://xbmc/media/weather.zip"
// OR THESE FOR RAR
......
void CBackgroundWeatherLoader::GetInformation()
{
if (!g_network.IsAvailable())
return;
//if (!g_network.IsAvailable())
// return;
CWeather *callback = (CWeather *)m_callback;
//CWeather *callback = (CWeather *)m_callback;
/*
// Download our weather
CLog::Log(LOGINFO, "WEATHER: Downloading weather");
XFILE::CFileCurl httpUtil;
......
}
else
CLog::Log(LOGERROR, "WEATHER: Weather download failed!");
*/
}
CWeather::CWeather(void) : CInfoLoader("weather")
......
}
DWORD CWeather::TimeToNextRefreshInMs()
{ // 30 minutes
return 30 * 60 * 1000;
{ // 15 minutes
return 15 * 60 * 1000;
}
CStdString CWeather::GetAreaCity(const CStdString &codeAndCity) const
......
{
if (strlen(m_szLocation[iLocation]) == 0)
{
CStdString cScriptPath = "special://home/plugins/weather/" + g_guiSettings.GetString("weather.plugin");
CScriptSettings* settings = new CScriptSettings();
settings->Clear();
settings->Load(cScriptPath);
CStdString setting;
setting.Format("weather.areacode%i", iLocation + 1);
strcpy(m_szLocation[iLocation], GetAreaCity(g_guiSettings.GetString(setting)).c_str());
setting.Format("town%i", iLocation + 1);
strcpy(m_szLocation[iLocation], settings->Get(setting).c_str());
}
return m_szLocation[iLocation];
}
unsigned int CWeather::GetMaxLocations()
{
if (m_MaxLocations == -1)
{
CStdString cScriptPath = "special://home/plugins/weather/" + g_guiSettings.GetString("weather.plugin");
CScriptSettings* settings = new CScriptSettings();
settings->Clear();
settings->Load(cScriptPath);
m_MaxLocations = atoi(settings->Get("maxlocations")) + 1;
}
return m_MaxLocations;
}
void CWeather::Reset()
{
strcpy(m_szLastUpdateTime, "");
......
{
strcpy(m_szLocation[i], "");
}
m_MaxLocations = -1;
}
bool CWeather::IsFetched()
xbmc/utils/Weather.h (working copy)
int GetArea() const { return m_iCurWeather; };
CStdString GetAreaCode(const CStdString &codeAndCity) const;
CStdString GetAreaCity(const CStdString &codeAndCity) const;
unsigned int GetMaxLocations();
day_forcast m_dfForcast[NUM_DAYS];
bool m_bImagesOkay;
......
std::map<CStdString, int> m_localizedTokens;
typedef std::map<CStdString, int>::const_iterator ilocalizedTokens;
char m_szLocation[3][100];
char m_szLocation[10][100];
// Last updated
char m_szLastUpdateTime[256];
......
char m_szNAIcon[256];
unsigned int m_iCurWeather;
int m_MaxLocations;
};
extern CWeather g_weatherManager;
(1-1/13)