changed: don't include event.h in stdafx.h
[xbmc:xbmc-antiquated.git] / xbmc / utils / GUIInfoManager.cpp
1 /*
2  *      Copyright (C) 2005-2008 Team XBMC
3  *      http://www.xbmc.org
4  *
5  *  This Program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This Program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with XBMC; see the file COPYING.  If not, write to
17  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18  *  http://www.gnu.org/copyleft/gpl.html
19  *
20  */
21
22 #include "stdafx.h"
23 #include "GUIDialogSeekBar.h"
24 #include "GUIMediaWindow.h"
25 #include "GUIDialogFileBrowser.h"
26 #include "GUIDialogContentSettings.h"
27 #include "GUIDialogProgress.h"
28 #include "Application.h"
29 #include "Util.h"
30 #include "lib/libscrobbler/lastfmscrobbler.h"
31 #include "Weather.h"
32 #include "PlayListPlayer.h"
33 #include "PartyModeManager.h"
34 #include "visualizations/Visualisation.h"
35 #include "ButtonTranslator.h"
36 #include "MusicDatabase.h"
37 #include "utils/AlarmClock.h"
38 #ifdef HAS_LCD
39 #include "utils/LCD.h"
40 #endif
41 #include "GUIPassword.h"
42 #include "LangInfo.h"
43 #include "SystemInfo.h"
44 #include "GUIButtonScroller.h"
45 #include "GUIInfoManager.h"
46 #include <stack>
47 #include "../utils/Network.h"
48 #include "GUIWindowSlideShow.h"
49 #include "LastFmManager.h"
50 #include "PictureInfoTag.h"
51 #include "MusicInfoTag.h"
52 #include "VideoDatabase.h"
53 #include "GUIDialogMusicScan.h"
54 #include "GUIDialogVideoScan.h"
55 #include "GUIWindowManager.h"
56 #include "FileSystem/File.h"
57 #include "PlayList.h"
58 #include "TuxBoxUtil.h"
59 #include "WindowingFactory.h"
60 #include "PowerManager.h"
61 #include "AdvancedSettings.h"
62 #include "Settings.h"
63 #include "LocalizeStrings.h"
64
65 // stuff for current song
66 #include "MusicInfoTagLoaderFactory.h"
67 #include "MusicInfoLoader.h"
68 #include "LabelFormatter.h"
69
70 #include "GUILabelControl.h"  // for CInfoLabel
71 #include "GUITextBox.h"
72 #include "GUIWindowVideoInfo.h"
73 #include "GUIWindowMusicInfo.h"
74 #include "SkinInfo.h"
75 #include "MediaManager.h"
76
77 #define SYSHEATUPDATEINTERVAL 60000
78
79 using namespace std;
80 using namespace XFILE;
81 using namespace DIRECTORY;
82 using namespace MUSIC_INFO;
83
84 CGUIInfoManager g_infoManager;
85
86 CGUIInfoManager::CCombinedValue& CGUIInfoManager::CCombinedValue::operator =(const CGUIInfoManager::CCombinedValue& mSrc)
87 {
88   this->m_info = mSrc.m_info;
89   this->m_id = mSrc.m_id;
90   this->m_postfix = mSrc.m_postfix;
91   return *this;
92 }
93
94 CGUIInfoManager::CGUIInfoManager(void)
95 {
96   m_lastSysHeatInfoTime = -SYSHEATUPDATEINTERVAL;  // make sure we grab CPU temp on the first pass
97   m_lastMusicBitrateTime = 0;
98   m_fanSpeed = 0;
99   m_AfterSeekTimeout = 0;
100   m_playerSeeking = false;
101   m_performingSeek = false;
102   m_nextWindowID = WINDOW_INVALID;
103   m_prevWindowID = WINDOW_INVALID;
104   m_stringParameters.push_back("__ZZZZ__");   // to offset the string parameters by 1 to assure that all entries are non-zero
105   m_currentFile = new CFileItem;
106   m_currentSlide = new CFileItem;
107   m_frameCounter = 0;
108   m_lastFPSTime = 0;
109   ResetLibraryBools();
110 }
111
112 CGUIInfoManager::~CGUIInfoManager(void)
113 {
114   delete m_currentFile;
115   delete m_currentSlide;
116 }
117
118 bool CGUIInfoManager::OnMessage(CGUIMessage &message)
119 {
120   if (message.GetMessage() == GUI_MSG_NOTIFY_ALL)
121   {
122     if (message.GetParam1() == GUI_MSG_UPDATE_ITEM && message.GetItem())
123     {
124       CFileItemPtr item = boost::static_pointer_cast<CFileItem>(message.GetItem());
125       if (item && m_currentFile->m_strPath.Equals(item->m_strPath))
126         *m_currentFile = *item;
127       return true;
128     }
129   }
130   return false;
131 }
132
133 /// \brief Translates a string as given by the skin into an int that we use for more
134 /// efficient retrieval of data. Can handle combined strings on the form
135 /// Player.Caching + VideoPlayer.IsFullscreen (Logical and)
136 /// Player.HasVideo | Player.HasAudio (Logical or)
137 int CGUIInfoManager::TranslateString(const CStdString &strCondition)
138 {
139   if (strCondition.find_first_of("|") != strCondition.npos ||
140       strCondition.find_first_of("+") != strCondition.npos ||
141       strCondition.find_first_of("[") != strCondition.npos ||
142       strCondition.find_first_of("]") != strCondition.npos)
143   {
144     // Have a boolean expression
145     // Check if this was added before
146     vector<CCombinedValue>::iterator it;
147     for(it = m_CombinedValues.begin(); it != m_CombinedValues.end(); it++)
148     {
149       if(strCondition.CompareNoCase(it->m_info) == 0)
150         return it->m_id;
151     }
152     return TranslateBooleanExpression(strCondition);
153   }
154   //Just single command.
155   return TranslateSingleString(strCondition);
156 }
157
158
159 /// \brief Translates a string as given by the skin into an int that we use for more
160 /// efficient retrieval of data.
161 int CGUIInfoManager::TranslateSingleString(const CStdString &strCondition)
162 {
163   // trim whitespace, and convert to lowercase
164   CStdString strTest = strCondition;
165   strTest.ToLower();
166   strTest.TrimLeft(" \t\r\n");
167   strTest.TrimRight(" \t\r\n");
168   if (strTest.IsEmpty()) return 0;
169
170   bool bNegate = strTest[0] == '!';
171   int ret = 0;
172
173   if(bNegate)
174     strTest.Delete(0, 1);
175
176   CStdString strCategory = strTest.Left(strTest.Find("."));
177
178   // translate conditions...
179   if (strTest.Equals("false") || strTest.Equals("no") || strTest.Equals("off")) ret = SYSTEM_ALWAYS_FALSE;
180   else if (strTest.Equals("true") || strTest.Equals("yes") || strTest.Equals("on")) ret = SYSTEM_ALWAYS_TRUE;
181   if (strCategory.Equals("player"))
182   {
183     if (strTest.Equals("player.hasmedia")) ret = PLAYER_HAS_MEDIA;
184     else if (strTest.Equals("player.hasaudio")) ret = PLAYER_HAS_AUDIO;
185     else if (strTest.Equals("player.hasvideo")) ret = PLAYER_HAS_VIDEO;
186     else if (strTest.Equals("player.playing")) ret = PLAYER_PLAYING;
187     else if (strTest.Equals("player.paused")) ret = PLAYER_PAUSED;
188     else if (strTest.Equals("player.rewinding")) ret = PLAYER_REWINDING;
189     else if (strTest.Equals("player.forwarding")) ret = PLAYER_FORWARDING;
190     else if (strTest.Equals("player.rewinding2x")) ret = PLAYER_REWINDING_2x;
191     else if (strTest.Equals("player.rewinding4x")) ret = PLAYER_REWINDING_4x;
192     else if (strTest.Equals("player.rewinding8x")) ret = PLAYER_REWINDING_8x;
193     else if (strTest.Equals("player.rewinding16x")) ret = PLAYER_REWINDING_16x;
194     else if (strTest.Equals("player.rewinding32x")) ret = PLAYER_REWINDING_32x;
195     else if (strTest.Equals("player.forwarding2x")) ret = PLAYER_FORWARDING_2x;
196     else if (strTest.Equals("player.forwarding4x")) ret = PLAYER_FORWARDING_4x;
197     else if (strTest.Equals("player.forwarding8x")) ret = PLAYER_FORWARDING_8x;
198     else if (strTest.Equals("player.forwarding16x")) ret = PLAYER_FORWARDING_16x;
199     else if (strTest.Equals("player.forwarding32x")) ret = PLAYER_FORWARDING_32x;
200     else if (strTest.Equals("player.canrecord")) ret = PLAYER_CAN_RECORD;
201     else if (strTest.Equals("player.recording")) ret = PLAYER_RECORDING;
202     else if (strTest.Equals("player.displayafterseek")) ret = PLAYER_DISPLAY_AFTER_SEEK;
203     else if (strTest.Equals("player.caching")) ret = PLAYER_CACHING;
204     else if (strTest.Equals("player.cachelevel")) ret = PLAYER_CACHELEVEL;
205     else if (strTest.Equals("player.seekbar")) ret = PLAYER_SEEKBAR;
206     else if (strTest.Equals("player.progress")) ret = PLAYER_PROGRESS;
207     else if (strTest.Equals("player.seeking")) ret = PLAYER_SEEKING;
208     else if (strTest.Equals("player.showtime")) ret = PLAYER_SHOWTIME;
209     else if (strTest.Equals("player.showcodec")) ret = PLAYER_SHOWCODEC;
210     else if (strTest.Equals("player.showinfo")) ret = PLAYER_SHOWINFO;
211     else if (strTest.Left(15).Equals("player.seektime")) return AddMultiInfo(GUIInfo(PLAYER_SEEKTIME, TranslateTimeFormat(strTest.Mid(15))));
212     else if (strTest.Left(20).Equals("player.timeremaining")) return AddMultiInfo(GUIInfo(PLAYER_TIME_REMAINING, TranslateTimeFormat(strTest.Mid(20))));
213     else if (strTest.Left(16).Equals("player.timespeed")) return AddMultiInfo(GUIInfo(PLAYER_TIME_SPEED, TranslateTimeFormat(strTest.Mid(16))));
214     else if (strTest.Left(11).Equals("player.time")) return AddMultiInfo(GUIInfo(PLAYER_TIME, TranslateTimeFormat(strTest.Mid(11))));
215     else if (strTest.Left(15).Equals("player.duration")) return AddMultiInfo(GUIInfo(PLAYER_DURATION, TranslateTimeFormat(strTest.Mid(15))));
216     else if (strTest.Left(17).Equals("player.finishtime")) return AddMultiInfo(GUIInfo(PLAYER_FINISH_TIME, TranslateTimeFormat(strTest.Mid(17))));
217     else if (strTest.Equals("player.volume")) ret = PLAYER_VOLUME;
218     else if (strTest.Equals("player.subtitledelay")) ret = PLAYER_SUBTITLE_DELAY;
219     else if (strTest.Equals("player.audiodelay")) ret = PLAYER_AUDIO_DELAY;
220     else if (strTest.Equals("player.muted")) ret = PLAYER_MUTED;
221     else if (strTest.Equals("player.hasduration")) ret = PLAYER_HASDURATION;
222     else if (strTest.Equals("player.chapter")) ret = PLAYER_CHAPTER;
223     else if (strTest.Equals("player.chaptercount")) ret = PLAYER_CHAPTERCOUNT;
224     else if (strTest.Equals("player.chaptername")) ret = PLAYER_CHAPTERNAME;
225     else if (strTest.Equals("player.starrating")) ret = PLAYER_STAR_RATING;
226     else if (strTest.Equals("player.passthrough")) ret = PLAYER_PASSTHROUGH;
227   }
228   else if (strCategory.Equals("weather"))
229   {
230     if (strTest.Equals("weather.conditions")) ret = WEATHER_CONDITIONS;
231     else if (strTest.Equals("weather.temperature")) ret = WEATHER_TEMPERATURE;
232     else if (strTest.Equals("weather.location")) ret = WEATHER_LOCATION;
233     else if (strTest.Equals("weather.isfetched")) ret = WEATHER_IS_FETCHED;
234     else if (strTest.Equals("weather.fanartcode")) ret = WEATHER_FANART_CODE;
235     else if (strTest.Equals("weather.plugin")) ret = WEATHER_PLUGIN;
236   }
237   else if (strCategory.Equals("bar"))
238   {
239     if (strTest.Equals("bar.gputemperature")) ret = SYSTEM_GPU_TEMPERATURE;
240     else if (strTest.Equals("bar.cputemperature")) ret = SYSTEM_CPU_TEMPERATURE;
241     else if (strTest.Equals("bar.cpuusage")) ret = SYSTEM_CPU_USAGE;
242     else if (strTest.Equals("bar.freememory")) ret = SYSTEM_FREE_MEMORY;
243     else if (strTest.Equals("bar.usedmemory")) ret = SYSTEM_USED_MEMORY;
244     else if (strTest.Equals("bar.fanspeed")) ret = SYSTEM_FAN_SPEED;
245     else if (strTest.Equals("bar.usedspace")) ret = SYSTEM_USED_SPACE;
246     else if (strTest.Equals("bar.freespace")) ret = SYSTEM_FREE_SPACE;
247     else if (strTest.Equals("bar.usedspace(c)")) ret = SYSTEM_USED_SPACE_C;
248     else if (strTest.Equals("bar.freespace(c)")) ret = SYSTEM_FREE_SPACE_C;
249     else if (strTest.Equals("bar.usedspace(e)")) ret = SYSTEM_USED_SPACE_E;
250     else if (strTest.Equals("bar.freespace(e)")) ret = SYSTEM_FREE_SPACE_E;
251     else if (strTest.Equals("bar.usedspace(f)")) ret = SYSTEM_USED_SPACE_F;
252     else if (strTest.Equals("bar.freespace(f)")) ret = SYSTEM_FREE_SPACE_F;
253     else if (strTest.Equals("bar.usedspace(g)")) ret = SYSTEM_USED_SPACE_G;
254     else if (strTest.Equals("bar.freespace(g)")) ret = SYSTEM_FREE_SPACE_G;
255     else if (strTest.Equals("bar.usedspace(x)")) ret = SYSTEM_USED_SPACE_X;
256     else if (strTest.Equals("bar.freespace(x)")) ret = SYSTEM_FREE_SPACE_X;
257     else if (strTest.Equals("bar.usedspace(y)")) ret = SYSTEM_USED_SPACE_Y;
258     else if (strTest.Equals("bar.freespace(y)")) ret = SYSTEM_FREE_SPACE_Y;
259     else if (strTest.Equals("bar.usedspace(z)")) ret = SYSTEM_USED_SPACE_Z;
260     else if (strTest.Equals("bar.freespace(z)")) ret = SYSTEM_FREE_SPACE_Z;
261     else if (strTest.Equals("bar.hddtemperature")) ret = SYSTEM_HDD_TEMPERATURE;
262   }
263   else if (strCategory.Equals("system"))
264   {
265     if (strTest.Equals("system.date")) ret = SYSTEM_DATE;
266     else if (strTest.Left(12).Equals("system.date("))
267     {
268       // the skin must submit the date in the format MM-DD
269       // This InfoBool is designed for generic range checking, so year is NOT used.  Only Month-Day.
270       CStdString param = strTest.Mid(12, strTest.length() - 13);
271       CStdStringArray params;
272       StringUtils::SplitString(param, ",", params);
273       if (params.size() == 2)
274         return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_DATE : SYSTEM_DATE, StringUtils::DateStringToYYYYMMDD(params[0]) % 10000, StringUtils::DateStringToYYYYMMDD(params[1]) % 10000));
275       else if (params.size() == 1)
276         return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_DATE : SYSTEM_DATE, StringUtils::DateStringToYYYYMMDD(params[0]) % 10000));
277     }
278     else if (strTest.Left(11).Equals("system.time"))
279     {
280       // determine if this is a System.Time(TIME_FORMAT) infolabel or a System.Time(13:00,14:00) boolean based on the contents of the param
281       // essentially if it isn't a valid TIME_FORMAT then its considered to be the latter.
282       CStdString param = strTest.Mid(11);
283       TIME_FORMAT timeFormat = TranslateTimeFormat(param);
284       if ((timeFormat == TIME_FORMAT_GUESS) && (!param.IsEmpty()))
285       {
286         param = strTest.Mid(12, strTest.length() - 13);
287         CStdStringArray params;
288         StringUtils::SplitString(param, ",", params);
289         if (params.size() == 2)
290           return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_TIME : SYSTEM_TIME, StringUtils::TimeStringToSeconds(params[0]), StringUtils::TimeStringToSeconds(params[1])));
291         else if (params.size() == 1)
292           return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_TIME : SYSTEM_TIME, StringUtils::TimeStringToSeconds(params[0])));
293       }
294       else
295         return AddMultiInfo(GUIInfo(SYSTEM_TIME, timeFormat));
296     }
297     else if (strTest.Equals("system.cputemperature")) ret = SYSTEM_CPU_TEMPERATURE;
298     else if (strTest.Equals("system.cpuusage")) ret = SYSTEM_CPU_USAGE;
299     else if (strTest.Equals("system.gputemperature")) ret = SYSTEM_GPU_TEMPERATURE;
300     else if (strTest.Equals("system.fanspeed")) ret = SYSTEM_FAN_SPEED;
301     else if (strTest.Equals("system.freespace")) ret = SYSTEM_FREE_SPACE;
302     else if (strTest.Equals("system.usedspace")) ret = SYSTEM_USED_SPACE;
303     else if (strTest.Equals("system.totalspace")) ret = SYSTEM_TOTAL_SPACE;
304     else if (strTest.Equals("system.usedspacepercent")) ret = SYSTEM_USED_SPACE_PERCENT;
305     else if (strTest.Equals("system.freespacepercent")) ret = SYSTEM_FREE_SPACE_PERCENT;
306     else if (strTest.Equals("system.freespace(c)")) ret = SYSTEM_FREE_SPACE_C;
307     else if (strTest.Equals("system.usedspace(c)")) ret = SYSTEM_USED_SPACE_C;
308     else if (strTest.Equals("system.totalspace(c)")) ret = SYSTEM_TOTAL_SPACE_C;
309     else if (strTest.Equals("system.usedspacepercent(c)")) ret = SYSTEM_USED_SPACE_PERCENT_C;
310     else if (strTest.Equals("system.freespacepercent(c)")) ret = SYSTEM_FREE_SPACE_PERCENT_C;
311     else if (strTest.Equals("system.freespace(e)")) ret = SYSTEM_FREE_SPACE_E;
312     else if (strTest.Equals("system.usedspace(e)")) ret = SYSTEM_USED_SPACE_E;
313     else if (strTest.Equals("system.totalspace(e)")) ret = SYSTEM_TOTAL_SPACE_E;
314     else if (strTest.Equals("system.usedspacepercent(e)")) ret = SYSTEM_USED_SPACE_PERCENT_E;
315     else if (strTest.Equals("system.freespacepercent(e)")) ret = SYSTEM_FREE_SPACE_PERCENT_E;
316     else if (strTest.Equals("system.freespace(f)")) ret = SYSTEM_FREE_SPACE_F;
317     else if (strTest.Equals("system.usedspace(f)")) ret = SYSTEM_USED_SPACE_F;
318     else if (strTest.Equals("system.totalspace(f)")) ret = SYSTEM_TOTAL_SPACE_F;
319     else if (strTest.Equals("system.usedspacepercent(f)")) ret = SYSTEM_USED_SPACE_PERCENT_F;
320     else if (strTest.Equals("system.freespacepercent(f)")) ret = SYSTEM_FREE_SPACE_PERCENT_F;
321     else if (strTest.Equals("system.freespace(g)")) ret = SYSTEM_FREE_SPACE_G;
322     else if (strTest.Equals("system.usedspace(g)")) ret = SYSTEM_USED_SPACE_G;
323     else if (strTest.Equals("system.totalspace(g)")) ret = SYSTEM_TOTAL_SPACE_G;
324     else if (strTest.Equals("system.usedspacepercent(g)")) ret = SYSTEM_USED_SPACE_PERCENT_G;
325     else if (strTest.Equals("system.freespacepercent(g)")) ret = SYSTEM_FREE_SPACE_PERCENT_G;
326     else if (strTest.Equals("system.usedspace(x)")) ret = SYSTEM_USED_SPACE_X;
327     else if (strTest.Equals("system.freespace(x)")) ret = SYSTEM_FREE_SPACE_X;
328     else if (strTest.Equals("system.totalspace(x)")) ret = SYSTEM_TOTAL_SPACE_X;
329     else if (strTest.Equals("system.usedspace(y)")) ret = SYSTEM_USED_SPACE_Y;
330     else if (strTest.Equals("system.freespace(y)")) ret = SYSTEM_FREE_SPACE_Y;
331     else if (strTest.Equals("system.totalspace(y)")) ret = SYSTEM_TOTAL_SPACE_Y;
332     else if (strTest.Equals("system.usedspace(z)")) ret = SYSTEM_USED_SPACE_Z;
333     else if (strTest.Equals("system.freespace(z)")) ret = SYSTEM_FREE_SPACE_Z;
334     else if (strTest.Equals("system.totalspace(z)")) ret = SYSTEM_TOTAL_SPACE_Z;
335     else if (strTest.Equals("system.buildversion")) ret = SYSTEM_BUILD_VERSION;
336     else if (strTest.Equals("system.builddate")) ret = SYSTEM_BUILD_DATE;
337     else if (strTest.Equals("system.hasnetwork")) ret = SYSTEM_ETHERNET_LINK_ACTIVE;
338     else if (strTest.Equals("system.fps")) ret = SYSTEM_FPS;
339     else if (strTest.Equals("system.hasmediadvd")) ret = SYSTEM_MEDIA_DVD;
340     else if (strTest.Equals("system.dvdready")) ret = SYSTEM_DVDREADY;
341     else if (strTest.Equals("system.trayopen")) ret = SYSTEM_TRAYOPEN;
342     else if (strTest.Equals("system.dvdtraystate")) ret = SYSTEM_DVD_TRAY_STATE;
343
344     else if (strTest.Equals("system.memory(free)") || strTest.Equals("system.freememory")) ret = SYSTEM_FREE_MEMORY;
345     else if (strTest.Equals("system.memory(free.percent)")) ret = SYSTEM_FREE_MEMORY_PERCENT;
346     else if (strTest.Equals("system.memory(used)")) ret = SYSTEM_USED_MEMORY;
347     else if (strTest.Equals("system.memory(used.percent)")) ret = SYSTEM_USED_MEMORY_PERCENT;
348     else if (strTest.Equals("system.memory(total)")) ret = SYSTEM_TOTAL_MEMORY;
349
350     else if (strTest.Equals("system.language")) ret = SYSTEM_LANGUAGE;
351     else if (strTest.Equals("system.temperatureunits")) ret = SYSTEM_TEMPERATURE_UNITS;
352     else if (strTest.Equals("system.screenmode")) ret = SYSTEM_SCREEN_MODE;
353     else if (strTest.Equals("system.screenwidth")) ret = SYSTEM_SCREEN_WIDTH;
354     else if (strTest.Equals("system.screenheight")) ret = SYSTEM_SCREEN_HEIGHT;
355     else if (strTest.Equals("system.currentwindow")) ret = SYSTEM_CURRENT_WINDOW;
356     else if (strTest.Equals("system.currentcontrol")) ret = SYSTEM_CURRENT_CONTROL;
357     else if (strTest.Equals("system.dvdlabel")) ret = SYSTEM_DVD_LABEL;
358     else if (strTest.Equals("system.haslocks")) ret = SYSTEM_HASLOCKS;
359     else if (strTest.Equals("system.hasloginscreen")) ret = SYSTEM_HAS_LOGINSCREEN;
360     else if (strTest.Equals("system.ismaster")) ret = SYSTEM_ISMASTER;
361     else if (strTest.Equals("system.internetstate")) ret = SYSTEM_INTERNET_STATE;
362     else if (strTest.Equals("system.loggedon")) ret = SYSTEM_LOGGEDON;
363     else if (strTest.Equals("system.hasdrivef")) ret = SYSTEM_HAS_DRIVE_F;
364     else if (strTest.Equals("system.hasdriveg")) ret = SYSTEM_HAS_DRIVE_G;
365     else if (strTest.Equals("system.kernelversion")) ret = SYSTEM_KERNEL_VERSION;
366     else if (strTest.Equals("system.uptime")) ret = SYSTEM_UPTIME;
367     else if (strTest.Equals("system.totaluptime")) ret = SYSTEM_TOTALUPTIME;
368     else if (strTest.Equals("system.cpufrequency")) ret = SYSTEM_CPUFREQUENCY;
369     else if (strTest.Equals("system.screenresolution")) ret = SYSTEM_SCREEN_RESOLUTION;
370     else if (strTest.Equals("system.videoencoderinfo")) ret = SYSTEM_VIDEO_ENCODER_INFO;
371     else if (strTest.Left(16).Equals("system.idletime("))
372     {
373       int time = atoi((strTest.Mid(16, strTest.GetLength() - 17).c_str()));
374       if (time > SYSTEM_IDLE_TIME_FINISH - SYSTEM_IDLE_TIME_START)
375         time = SYSTEM_IDLE_TIME_FINISH - SYSTEM_IDLE_TIME_START;
376       if (time > 0)
377         ret = SYSTEM_IDLE_TIME_START + time;
378     }
379     else if (strTest.Left(16).Equals("system.hasalarm("))
380       return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_HAS_ALARM : SYSTEM_HAS_ALARM, ConditionalStringParameter(strTest.Mid(16,strTest.size()-17)), 0));
381     else if (strTest.Equals("system.alarmpos")) ret = SYSTEM_ALARM_POS;
382   else if (strTest.Left(24).Equals("system.alarmlessorequal("))
383   {
384     int pos = strTest.Find(",");
385     int skinOffset = ConditionalStringParameter(strTest.Mid(24, pos-24));
386     int compareString = ConditionalStringParameter(strTest.Mid(pos + 1, strTest.GetLength() - (pos + 2)));
387     return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_ALARM_LESS_OR_EQUAL: SYSTEM_ALARM_LESS_OR_EQUAL, skinOffset, compareString));
388   }
389     else if (strTest.Equals("system.profilename")) ret = SYSTEM_PROFILENAME;
390     else if (strTest.Equals("system.profilethumb")) ret = SYSTEM_PROFILETHUMB;
391     else if (strTest.Equals("system.progressbar")) ret = SYSTEM_PROGRESS_BAR;
392     else if (strTest.Equals("system.platform.linux")) ret = SYSTEM_PLATFORM_LINUX;
393     else if (strTest.Equals("system.platform.xbox")) ret = SYSTEM_PLATFORM_XBOX;
394     else if (strTest.Equals("system.platform.windows")) ret = SYSTEM_PLATFORM_WINDOWS;
395     else if (strTest.Equals("system.platform.osx")) ret = SYSTEM_PLATFORM_OSX;
396     else if (strTest.Left(15).Equals("system.getbool("))
397       return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_GET_BOOL : SYSTEM_GET_BOOL, ConditionalStringParameter(strTest.Mid(15,strTest.size()-16)), 0));
398     else if (strTest.Left(17).Equals("system.coreusage("))
399       return AddMultiInfo(GUIInfo(SYSTEM_GET_CORE_USAGE, atoi(strTest.Mid(17,strTest.size()-18)), 0));
400     else if (strTest.Left(17).Equals("system.hascoreid("))
401       return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_HAS_CORE_ID : SYSTEM_HAS_CORE_ID, ConditionalStringParameter(strTest.Mid(17,strTest.size()-18)), 0));
402     else if (strTest.Left(15).Equals("system.setting("))
403       return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_SETTING : SYSTEM_SETTING, ConditionalStringParameter(strTest.Mid(15,strTest.size()-16)), 0));
404     else if (strTest.Equals("system.canpowerdown")) ret = SYSTEM_CAN_POWERDOWN;
405     else if (strTest.Equals("system.cansuspend"))   ret = SYSTEM_CAN_SUSPEND;
406     else if (strTest.Equals("system.canhibernate")) ret = SYSTEM_CAN_HIBERNATE;
407     else if (strTest.Equals("system.canreboot"))    ret = SYSTEM_CAN_REBOOT;
408   }
409   // library test conditions
410   else if (strTest.Left(7).Equals("library"))
411   {
412     if (strTest.Equals("library.hascontent(music)")) ret = LIBRARY_HAS_MUSIC;
413     else if (strTest.Equals("library.hascontent(video)")) ret = LIBRARY_HAS_VIDEO;
414     else if (strTest.Equals("library.hascontent(movies)")) ret = LIBRARY_HAS_MOVIES;
415     else if (strTest.Equals("library.hascontent(tvshows)")) ret = LIBRARY_HAS_TVSHOWS;
416     else if (strTest.Equals("library.hascontent(musicvideos)")) ret = LIBRARY_HAS_MUSICVIDEOS;
417     else if (strTest.Equals("library.isscanning")) ret = LIBRARY_IS_SCANNING;
418   }
419   else if (strTest.Left(8).Equals("isempty("))
420   {
421     CStdString str = strTest.Mid(8, strTest.GetLength() - 9);
422     return AddMultiInfo(GUIInfo(bNegate ? -STRING_IS_EMPTY : STRING_IS_EMPTY, TranslateSingleString(str)));
423   }
424   else if (strTest.Left(14).Equals("stringcompare("))
425   {
426     int pos = strTest.Find(",");
427     int skinOffset = TranslateString(strTest.Mid(14, pos-14));
428     int compareString = ConditionalStringParameter(strTest.Mid(pos + 1, strTest.GetLength() - (pos + 2)));
429     return AddMultiInfo(GUIInfo(bNegate ? -STRING_COMPARE: STRING_COMPARE, skinOffset, compareString));
430   }
431   else if (strTest.Left(10).Equals("substring("))
432   {
433     int pos = strTest.Find(",");
434     int skinOffset = TranslateString(strTest.Mid(10, pos-10));
435     int compareString = ConditionalStringParameter(strTest.Mid(pos + 1, strTest.GetLength() - (pos + 2)));
436     return AddMultiInfo(GUIInfo(bNegate ? -STRING_STR: STRING_STR, skinOffset, compareString));
437   }
438   else if (strCategory.Equals("lcd"))
439   {
440     if (strTest.Equals("lcd.playicon")) ret = LCD_PLAY_ICON;
441     else if (strTest.Equals("lcd.progressbar")) ret = LCD_PROGRESS_BAR;
442     else if (strTest.Equals("lcd.cputemperature")) ret = LCD_CPU_TEMPERATURE;
443     else if (strTest.Equals("lcd.gputemperature")) ret = LCD_GPU_TEMPERATURE;
444     else if (strTest.Equals("lcd.hddtemperature")) ret = LCD_HDD_TEMPERATURE;
445     else if (strTest.Equals("lcd.fanspeed")) ret = LCD_FAN_SPEED;
446     else if (strTest.Equals("lcd.date")) ret = LCD_DATE;
447     else if (strTest.Equals("lcd.freespace(c)")) ret = LCD_FREE_SPACE_C;
448     else if (strTest.Equals("lcd.freespace(e)")) ret = LCD_FREE_SPACE_E;
449     else if (strTest.Equals("lcd.freespace(f)")) ret = LCD_FREE_SPACE_F;
450     else if (strTest.Equals("lcd.freespace(g)")) ret = LCD_FREE_SPACE_G;
451     else if (strTest.Equals("lcd.Time21")) ret = LCD_TIME_21; // Small LCD numbers
452     else if (strTest.Equals("lcd.Time22")) ret = LCD_TIME_22;
453     else if (strTest.Equals("lcd.TimeWide21")) ret = LCD_TIME_W21; // Medium LCD numbers
454     else if (strTest.Equals("lcd.TimeWide22")) ret = LCD_TIME_W22;
455     else if (strTest.Equals("lcd.Time41")) ret = LCD_TIME_41; // Big LCD numbers
456     else if (strTest.Equals("lcd.Time42")) ret = LCD_TIME_42;
457     else if (strTest.Equals("lcd.Time43")) ret = LCD_TIME_43;
458     else if (strTest.Equals("lcd.Time44")) ret = LCD_TIME_44;
459   }
460   else if (strCategory.Equals("network"))
461   {
462     if (strTest.Equals("network.ipaddress")) ret = NETWORK_IP_ADDRESS;
463     if (strTest.Equals("network.isdhcp")) ret = NETWORK_IS_DHCP;
464     if (strTest.Equals("network.linkstate")) ret = NETWORK_LINK_STATE;
465     if (strTest.Equals("network.macaddress")) ret = NETWORK_MAC_ADDRESS;
466     if (strTest.Equals("network.subnetaddress")) ret = NETWORK_SUBNET_ADDRESS;
467     if (strTest.Equals("network.gatewayaddress")) ret = NETWORK_GATEWAY_ADDRESS;
468     if (strTest.Equals("network.dns1address")) ret = NETWORK_DNS1_ADDRESS;
469     if (strTest.Equals("network.dns2address")) ret = NETWORK_DNS2_ADDRESS;
470     if (strTest.Equals("network.dhcpaddress")) ret = NETWORK_DHCP_ADDRESS;
471   }
472   else if (strCategory.Equals("musicplayer"))
473   {
474     CStdString info = strTest.Mid(strCategory.GetLength() + 1);
475     if (info.Left(9).Equals("position("))
476     {
477       int position = atoi(info.Mid(9));
478       int value = TranslateMusicPlayerString(info.Mid(info.Find(".")+1));
479       ret = AddMultiInfo(GUIInfo(value, 0, position));
480     }
481     else if (info.Left(7).Equals("offset("))
482     {
483       int position = atoi(info.Mid(7));
484       int value = TranslateMusicPlayerString(info.Mid(info.Find(".")+1));
485       ret = AddMultiInfo(GUIInfo(value, 1, position));
486     }
487     else if (info.Left(13).Equals("timeremaining")) return AddMultiInfo(GUIInfo(PLAYER_TIME_REMAINING, TranslateTimeFormat(info.Mid(13))));
488     else if (info.Left(9).Equals("timespeed")) return AddMultiInfo(GUIInfo(PLAYER_TIME_SPEED, TranslateTimeFormat(info.Mid(9))));
489     else if (info.Left(4).Equals("time")) return AddMultiInfo(GUIInfo(PLAYER_TIME, TranslateTimeFormat(info.Mid(4))));
490     else if (info.Left(8).Equals("duration")) return AddMultiInfo(GUIInfo(PLAYER_DURATION, TranslateTimeFormat(info.Mid(8))));
491     else
492       ret = TranslateMusicPlayerString(strTest.Mid(12));
493   }
494   else if (strCategory.Equals("videoplayer"))
495   {
496     if (strTest.Equals("videoplayer.title")) ret = VIDEOPLAYER_TITLE;
497     else if (strTest.Equals("videoplayer.genre")) ret = VIDEOPLAYER_GENRE;
498     else if (strTest.Equals("videoplayer.originaltitle")) ret = VIDEOPLAYER_ORIGINALTITLE;
499     else if (strTest.Equals("videoplayer.director")) ret = VIDEOPLAYER_DIRECTOR;
500     else if (strTest.Equals("videoplayer.year")) ret = VIDEOPLAYER_YEAR;
501     else if (strTest.Left(25).Equals("videoplayer.timeremaining")) ret = AddMultiInfo(GUIInfo(PLAYER_TIME_REMAINING, TranslateTimeFormat(strTest.Mid(25))));
502     else if (strTest.Left(21).Equals("videoplayer.timespeed")) ret = AddMultiInfo(GUIInfo(PLAYER_TIME_SPEED, TranslateTimeFormat(strTest.Mid(21))));
503     else if (strTest.Left(16).Equals("videoplayer.time")) ret = AddMultiInfo(GUIInfo(PLAYER_TIME, TranslateTimeFormat(strTest.Mid(16))));
504     else if (strTest.Left(20).Equals("videoplayer.duration")) ret = AddMultiInfo(GUIInfo(PLAYER_DURATION, TranslateTimeFormat(strTest.Mid(20))));
505     else if (strTest.Equals("videoplayer.cover")) ret = VIDEOPLAYER_COVER;
506     else if (strTest.Equals("videoplayer.usingoverlays")) ret = VIDEOPLAYER_USING_OVERLAYS;
507     else if (strTest.Equals("videoplayer.isfullscreen")) ret = VIDEOPLAYER_ISFULLSCREEN;
508     else if (strTest.Equals("videoplayer.hasmenu")) ret = VIDEOPLAYER_HASMENU;
509     else if (strTest.Equals("videoplayer.playlistlength")) ret = VIDEOPLAYER_PLAYLISTLEN;
510     else if (strTest.Equals("videoplayer.playlistposition")) ret = VIDEOPLAYER_PLAYLISTPOS;
511     else if (strTest.Equals("videoplayer.plot")) ret = VIDEOPLAYER_PLOT;
512     else if (strTest.Equals("videoplayer.plotoutline")) ret = VIDEOPLAYER_PLOT_OUTLINE;
513     else if (strTest.Equals("videoplayer.episode")) ret = VIDEOPLAYER_EPISODE;
514     else if (strTest.Equals("videoplayer.season")) ret = VIDEOPLAYER_SEASON;
515     else if (strTest.Equals("videoplayer.rating")) ret = VIDEOPLAYER_RATING;
516     else if (strTest.Equals("videoplayer.ratingandvotes")) ret = VIDEOPLAYER_RATING_AND_VOTES;
517     else if (strTest.Equals("videoplayer.tvshowtitle")) ret = VIDEOPLAYER_TVSHOW;
518     else if (strTest.Equals("videoplayer.premiered")) ret = VIDEOPLAYER_PREMIERED;
519     else if (strTest.Left(19).Equals("videoplayer.content")) return AddMultiInfo(GUIInfo(bNegate ? -VIDEOPLAYER_CONTENT : VIDEOPLAYER_CONTENT, ConditionalStringParameter(strTest.Mid(20,strTest.size()-21)), 0));
520     else if (strTest.Equals("videoplayer.studio")) ret = VIDEOPLAYER_STUDIO;
521     else if (strTest.Equals("videoplayer.mpaa")) return VIDEOPLAYER_MPAA;
522     else if (strTest.Equals("videoplayer.top250")) return VIDEOPLAYER_TOP250;
523     else if (strTest.Equals("videoplayer.cast")) return VIDEOPLAYER_CAST;
524     else if (strTest.Equals("videoplayer.castandrole")) return VIDEOPLAYER_CAST_AND_ROLE;
525     else if (strTest.Equals("videoplayer.artist")) return VIDEOPLAYER_ARTIST;
526     else if (strTest.Equals("videoplayer.album")) return VIDEOPLAYER_ALBUM;
527     else if (strTest.Equals("videoplayer.writer")) return VIDEOPLAYER_WRITER;
528     else if (strTest.Equals("videoplayer.tagline")) return VIDEOPLAYER_TAGLINE;
529     else if (strTest.Equals("videoplayer.hasinfo")) return VIDEOPLAYER_HAS_INFO;
530     else if (strTest.Equals("videoplayer.trailer")) return VIDEOPLAYER_TRAILER;
531     else if (strTest.Equals("videoplayer.videocodec")) return VIDEOPLAYER_VIDEO_CODEC;
532     else if (strTest.Equals("videoplayer.videoresolution")) return VIDEOPLAYER_VIDEO_RESOLUTION;
533     else if (strTest.Equals("videoplayer.videoaspect")) return VIDEOPLAYER_VIDEO_ASPECT;
534     else if (strTest.Equals("videoplayer.audiocodec")) return VIDEOPLAYER_AUDIO_CODEC;
535     else if (strTest.Equals("videoplayer.audiochannels")) return VIDEOPLAYER_AUDIO_CHANNELS;
536   }
537   else if (strCategory.Equals("playlist"))
538   {
539     if (strTest.Equals("playlist.length")) ret = PLAYLIST_LENGTH;
540     else if (strTest.Equals("playlist.position")) ret = PLAYLIST_POSITION;
541     else if (strTest.Equals("playlist.random")) ret = PLAYLIST_RANDOM;
542     else if (strTest.Equals("playlist.repeat")) ret = PLAYLIST_REPEAT;
543     else if (strTest.Equals("playlist.israndom")) ret = PLAYLIST_ISRANDOM;
544     else if (strTest.Equals("playlist.isrepeat")) ret = PLAYLIST_ISREPEAT;
545     else if (strTest.Equals("playlist.isrepeatone")) ret = PLAYLIST_ISREPEATONE;
546   }
547   else if (strCategory.Equals("musicpartymode"))
548   {
549     if (strTest.Equals("musicpartymode.enabled")) ret = MUSICPM_ENABLED;
550     else if (strTest.Equals("musicpartymode.songsplayed")) ret = MUSICPM_SONGSPLAYED;
551     else if (strTest.Equals("musicpartymode.matchingsongs")) ret = MUSICPM_MATCHINGSONGS;
552     else if (strTest.Equals("musicpartymode.matchingsongspicked")) ret = MUSICPM_MATCHINGSONGSPICKED;
553     else if (strTest.Equals("musicpartymode.matchingsongsleft")) ret = MUSICPM_MATCHINGSONGSLEFT;
554     else if (strTest.Equals("musicpartymode.relaxedsongspicked")) ret = MUSICPM_RELAXEDSONGSPICKED;
555     else if (strTest.Equals("musicpartymode.randomsongspicked")) ret = MUSICPM_RANDOMSONGSPICKED;
556   }
557   else if (strCategory.Equals("audioscrobbler"))
558   {
559     if (strTest.Equals("audioscrobbler.enabled")) ret = AUDIOSCROBBLER_ENABLED;
560     else if (strTest.Equals("audioscrobbler.connectstate")) ret = AUDIOSCROBBLER_CONN_STATE;
561     else if (strTest.Equals("audioscrobbler.submitinterval")) ret = AUDIOSCROBBLER_SUBMIT_INT;
562     else if (strTest.Equals("audioscrobbler.filescached")) ret = AUDIOSCROBBLER_FILES_CACHED;
563     else if (strTest.Equals("audioscrobbler.submitstate")) ret = AUDIOSCROBBLER_SUBMIT_STATE;
564   }
565   else if (strCategory.Equals("lastfm"))
566   {
567     if (strTest.Equals("lastfm.radioplaying")) ret = LASTFM_RADIOPLAYING;
568     else if (strTest.Equals("lastfm.canlove")) ret = LASTFM_CANLOVE;
569     else if (strTest.Equals("lastfm.canban")) ret = LASTFM_CANBAN;
570   }
571   else if (strCategory.Equals("slideshow"))
572     ret = CPictureInfoTag::TranslateString(strTest.Mid(strCategory.GetLength() + 1));
573   else if (strCategory.Left(9).Equals("container"))
574   {
575     int id = atoi(strCategory.Mid(10, strCategory.GetLength() - 11));
576     CStdString info = strTest.Mid(strCategory.GetLength() + 1);
577     if (info.Left(14).Equals("listitemnowrap"))
578     {
579       int offset = atoi(info.Mid(15, info.GetLength() - 16));
580       ret = TranslateListItem(info.Mid(info.Find(".")+1));
581       if (offset || id)
582         return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, id, offset));
583     }
584     else if (info.Left(16).Equals("listitemposition"))
585     {
586       int offset = atoi(info.Mid(17, info.GetLength() - 18));
587       ret = TranslateListItem(info.Mid(info.Find(".")+1));
588       if (offset || id)
589         return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, id, offset, INFOFLAG_LISTITEM_POSITION));
590     }
591     else if (info.Left(8).Equals("listitem"))
592     {
593       int offset = atoi(info.Mid(9, info.GetLength() - 10));
594       ret = TranslateListItem(info.Mid(info.Find(".")+1));
595       if (offset || id)
596         return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, id, offset, INFOFLAG_LISTITEM_WRAP));
597     }
598     else if (info.Equals("hasfiles")) ret = CONTAINER_HASFILES;
599     else if (info.Equals("hasfolders")) ret = CONTAINER_HASFOLDERS;
600     else if (info.Equals("isstacked")) ret = CONTAINER_STACKED;
601     else if (info.Equals("folderthumb")) ret = CONTAINER_FOLDERTHUMB;
602     else if (info.Equals("tvshowthumb")) ret = CONTAINER_TVSHOWTHUMB;
603     else if (info.Equals("seasonthumb")) ret = CONTAINER_SEASONTHUMB;
604     else if (info.Equals("folderpath")) ret = CONTAINER_FOLDERPATH;
605     else if (info.Equals("foldername")) ret = CONTAINER_FOLDERNAME;
606     else if (info.Equals("pluginname")) ret = CONTAINER_PLUGINNAME;
607     else if (info.Equals("viewmode")) ret = CONTAINER_VIEWMODE;
608     else if (info.Equals("onnext")) ret = CONTAINER_ON_NEXT;
609     else if (info.Equals("onprevious")) ret = CONTAINER_ON_PREVIOUS;
610     else if (info.Equals("totaltime")) ret = CONTAINER_TOTALTIME;
611     else if (info.Equals("scrolling"))
612       return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_SCROLLING : CONTAINER_SCROLLING, id, 0));
613     else if (info.Equals("hasnext"))
614       return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_HAS_NEXT : CONTAINER_HAS_NEXT, id, 0));
615     else if (info.Equals("hasprevious"))
616       return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_HAS_PREVIOUS : CONTAINER_HAS_PREVIOUS, id, 0));
617     else if (info.Left(8).Equals("content("))
618       return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_CONTENT : CONTAINER_CONTENT, ConditionalStringParameter(info.Mid(8,info.GetLength()-9)), 0));
619     else if (info.Left(4).Equals("row("))
620       return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_ROW : CONTAINER_ROW, id, atoi(info.Mid(4, info.GetLength() - 5))));
621     else if (info.Left(7).Equals("column("))
622       return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_COLUMN : CONTAINER_COLUMN, id, atoi(info.Mid(7, info.GetLength() - 8))));
623     else if (info.Left(8).Equals("position"))
624       return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_POSITION : CONTAINER_POSITION, id, atoi(info.Mid(9, info.GetLength() - 10))));
625     else if (info.Left(8).Equals("subitem("))
626       return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_SUBITEM : CONTAINER_SUBITEM, id, atoi(info.Mid(8, info.GetLength() - 9))));
627     else if (info.Equals("hasthumb")) ret = CONTAINER_HAS_THUMB;
628     else if (info.Equals("numpages")) ret = CONTAINER_NUM_PAGES;
629     else if (info.Equals("numitems")) ret = CONTAINER_NUM_ITEMS;
630     else if (info.Equals("currentpage")) ret = CONTAINER_CURRENT_PAGE;
631     else if (info.Equals("sortmethod")) ret = CONTAINER_SORT_METHOD;
632     else if (info.Left(13).Equals("sortdirection"))
633     {
634       CStdString direction = info.Mid(14, info.GetLength() - 15);
635       SORT_ORDER order = SORT_ORDER_NONE;
636       if (direction == "ascending")
637         order = SORT_ORDER_ASC;
638       else if (direction == "descending")
639         order = SORT_ORDER_DESC;
640       return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_SORT_DIRECTION : CONTAINER_SORT_DIRECTION, order));
641     }
642     else if (info.Left(5).Equals("sort("))
643     {
644       SORT_METHOD sort = SORT_METHOD_NONE;
645       CStdString method(info.Mid(5, info.GetLength() - 6));
646       if (method.Equals("songrating")) sort = SORT_METHOD_SONG_RATING;
647       if (sort != SORT_METHOD_NONE)
648         return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_SORT_METHOD : CONTAINER_SORT_METHOD, sort));
649     }
650     else if (id && info.Left(9).Equals("hasfocus("))
651     {
652       int itemID = atoi(info.Mid(9, info.GetLength() - 10));
653       return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_HAS_FOCUS : CONTAINER_HAS_FOCUS, id, itemID));
654     }
655     else if (info.Left(9).Equals("property("))
656     {
657       int compareString = ConditionalStringParameter(info.Mid(9, info.GetLength() - 10));
658       return AddMultiInfo(GUIInfo(CONTAINER_PROPERTY, id, compareString));
659     }
660     else if (info.Equals("showplot")) ret = CONTAINER_SHOWPLOT;
661     if (id && (ret == CONTAINER_ON_NEXT || ret == CONTAINER_ON_PREVIOUS || ret == CONTAINER_NUM_PAGES ||
662                ret == CONTAINER_NUM_ITEMS || ret == CONTAINER_CURRENT_PAGE))
663       return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, id));
664   }
665   else if (strCategory.Left(8).Equals("listitem"))
666   {
667     int offset = atoi(strCategory.Mid(9, strCategory.GetLength() - 10));
668     ret = TranslateListItem(strTest.Mid(strCategory.GetLength() + 1));
669     if (offset || ret == LISTITEM_ISSELECTED || ret == LISTITEM_ISPLAYING)
670       return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, 0, offset, INFOFLAG_LISTITEM_WRAP));
671   }
672   else if (strCategory.Left(16).Equals("listitemposition"))
673   {
674     int offset = atoi(strCategory.Mid(17, strCategory.GetLength() - 18));
675     ret = TranslateListItem(strCategory.Mid(strCategory.GetLength()+1));
676     if (offset || ret == LISTITEM_ISSELECTED || ret == LISTITEM_ISPLAYING)
677       return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, 0, offset, INFOFLAG_LISTITEM_POSITION));
678   }
679   else if (strCategory.Left(14).Equals("listitemnowrap"))
680   {
681     int offset = atoi(strCategory.Mid(15, strCategory.GetLength() - 16));
682     ret = TranslateListItem(strTest.Mid(strCategory.GetLength() + 1));
683     if (offset || ret == LISTITEM_ISSELECTED || ret == LISTITEM_ISPLAYING)
684       return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, 0, offset));
685   }
686   else if (strCategory.Equals("visualisation"))
687   {
688     if (strTest.Equals("visualisation.locked")) ret = VISUALISATION_LOCKED;
689     else if (strTest.Equals("visualisation.preset")) ret = VISUALISATION_PRESET;
690     else if (strTest.Equals("visualisation.name")) ret = VISUALISATION_NAME;
691     else if (strTest.Equals("visualisation.enabled")) ret = VISUALISATION_ENABLED;
692   }
693   else if (strCategory.Equals("fanart"))
694   {
695     if (strTest.Equals("fanart.color1")) ret = FANART_COLOR1;
696     else if (strTest.Equals("fanart.color2")) ret = FANART_COLOR2;
697     else if (strTest.Equals("fanart.color3")) ret = FANART_COLOR3;
698     else if (strTest.Equals("fanart.image")) ret = FANART_IMAGE;
699   }
700   else if (strCategory.Equals("skin"))
701   {
702     if (strTest.Equals("skin.currenttheme"))
703       ret = SKIN_THEME;
704     else if (strTest.Equals("skin.currentcolourtheme"))
705       ret = SKIN_COLOUR_THEME;
706     else if (strTest.Left(12).Equals("skin.string("))
707     {
708       int pos = strTest.Find(",");
709       if (pos >= 0)
710       {
711         int skinOffset = g_settings.TranslateSkinString(strTest.Mid(12, pos - 12));
712         int compareString = ConditionalStringParameter(strTest.Mid(pos + 1, strTest.GetLength() - (pos + 2)));
713         return AddMultiInfo(GUIInfo(bNegate ? -SKIN_STRING : SKIN_STRING, skinOffset, compareString));
714       }
715       int skinOffset = g_settings.TranslateSkinString(strTest.Mid(12, strTest.GetLength() - 13));
716       return AddMultiInfo(GUIInfo(bNegate ? -SKIN_STRING : SKIN_STRING, skinOffset));
717     }
718     else if (strTest.Left(16).Equals("skin.hassetting("))
719     {
720       int skinOffset = g_settings.TranslateSkinBool(strTest.Mid(16, strTest.GetLength() - 17));
721       return AddMultiInfo(GUIInfo(bNegate ? -SKIN_BOOL : SKIN_BOOL, skinOffset));
722     }
723     else if (strTest.Left(14).Equals("skin.hastheme("))
724       ret = SKIN_HAS_THEME_START + ConditionalStringParameter(strTest.Mid(14, strTest.GetLength() -  15));
725   }
726   else if (strCategory.Left(6).Equals("window"))
727   {
728     CStdString info = strTest.Mid(strCategory.GetLength() + 1);
729     // special case for window.xml parameter, fails above
730     if (info.Left(5).Equals("xml)."))
731       info = info.Mid(5, info.GetLength() + 1);
732     if (info.Left(9).Equals("property("))
733     {
734       int winID = 0;
735       if (strTest.Left(7).Equals("window("))
736       {
737         CStdString window(strTest.Mid(7, strTest.Find(")", 7) - 7).ToLower());
738         winID = CButtonTranslator::TranslateWindowString(window.c_str());
739       }
740       if (winID != WINDOW_INVALID)
741       {
742         int compareString = ConditionalStringParameter(info.Mid(9, info.GetLength() - 10));
743         return AddMultiInfo(GUIInfo(WINDOW_PROPERTY, winID, compareString));
744       }
745     }
746     else if (info.Left(9).Equals("isactive("))
747     {
748       CStdString window(strTest.Mid(16, strTest.GetLength() - 17).ToLower());
749       if (window.Find("xml") >= 0)
750         return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_ACTIVE : WINDOW_IS_ACTIVE, 0, ConditionalStringParameter(window)));
751       int winID = CButtonTranslator::TranslateWindowString(window.c_str());
752       if (winID != WINDOW_INVALID)
753         return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_ACTIVE : WINDOW_IS_ACTIVE, winID, 0));
754     }
755     else if (info.Left(7).Equals("ismedia")) return WINDOW_IS_MEDIA;
756     else if (info.Left(10).Equals("istopmost("))
757     {
758       CStdString window(strTest.Mid(17, strTest.GetLength() - 18).ToLower());
759       if (window.Find("xml") >= 0)
760         return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_TOPMOST : WINDOW_IS_TOPMOST, 0, ConditionalStringParameter(window)));
761       int winID = CButtonTranslator::TranslateWindowString(window.c_str());
762       if (winID != WINDOW_INVALID)
763         return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_TOPMOST : WINDOW_IS_TOPMOST, winID, 0));
764     }
765     else if (info.Left(10).Equals("isvisible("))
766     {
767       CStdString window(strTest.Mid(17, strTest.GetLength() - 18).ToLower());
768       if (window.Find("xml") >= 0)
769         return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_VISIBLE : WINDOW_IS_VISIBLE, 0, ConditionalStringParameter(window)));
770       int winID = CButtonTranslator::TranslateWindowString(window.c_str());
771       if (winID != WINDOW_INVALID)
772         return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_VISIBLE : WINDOW_IS_VISIBLE, winID, 0));
773     }
774     else if (info.Left(9).Equals("previous("))
775     {
776       CStdString window(strTest.Mid(16, strTest.GetLength() - 17).ToLower());
777       if (window.Find("xml") >= 0)
778         return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_PREVIOUS : WINDOW_PREVIOUS, 0, ConditionalStringParameter(window)));
779       int winID = CButtonTranslator::TranslateWindowString(window.c_str());
780       if (winID != WINDOW_INVALID)
781         return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_PREVIOUS : WINDOW_PREVIOUS, winID, 0));
782     }
783     else if (info.Left(5).Equals("next("))
784     {
785       CStdString window(strTest.Mid(12, strTest.GetLength() - 13).ToLower());
786       if (window.Find("xml") >= 0)
787         return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_NEXT : WINDOW_NEXT, 0, ConditionalStringParameter(window)));
788       int winID = CButtonTranslator::TranslateWindowString(window.c_str());
789       if (winID != WINDOW_INVALID)
790         return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_NEXT : WINDOW_NEXT, winID, 0));
791     }
792   }
793   else if (strTest.Left(17).Equals("control.hasfocus("))
794   {
795     int controlID = atoi(strTest.Mid(17, strTest.GetLength() - 18).c_str());
796     if (controlID)
797       return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_HAS_FOCUS : CONTROL_HAS_FOCUS, controlID, 0));
798   }
799   else if (strTest.Left(18).Equals("control.isvisible("))
800   {
801     int controlID = atoi(strTest.Mid(18, strTest.GetLength() - 19).c_str());
802     if (controlID)
803       return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_IS_VISIBLE : CONTROL_IS_VISIBLE, controlID, 0));
804   }
805   else if (strTest.Left(18).Equals("control.isenabled("))
806   {
807     int controlID = atoi(strTest.Mid(18, strTest.GetLength() - 19).c_str());
808     if (controlID)
809       return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_IS_ENABLED : CONTROL_IS_ENABLED, controlID, 0));
810   }
811   else if (strTest.Left(17).Equals("control.getlabel("))
812   {
813     int controlID = atoi(strTest.Mid(17, strTest.GetLength() - 18).c_str());
814     if (controlID)
815       return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_GET_LABEL : CONTROL_GET_LABEL, controlID, 0));
816   }
817   else if (strTest.Left(13).Equals("controlgroup("))
818   {
819     int groupID = atoi(strTest.Mid(13).c_str());
820     int controlID = 0;
821     int controlPos = strTest.Find(".hasfocus(");
822     if (controlPos > 0)
823       controlID = atoi(strTest.Mid(controlPos + 10).c_str());
824     if (groupID)
825     {
826       return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_GROUP_HAS_FOCUS : CONTROL_GROUP_HAS_FOCUS, groupID, controlID));
827     }
828   }
829   else if (strTest.Left(24).Equals("buttonscroller.hasfocus("))
830   {
831     int controlID = atoi(strTest.Mid(24, strTest.GetLength() - 24).c_str());
832     if (controlID)
833       return AddMultiInfo(GUIInfo(bNegate ? -BUTTON_SCROLLER_HAS_ICON : BUTTON_SCROLLER_HAS_ICON, controlID, 0));
834   }
835
836   return bNegate ? -ret : ret;
837 }
838
839 int CGUIInfoManager::TranslateListItem(const CStdString &info)
840 {
841   if (info.Equals("thumb")) return LISTITEM_THUMB;
842   else if (info.Equals("icon")) return LISTITEM_ICON;
843   else if (info.Equals("actualicon")) return LISTITEM_ACTUAL_ICON;
844   else if (info.Equals("overlay")) return LISTITEM_OVERLAY;
845   else if (info.Equals("label")) return LISTITEM_LABEL;
846   else if (info.Equals("label2")) return LISTITEM_LABEL2;
847   else if (info.Equals("title")) return LISTITEM_TITLE;
848   else if (info.Equals("tracknumber")) return LISTITEM_TRACKNUMBER;
849   else if (info.Equals("artist")) return LISTITEM_ARTIST;
850   else if (info.Equals("album")) return LISTITEM_ALBUM;
851   else if (info.Equals("albumartist")) return LISTITEM_ALBUM_ARTIST;
852   else if (info.Equals("year")) return LISTITEM_YEAR;
853   else if (info.Equals("genre")) return LISTITEM_GENRE;
854   else if (info.Equals("director")) return LISTITEM_DIRECTOR;
855   else if (info.Equals("filename")) return LISTITEM_FILENAME;
856   else if (info.Equals("filenameandpath")) return LISTITEM_FILENAME_AND_PATH;
857   else if (info.Equals("date")) return LISTITEM_DATE;
858   else if (info.Equals("size")) return LISTITEM_SIZE;
859   else if (info.Equals("rating")) return LISTITEM_RATING;
860   else if (info.Equals("ratingandvotes")) return LISTITEM_RATING_AND_VOTES;
861   else if (info.Equals("programcount")) return LISTITEM_PROGRAM_COUNT;
862   else if (info.Equals("duration")) return LISTITEM_DURATION;
863   else if (info.Equals("isselected")) return LISTITEM_ISSELECTED;
864   else if (info.Equals("isplaying")) return LISTITEM_ISPLAYING;
865   else if (info.Equals("plot")) return LISTITEM_PLOT;
866   else if (info.Equals("plotoutline")) return LISTITEM_PLOT_OUTLINE;
867   else if (info.Equals("episode")) return LISTITEM_EPISODE;
868   else if (info.Equals("season")) return LISTITEM_SEASON;
869   else if (info.Equals("tvshowtitle")) return LISTITEM_TVSHOW;
870   else if (info.Equals("premiered")) return LISTITEM_PREMIERED;
871   else if (info.Equals("comment")) return LISTITEM_COMMENT;
872   else if (info.Equals("path")) return LISTITEM_PATH;
873   else if (info.Equals("foldername")) return LISTITEM_FOLDERNAME;
874   else if (info.Equals("picturepath")) return LISTITEM_PICTURE_PATH;
875   else if (info.Equals("pictureresolution")) return LISTITEM_PICTURE_RESOLUTION;
876   else if (info.Equals("picturedatetime")) return LISTITEM_PICTURE_DATETIME;
877   else if (info.Equals("studio")) return LISTITEM_STUDIO;
878   else if (info.Equals("mpaa")) return LISTITEM_MPAA;
879   else if (info.Equals("cast")) return LISTITEM_CAST;
880   else if (info.Equals("castandrole")) return LISTITEM_CAST_AND_ROLE;
881   else if (info.Equals("writer")) return LISTITEM_WRITER;
882   else if (info.Equals("tagline")) return LISTITEM_TAGLINE;
883   else if (info.Equals("top250")) return LISTITEM_TOP250;
884   else if (info.Equals("trailer")) return LISTITEM_TRAILER;
885   else if (info.Equals("starrating")) return LISTITEM_STAR_RATING;
886   else if (info.Equals("sortletter")) return LISTITEM_SORT_LETTER;
887   else if (info.Equals("videocodec")) return LISTITEM_VIDEO_CODEC;
888   else if (info.Equals("videoresolution")) return LISTITEM_VIDEO_RESOLUTION;
889   else if (info.Equals("videoaspect")) return LISTITEM_VIDEO_ASPECT;
890   else if (info.Equals("audiocodec")) return LISTITEM_AUDIO_CODEC;
891   else if (info.Equals("audiochannels")) return LISTITEM_AUDIO_CHANNELS;
892   else if (info.Equals("audiolanguage")) return LISTITEM_AUDIO_LANGUAGE;
893   else if (info.Equals("subtitlelanguage")) return LISTITEM_SUBTITLE_LANGUAGE;
894   else if (info.Left(9).Equals("property(")) return AddListItemProp(info.Mid(9, info.GetLength() - 10));
895   return 0;
896 }
897
898 int CGUIInfoManager::TranslateMusicPlayerString(const CStdString &info) const
899 {
900   if (info.Equals("title")) return MUSICPLAYER_TITLE;
901   else if (info.Equals("album")) return MUSICPLAYER_ALBUM;
902   else if (info.Equals("artist")) return MUSICPLAYER_ARTIST;
903   else if (info.Equals("year")) return MUSICPLAYER_YEAR;
904   else if (info.Equals("genre")) return MUSICPLAYER_GENRE;
905   else if (info.Equals("duration")) return MUSICPLAYER_DURATION;
906   else if (info.Equals("tracknumber")) return MUSICPLAYER_TRACK_NUMBER;
907   else if (info.Equals("cover")) return MUSICPLAYER_COVER;
908   else if (info.Equals("bitrate")) return MUSICPLAYER_BITRATE;
909   else if (info.Equals("playlistlength")) return MUSICPLAYER_PLAYLISTLEN;
910   else if (info.Equals("playlistposition")) return MUSICPLAYER_PLAYLISTPOS;
911   else if (info.Equals("channels")) return MUSICPLAYER_CHANNELS;
912   else if (info.Equals("bitspersample")) return MUSICPLAYER_BITSPERSAMPLE;
913   else if (info.Equals("samplerate")) return MUSICPLAYER_SAMPLERATE;
914   else if (info.Equals("codec")) return MUSICPLAYER_CODEC;
915   else if (info.Equals("discnumber")) return MUSICPLAYER_DISC_NUMBER;
916   else if (info.Equals("rating")) return MUSICPLAYER_RATING;
917   else if (info.Equals("comment")) return MUSICPLAYER_COMMENT;
918   else if (info.Equals("lyrics")) return MUSICPLAYER_LYRICS;
919   else if (info.Equals("playlistplaying")) return MUSICPLAYER_PLAYLISTPLAYING;
920   else if (info.Equals("exists")) return MUSICPLAYER_EXISTS;
921   else if (info.Equals("hasprevious")) return MUSICPLAYER_HASPREVIOUS;
922   else if (info.Equals("hasnext")) return MUSICPLAYER_HASNEXT;
923   return 0;
924 }
925
926 TIME_FORMAT CGUIInfoManager::TranslateTimeFormat(const CStdString &format)
927 {
928   if (format.IsEmpty()) return TIME_FORMAT_GUESS;
929   else if (format.Equals("(hh)")) return TIME_FORMAT_HH;
930   else if (format.Equals("(mm)")) return TIME_FORMAT_MM;
931   else if (format.Equals("(ss)")) return TIME_FORMAT_SS;
932   else if (format.Equals("(hh:mm)")) return TIME_FORMAT_HH_MM;
933   else if (format.Equals("(mm:ss)")) return TIME_FORMAT_MM_SS;
934   else if (format.Equals("(hh:mm:ss)")) return TIME_FORMAT_HH_MM_SS;
935   return TIME_FORMAT_GUESS;
936 }
937
938 CStdString CGUIInfoManager::GetLabel(int info, DWORD contextWindow)
939 {
940   CStdString strLabel;
941   if (info >= MULTI_INFO_START && info <= MULTI_INFO_END)
942     return GetMultiInfoLabel(m_multiInfo[info - MULTI_INFO_START], contextWindow);
943
944   if (info >= SLIDE_INFO_START && info <= SLIDE_INFO_END)
945     return GetPictureLabel(info);
946
947   if (info >= LISTITEM_START && info <= LISTITEM_END)
948   {
949     CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS); // true for has list items
950     if (window)
951     {
952       CFileItemPtr item = window->GetCurrentListItem();
953       strLabel = GetItemLabel(item.get(), info);
954     }
955
956     return strLabel;
957   }
958
959   switch (info)
960   {
961   case WEATHER_CONDITIONS:
962     strLabel = g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_COND);
963     strLabel = strLabel.Trim();
964     break;
965   case WEATHER_TEMPERATURE:
966     strLabel.Format("%s%s", g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_TEMP), g_langInfo.GetTempUnitString().c_str());
967     break;
968   case WEATHER_LOCATION:
969     strLabel = g_weatherManager.GetInfo(WEATHER_LABEL_LOCATION);
970     break;
971   case WEATHER_FANART_CODE:
972     strLabel = CUtil::GetFileName(g_weatherManager.GetInfo(WEATHER_IMAGE_CURRENT_ICON));
973     CUtil::RemoveExtension(strLabel);
974     break;
975   case WEATHER_PLUGIN:
976     strLabel = g_guiSettings.GetString("weather.plugin");
977     break;
978   case SYSTEM_DATE:
979     strLabel = GetDate();
980     break;
981   case LCD_DATE:
982     strLabel = GetDate(true);
983     break;
984   case SYSTEM_FPS:
985     strLabel.Format("%02.2f", m_fps);
986     break;
987   case PLAYER_VOLUME:
988     strLabel.Format("%2.1f dB", (float)(g_stSettings.m_nVolumeLevel + g_stSettings.m_dynamicRangeCompressionLevel) * 0.01f);
989     break;
990   case PLAYER_SUBTITLE_DELAY:
991     strLabel.Format("%2.3f s", g_stSettings.m_currentVideoSettings.m_SubtitleDelay);
992     break;
993   case PLAYER_AUDIO_DELAY:
994     strLabel.Format("%2.3f s", g_stSettings.m_currentVideoSettings.m_AudioDelay);
995     break;
996   case PLAYER_CHAPTER:
997     if(g_application.IsPlaying() && g_application.m_pPlayer)
998       strLabel.Format("%02d", g_application.m_pPlayer->GetChapter());
999     break;
1000   case PLAYER_CHAPTERCOUNT:
1001     if(g_application.IsPlaying() && g_application.m_pPlayer)
1002       strLabel.Format("%02d", g_application.m_pPlayer->GetChapterCount());
1003     break;
1004   case PLAYER_CHAPTERNAME:
1005     if(g_application.IsPlaying() && g_application.m_pPlayer)
1006       g_application.m_pPlayer->GetChapterName(strLabel);
1007     break;
1008   case PLAYER_CACHELEVEL:
1009     {
1010       int iLevel = 0;
1011       if(g_application.IsPlaying() && ((iLevel = GetInt(PLAYER_CACHELEVEL)) >= 0))
1012         strLabel.Format("%i", iLevel);
1013     }
1014     break;
1015   case PLAYER_TIME:
1016     if(g_application.IsPlaying() && g_application.m_pPlayer)
1017       strLabel = GetCurrentPlayTime(TIME_FORMAT_HH_MM);
1018     break;
1019   case PLAYER_DURATION:
1020     if(g_application.IsPlaying() && g_application.m_pPlayer)
1021       strLabel = GetDuration(TIME_FORMAT_HH_MM);
1022     break;
1023   case MUSICPLAYER_TITLE:
1024   case MUSICPLAYER_ALBUM:
1025   case MUSICPLAYER_ARTIST:
1026   case MUSICPLAYER_GENRE:
1027   case MUSICPLAYER_YEAR:
1028   case MUSICPLAYER_TRACK_NUMBER:
1029   case MUSICPLAYER_BITRATE:
1030   case MUSICPLAYER_PLAYLISTLEN:
1031   case MUSICPLAYER_PLAYLISTPOS:
1032   case MUSICPLAYER_CHANNELS:
1033   case MUSICPLAYER_BITSPERSAMPLE:
1034   case MUSICPLAYER_SAMPLERATE:
1035   case MUSICPLAYER_CODEC:
1036   case MUSICPLAYER_DISC_NUMBER:
1037   case MUSICPLAYER_RATING:
1038   case MUSICPLAYER_COMMENT:
1039   case MUSICPLAYER_LYRICS:
1040     strLabel = GetMusicLabel(info);
1041   break;
1042   case VIDEOPLAYER_TITLE:
1043   case VIDEOPLAYER_ORIGINALTITLE:
1044   case VIDEOPLAYER_GENRE:
1045   case VIDEOPLAYER_DIRECTOR:
1046   case VIDEOPLAYER_YEAR:
1047   case VIDEOPLAYER_PLAYLISTLEN:
1048   case VIDEOPLAYER_PLAYLISTPOS:
1049   case VIDEOPLAYER_PLOT:
1050   case VIDEOPLAYER_PLOT_OUTLINE:
1051   case VIDEOPLAYER_EPISODE:
1052   case VIDEOPLAYER_SEASON:
1053   case VIDEOPLAYER_RATING:
1054   case VIDEOPLAYER_RATING_AND_VOTES:
1055   case VIDEOPLAYER_TVSHOW:
1056   case VIDEOPLAYER_PREMIERED:
1057   case VIDEOPLAYER_STUDIO:
1058   case VIDEOPLAYER_MPAA:
1059   case VIDEOPLAYER_TOP250:
1060   case VIDEOPLAYER_CAST:
1061   case VIDEOPLAYER_CAST_AND_ROLE:
1062   case VIDEOPLAYER_ARTIST:
1063   case VIDEOPLAYER_ALBUM:
1064   case VIDEOPLAYER_WRITER:
1065   case VIDEOPLAYER_TAGLINE:
1066   case VIDEOPLAYER_TRAILER:
1067     strLabel = GetVideoLabel(info);
1068   break;
1069   case VIDEOPLAYER_VIDEO_CODEC:
1070     if(g_application.IsPlaying() && g_application.m_pPlayer)
1071       strLabel = g_application.m_pPlayer->GetVideoCodecName();
1072     break;
1073   case VIDEOPLAYER_VIDEO_RESOLUTION:
1074     if(g_application.IsPlaying() && g_application.m_pPlayer)
1075       return CStreamDetails::VideoWidthToResolutionDescription(g_application.m_pPlayer->GetPictureWidth());
1076     break;
1077   case VIDEOPLAYER_AUDIO_CODEC:
1078     if(g_application.IsPlaying() && g_application.m_pPlayer)
1079       strLabel = g_application.m_pPlayer->GetAudioCodecName();
1080     break;
1081   case VIDEOPLAYER_VIDEO_ASPECT:
1082     if (g_application.IsPlaying() && g_application.m_pPlayer)
1083     {
1084       float aspect;
1085       g_application.m_pPlayer->GetVideoAspectRatio(aspect);
1086       strLabel = CStreamDetails::VideoAspectToAspectDescription(aspect);
1087     }
1088     break;
1089   case VIDEOPLAYER_AUDIO_CHANNELS:
1090     if(g_application.IsPlaying() && g_application.m_pPlayer)
1091       strLabel.Format("%i", g_application.m_pPlayer->GetChannels());
1092     break;
1093   case PLAYLIST_LENGTH:
1094   case PLAYLIST_POSITION:
1095   case PLAYLIST_RANDOM:
1096   case PLAYLIST_REPEAT:
1097     strLabel = GetPlaylistLabel(info);
1098   break;
1099   case MUSICPM_SONGSPLAYED:
1100   case MUSICPM_MATCHINGSONGS:
1101   case MUSICPM_MATCHINGSONGSPICKED:
1102   case MUSICPM_MATCHINGSONGSLEFT:
1103   case MUSICPM_RELAXEDSONGSPICKED:
1104   case MUSICPM_RANDOMSONGSPICKED:
1105     strLabel = GetMusicPartyModeLabel(info);
1106   break;
1107
1108   case SYSTEM_FREE_SPACE:
1109   case SYSTEM_FREE_SPACE_C:
1110   case SYSTEM_FREE_SPACE_E:
1111   case SYSTEM_FREE_SPACE_F:
1112   case SYSTEM_FREE_SPACE_G:
1113   case SYSTEM_USED_SPACE:
1114   case SYSTEM_USED_SPACE_C:
1115   case SYSTEM_USED_SPACE_E:
1116   case SYSTEM_USED_SPACE_F:
1117   case SYSTEM_USED_SPACE_G:
1118   case SYSTEM_TOTAL_SPACE:
1119   case SYSTEM_TOTAL_SPACE_C:
1120   case SYSTEM_TOTAL_SPACE_E:
1121   case SYSTEM_TOTAL_SPACE_F:
1122   case SYSTEM_TOTAL_SPACE_G:
1123   case SYSTEM_FREE_SPACE_PERCENT:
1124   case SYSTEM_FREE_SPACE_PERCENT_C:
1125   case SYSTEM_FREE_SPACE_PERCENT_E:
1126   case SYSTEM_FREE_SPACE_PERCENT_F:
1127   case SYSTEM_FREE_SPACE_PERCENT_G:
1128   case SYSTEM_USED_SPACE_PERCENT:
1129   case SYSTEM_USED_SPACE_PERCENT_C:
1130   case SYSTEM_USED_SPACE_PERCENT_E:
1131   case SYSTEM_USED_SPACE_PERCENT_F:
1132   case SYSTEM_USED_SPACE_PERCENT_G:
1133   case SYSTEM_USED_SPACE_X:
1134   case SYSTEM_FREE_SPACE_X:
1135   case SYSTEM_TOTAL_SPACE_X:
1136   case SYSTEM_USED_SPACE_Y:
1137   case SYSTEM_FREE_SPACE_Y:
1138   case SYSTEM_TOTAL_SPACE_Y:
1139   case SYSTEM_USED_SPACE_Z:
1140   case SYSTEM_FREE_SPACE_Z:
1141   case SYSTEM_TOTAL_SPACE_Z:
1142     return g_sysinfo.GetHddSpaceInfo(info);
1143   break;
1144
1145   case LCD_FREE_SPACE_C:
1146   case LCD_FREE_SPACE_E:
1147   case LCD_FREE_SPACE_F:
1148   case LCD_FREE_SPACE_G:
1149     return g_sysinfo.GetHddSpaceInfo(info, true);
1150     break;
1151
1152   case SYSTEM_CPU_TEMPERATURE:
1153   case SYSTEM_GPU_TEMPERATURE:
1154   case SYSTEM_FAN_SPEED:
1155   case LCD_CPU_TEMPERATURE:
1156   case LCD_GPU_TEMPERATURE:
1157   case LCD_FAN_SPEED:
1158   case SYSTEM_CPU_USAGE:
1159     return GetSystemHeatInfo(info);
1160     break;
1161
1162   case SYSTEM_VIDEO_ENCODER_INFO:
1163   case NETWORK_MAC_ADDRESS:
1164   case SYSTEM_KERNEL_VERSION:
1165   case SYSTEM_CPUFREQUENCY:
1166   case SYSTEM_INTERNET_STATE:
1167   case SYSTEM_UPTIME:
1168   case SYSTEM_TOTALUPTIME:
1169     return g_sysinfo.GetInfo(info);
1170     break;
1171
1172   case SYSTEM_SCREEN_RESOLUTION:
1173     strLabel.Format("%ix%i %s %02.2f Hz.",
1174       g_settings.m_ResInfo[g_guiSettings.m_LookAndFeelResolution].iWidth,
1175       g_settings.m_ResInfo[g_guiSettings.m_LookAndFeelResolution].iHeight,
1176       g_settings.m_ResInfo[g_guiSettings.m_LookAndFeelResolution].strMode.c_str(),GetFPS());
1177     return strLabel;
1178     break;
1179
1180   case CONTAINER_FOLDERPATH: 
1181   case CONTAINER_FOLDERNAME:
1182     {
1183       CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1184       if (window)
1185       {
1186         CURL url(((CGUIMediaWindow*)window)->CurrentDirectory().m_strPath);
1187         url.GetURLWithoutUserDetails(strLabel);
1188         if (info==CONTAINER_FOLDERNAME)
1189         {
1190           CUtil::RemoveSlashAtEnd(strLabel);
1191           strLabel=CUtil::GetFileName(strLabel);
1192         }
1193       }
1194       break;
1195     }
1196   case CONTAINER_PLUGINNAME:
1197     {
1198       CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1199       if (window)
1200       {
1201         CURL url(((CGUIMediaWindow*)window)->CurrentDirectory().m_strPath);
1202         if (url.GetProtocol().Equals("plugin"))
1203         {
1204           strLabel = url.GetFileName();
1205           CUtil::RemoveSlashAtEnd(strLabel);
1206         }
1207       }
1208       break;
1209     }
1210   case CONTAINER_VIEWMODE:
1211     {
1212       CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1213       if (window)
1214       {
1215         const CGUIControl *control = window->GetControl(window->GetViewContainerID());
1216         if (control && control->IsContainer())
1217           strLabel = ((CGUIBaseContainer *)control)->GetLabel();
1218       }
1219       break;
1220     }
1221   case CONTAINER_SORT_METHOD:
1222     {
1223       CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1224       if (window)
1225       {
1226         const CGUIViewState *viewState = ((CGUIMediaWindow*)window)->GetViewState();
1227         if (viewState)
1228           strLabel = g_localizeStrings.Get(viewState->GetSortMethodLabel());
1229     }
1230     }
1231     break;
1232   case CONTAINER_NUM_PAGES:
1233   case CONTAINER_NUM_ITEMS:
1234   case CONTAINER_CURRENT_PAGE:
1235     return GetMultiInfoLabel(GUIInfo(info), contextWindow);
1236     break;
1237   case CONTAINER_SHOWPLOT:
1238     {
1239       CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1240       if (window)
1241         return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("showplot");
1242     }
1243     break;
1244   case CONTAINER_TOTALTIME:
1245     {
1246       CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1247       if (window)
1248       {
1249         const CFileItemList& items=((CGUIMediaWindow *)window)->CurrentDirectory();
1250         int duration=0;
1251         for (int i=0;i<items.Size();++i)
1252         {
1253           CFileItemPtr item=items.Get(i);
1254           if (item->HasMusicInfoTag())
1255             duration += item->GetMusicInfoTag()->GetDuration();
1256         }
1257         if (duration > 0)
1258         {
1259           CStdString result;
1260           StringUtils::SecondsToTimeString(duration,result);
1261           return result;
1262         }
1263       }
1264     }
1265     break;
1266   case SYSTEM_BUILD_VERSION:
1267     strLabel = GetVersion();
1268     break;
1269   case SYSTEM_BUILD_DATE:
1270     strLabel = GetBuild();
1271     break;
1272   case SYSTEM_FREE_MEMORY:
1273   case SYSTEM_FREE_MEMORY_PERCENT:
1274   case SYSTEM_USED_MEMORY:
1275   case SYSTEM_USED_MEMORY_PERCENT:
1276   case SYSTEM_TOTAL_MEMORY:
1277     {
1278       MEMORYSTATUS stat;
1279       GlobalMemoryStatus(&stat);
1280       int iMemPercentFree = 100 - ((int)( 100.0f* (stat.dwTotalPhys - stat.dwAvailPhys)/stat.dwTotalPhys + 0.5f ));
1281       int iMemPercentUsed = 100 - iMemPercentFree;
1282
1283       if (info == SYSTEM_FREE_MEMORY)
1284         strLabel.Format("%luMB", (ULONG)(stat.dwAvailPhys/MB));
1285       else if (info == SYSTEM_FREE_MEMORY_PERCENT)
1286         strLabel.Format("%i%%", iMemPercentFree);
1287       else if (info == SYSTEM_USED_MEMORY)
1288         strLabel.Format("%luMB", (ULONG)((stat.dwTotalPhys - stat.dwAvailPhys)/MB));
1289       else if (info == SYSTEM_USED_MEMORY_PERCENT)
1290         strLabel.Format("%i%%", iMemPercentUsed);
1291       else if (info == SYSTEM_TOTAL_MEMORY)
1292         strLabel.Format("%luMB", (ULONG)(stat.dwTotalPhys/MB));
1293     }
1294     break;
1295   case SYSTEM_SCREEN_MODE:
1296     strLabel = g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()].strMode;
1297     break;
1298   case SYSTEM_SCREEN_WIDTH:
1299     strLabel.Format("%i", g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()].iWidth);
1300     break;
1301   case SYSTEM_SCREEN_HEIGHT:
1302     strLabel.Format("%i", g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()].iHeight);
1303     break;
1304   case SYSTEM_CURRENT_WINDOW:
1305     return g_localizeStrings.Get(m_gWindowManager.GetFocusedWindow());
1306     break;
1307   case SYSTEM_CURRENT_CONTROL:
1308     {
1309       CGUIWindow *window = m_gWindowManager.GetWindow(m_gWindowManager.GetFocusedWindow());
1310       if (window)
1311       {
1312         CGUIControl *control = window->GetFocusedControl();
1313         if (control)
1314           strLabel = control->GetDescription();
1315       }
1316     }
1317     break;
1318 #ifdef HAS_DVD_DRIVE
1319   case SYSTEM_DVD_LABEL:
1320     strLabel = g_mediaManager.GetDiskLabel();
1321     break;
1322 #endif
1323   case SYSTEM_ALARM_POS:
1324     if (g_alarmClock.GetRemaining("shutdowntimer") == 0.f)
1325       strLabel = "";
1326     else
1327     {
1328       double fTime = g_alarmClock.GetRemaining("shutdowntimer");
1329       if (fTime > 60.f)
1330         strLabel.Format("%2.0fm",g_alarmClock.GetRemaining("shutdowntimer")/60.f);
1331       else
1332         strLabel.Format("%2.0fs",g_alarmClock.GetRemaining("shutdowntimer"));
1333     }
1334     break;
1335   case SYSTEM_PROFILENAME:
1336     strLabel = g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].getName();
1337     break;
1338   case SYSTEM_LANGUAGE:
1339     strLabel = g_guiSettings.GetString("locale.language");
1340     break;
1341   case SYSTEM_TEMPERATURE_UNITS:
1342     strLabel = g_langInfo.GetTempUnitString();
1343     break;
1344   case SYSTEM_PROGRESS_BAR:
1345     {
1346       int percent = GetInt(SYSTEM_PROGRESS_BAR);
1347       if (percent)
1348         strLabel.Format("%i", percent);
1349     }
1350     break;
1351   case LCD_PLAY_ICON:
1352     {
1353       int iPlaySpeed = g_application.GetPlaySpeed();
1354       if (g_application.IsPaused())
1355         strLabel.Format("\7");
1356       else if (iPlaySpeed < 1)
1357         strLabel.Format("\3:%ix", iPlaySpeed);
1358       else if (iPlaySpeed > 1)
1359         strLabel.Format("\4:%ix", iPlaySpeed);
1360       else
1361         strLabel.Format("\5");
1362     }
1363     break;
1364
1365   case LCD_TIME_21:
1366   case LCD_TIME_22:
1367   case LCD_TIME_W21:
1368   case LCD_TIME_W22:
1369   case LCD_TIME_41:
1370   case LCD_TIME_42:
1371   case LCD_TIME_43:
1372   case LCD_TIME_44:
1373     //alternatively, set strLabel
1374     return GetLcdTime( info );
1375     break;
1376
1377   case SKIN_THEME:
1378     if (g_guiSettings.GetString("lookandfeel.skintheme").Equals("skindefault"))
1379       strLabel = g_localizeStrings.Get(15109);
1380     else
1381       strLabel = g_guiSettings.GetString("lookandfeel.skintheme");
1382     break;
1383   case SKIN_COLOUR_THEME:
1384     if (g_guiSettings.GetString("lookandfeel.skincolors").Equals("skindefault"))
1385       strLabel = g_localizeStrings.Get(15109);
1386     else
1387       strLabel = g_guiSettings.GetString("lookandfeel.skincolors");
1388     break;
1389 #ifdef HAS_LCD
1390   case LCD_PROGRESS_BAR:
1391     if (g_lcd) strLabel = g_lcd->GetProgressBar(g_application.GetTime(), g_application.GetTotalTime());
1392     break;
1393 #endif
1394   case NETWORK_IP_ADDRESS:
1395     {
1396       CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
1397       if (iface)
1398         return iface->GetCurrentIPAddress();
1399     }
1400     break;
1401   case NETWORK_SUBNET_ADDRESS:
1402     {
1403       CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
1404       if (iface)
1405         return iface->GetCurrentNetmask();
1406     }
1407     break;
1408   case NETWORK_GATEWAY_ADDRESS:
1409     {
1410       CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
1411       if (iface)
1412         return iface->GetCurrentDefaultGateway();
1413     }
1414     break;
1415   case NETWORK_DNS1_ADDRESS:
1416     {
1417       vector<CStdString> nss = g_application.getNetwork().GetNameServers();
1418       if (nss.size() >= 1)
1419         return nss[0];
1420     }
1421     break;
1422   case NETWORK_DNS2_ADDRESS:
1423     {
1424       vector<CStdString> nss = g_application.getNetwork().GetNameServers();
1425       if (nss.size() >= 2)
1426         return nss[1];
1427     }
1428     break;
1429   case NETWORK_DHCP_ADDRESS:
1430     {
1431       CStdString dhcpserver;
1432       return dhcpserver;
1433     }
1434     break;
1435   case NETWORK_LINK_STATE:
1436     {
1437       CStdString linkStatus = g_localizeStrings.Get(151);
1438       linkStatus += " ";
1439       CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
1440       if (iface && iface->IsConnected())
1441         linkStatus += g_localizeStrings.Get(15207);
1442       else
1443         linkStatus += g_localizeStrings.Get(15208);
1444       return linkStatus;
1445     }
1446     break;
1447
1448   case AUDIOSCROBBLER_CONN_STATE:
1449   case AUDIOSCROBBLER_SUBMIT_INT:
1450   case AUDIOSCROBBLER_FILES_CACHED:
1451   case AUDIOSCROBBLER_SUBMIT_STATE:
1452     strLabel=GetAudioScrobblerLabel(info);
1453     break;
1454   case VISUALISATION_PRESET:
1455     {
1456       CGUIMessage msg(GUI_MSG_GET_VISUALISATION, 0, 0);
1457       g_graphicsContext.SendMessage(msg);
1458       if (msg.GetLPVOID())
1459       {
1460         CVisualisation *pVis = (CVisualisation *)msg.GetLPVOID();
1461         char *preset = pVis->GetPreset();
1462         if (preset)
1463         {
1464           strLabel = preset;
1465           CUtil::RemoveExtension(strLabel);
1466         }
1467       }
1468     }
1469     break;
1470   case VISUALISATION_NAME:
1471     {
1472       strLabel = g_guiSettings.GetString("mymusic.visualisation");
1473       if (strLabel != "None" && strLabel.size() > 4)
1474       { // make it look pretty
1475         strLabel = strLabel.Left(strLabel.size() - 4);
1476         strLabel[0] = toupper(strLabel[0]);
1477       }
1478     }
1479     break;
1480   case FANART_COLOR1:
1481     {
1482       CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1483       if (window)
1484         return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("fanart_color1");
1485     }
1486     break;
1487   case FANART_COLOR2:
1488     {
1489       CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1490       if (window)
1491         return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("fanart_color2");
1492     }
1493     break;
1494   case FANART_COLOR3:
1495     {
1496       CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1497       if (window)
1498         return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("fanart_color3");
1499     }
1500     break;
1501   case FANART_IMAGE:
1502     {
1503       CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1504       if (window)
1505         return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("fanart_image");
1506     }
1507     break;
1508   case SYSTEM_OPENGL_VENDOR:
1509     strLabel = g_Windowing.GetRenderVendor();
1510     break;
1511   case SYSTEM_OPENGL_RENDERER:
1512     strLabel = g_Windowing.GetRenderRenderer();
1513     break;
1514   case SYSTEM_OPENGL_VERSION:
1515   {
1516     unsigned int major, minor;
1517     g_Windowing.GetRenderVersion(major, minor);
1518     strLabel.Format("%d.%d", major, minor);
1519     break;
1520   }
1521   }
1522
1523   return strLabel;
1524 }
1525
1526 // tries to get a integer value for use in progressbars/sliders and such
1527 int CGUIInfoManager::GetInt(int info, DWORD contextWindow) const
1528 {
1529   switch( info )
1530   {
1531     case PLAYER_VOLUME:
1532       return g_application.GetVolume();
1533     case PLAYER_SUBTITLE_DELAY:
1534       return g_application.GetSubtitleDelay();
1535     case PLAYER_AUDIO_DELAY:
1536       return g_application.GetAudioDelay();
1537     case PLAYER_PROGRESS:
1538     case PLAYER_SEEKBAR:
1539     case PLAYER_CACHELEVEL:
1540     case PLAYER_CHAPTER:
1541     case PLAYER_CHAPTERCOUNT:
1542       {
1543         if( g_application.IsPlaying() && g_application.m_pPlayer)
1544         {
1545           switch( info )
1546           {
1547           case PLAYER_PROGRESS:
1548             return (int)(g_application.GetPercentage());
1549           case PLAYER_SEEKBAR:
1550             {
1551               CGUIDialogSeekBar *seekBar = (CGUIDialogSeekBar*)m_gWindowManager.GetWindow(WINDOW_DIALOG_SEEK_BAR);
1552               return seekBar ? (int)seekBar->GetPercentage() : 0;
1553             }
1554           case PLAYER_CACHELEVEL:
1555             return (int)(g_application.m_pPlayer->GetCacheLevel());
1556           case PLAYER_CHAPTER:
1557             return g_application.m_pPlayer->GetChapter();
1558           case PLAYER_CHAPTERCOUNT:
1559             return g_application.m_pPlayer->GetChapterCount();
1560           }
1561         }
1562       }
1563       break;
1564     case SYSTEM_FREE_MEMORY:
1565     case SYSTEM_USED_MEMORY:
1566       {
1567         MEMORYSTATUS stat;
1568         GlobalMemoryStatus(&stat);
1569         int memPercentUsed = (int)( 100.0f* (stat.dwTotalPhys - stat.dwAvailPhys)/stat.dwTotalPhys + 0.5f );
1570         if (info == SYSTEM_FREE_MEMORY)
1571           return 100 - memPercentUsed;
1572         return memPercentUsed;
1573       }
1574     case SYSTEM_PROGRESS_BAR:
1575       {
1576         CGUIDialogProgress *bar = (CGUIDialogProgress *)m_gWindowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
1577         if (bar && bar->IsDialogRunning())
1578           return bar->GetPercentage();
1579       }
1580     case SYSTEM_FREE_SPACE:
1581     case SYSTEM_FREE_SPACE_C:
1582     case SYSTEM_FREE_SPACE_E:
1583     case SYSTEM_FREE_SPACE_F:
1584     case SYSTEM_FREE_SPACE_G:
1585     case SYSTEM_USED_SPACE:
1586     case SYSTEM_USED_SPACE_C:
1587     case SYSTEM_USED_SPACE_E:
1588     case SYSTEM_USED_SPACE_F:
1589     case SYSTEM_USED_SPACE_G:
1590     case SYSTEM_FREE_SPACE_X:
1591     case SYSTEM_USED_SPACE_X:
1592     case SYSTEM_FREE_SPACE_Y:
1593     case SYSTEM_USED_SPACE_Y:
1594     case SYSTEM_FREE_SPACE_Z:
1595     case SYSTEM_USED_SPACE_Z:
1596       {
1597         int ret = 0;
1598         g_sysinfo.GetHddSpaceInfo(ret, info, true);
1599         return ret;
1600       }
1601     case SYSTEM_CPU_USAGE:
1602       return g_cpuInfo.getUsedPercentage();
1603   }
1604   return 0;
1605 }
1606 // checks the condition and returns it as necessary.  Currently used
1607 // for toggle button controls and visibility of images.
1608 bool CGUIInfoManager::GetBool(int condition1, DWORD dwContextWindow, const CGUIListItem *item)
1609 {
1610   // check our cache
1611   bool bReturn = false;
1612   if (!item && IsCached(condition1, dwContextWindow, bReturn)) // never use cache for list items
1613     return bReturn;
1614
1615   int condition = abs(condition1);
1616
1617   if(condition >= COMBINED_VALUES_START && (condition - COMBINED_VALUES_START) < (int)(m_CombinedValues.size()) )
1618   {
1619     const CCombinedValue &comb = m_CombinedValues[condition - COMBINED_VALUES_START];
1620     if (!EvaluateBooleanExpression(comb, bReturn, dwContextWindow, item))
1621       bReturn = false;
1622   }
1623   else if (item && condition >= LISTITEM_START && condition < LISTITEM_END)
1624     bReturn = GetItemBool(item, condition);
1625   // Ethernet Link state checking
1626   // Will check if the Xbox has a Ethernet Link connection! [Cable in!]
1627   // This can used for the skinner to switch off Network or Inter required functions
1628   else if ( condition == SYSTEM_ALWAYS_TRUE)
1629     bReturn = true;
1630   else if (condition == SYSTEM_ALWAYS_FALSE)
1631     bReturn = false;
1632   else if (condition == SYSTEM_ETHERNET_LINK_ACTIVE)
1633     bReturn = true;
1634   else if (condition > SYSTEM_IDLE_TIME_START && condition <= SYSTEM_IDLE_TIME_FINISH)
1635     bReturn = (g_application.GlobalIdleTime() >= condition - SYSTEM_IDLE_TIME_START);
1636   else if (condition == WINDOW_IS_MEDIA)
1637   { // note: This doesn't return true for dialogs (content, favourites, login, videoinfo)
1638     CGUIWindow *pWindow = m_gWindowManager.GetWindow(m_gWindowManager.GetActiveWindow());
1639     bReturn = (pWindow && pWindow->IsMediaWindow());
1640   }
1641   else if (condition == PLAYER_MUTED)
1642     bReturn = g_stSettings.m_bMute;
1643   else if (condition >= LIBRARY_HAS_MUSIC && condition <= LIBRARY_HAS_MUSICVIDEOS)
1644     bReturn = GetLibraryBool(condition);
1645   else if (condition == LIBRARY_IS_SCANNING)
1646   {
1647     CGUIDialogMusicScan *musicScanner = (CGUIDialogMusicScan *)m_gWindowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN);
1648     CGUIDialogVideoScan *videoScanner = (CGUIDialogVideoScan *)m_gWindowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
1649     if (musicScanner->IsScanning() || videoScanner->IsScanning())
1650       bReturn = true;
1651     else
1652       bReturn = false;
1653   }
1654   else if (condition == SYSTEM_PLATFORM_LINUX)
1655 #if defined(_LINUX) && !defined(__APPLE__)
1656     bReturn = true;
1657 #else
1658     bReturn = false;
1659 #endif
1660   else if (condition == SYSTEM_PLATFORM_WINDOWS)
1661 #ifdef WIN32
1662     bReturn = true;
1663 #else
1664     bReturn = false;
1665 #endif
1666   else if (condition == SYSTEM_PLATFORM_OSX)
1667 #ifdef __APPLE__
1668     bReturn = true;
1669 #else
1670     bReturn = false;
1671 #endif
1672   else if (condition == SYSTEM_PLATFORM_XBOX)
1673     bReturn = false;
1674   else if (condition == SYSTEM_MEDIA_DVD)
1675     bReturn = g_mediaManager.IsDiscInDrive();
1676 #ifdef HAS_DVD_DRIVE
1677   else if (condition == SYSTEM_HAS_DRIVE_F)
1678     bReturn = CIoSupport::DriveExists('F');
1679   else if (condition == SYSTEM_HAS_DRIVE_G)
1680     bReturn = CIoSupport::DriveExists('G');
1681   else if (condition == SYSTEM_DVDREADY)
1682     bReturn = g_mediaManager.GetDriveStatus() != DRIVE_NOT_READY;
1683   else if (condition == SYSTEM_TRAYOPEN)
1684     bReturn = g_mediaManager.GetDriveStatus() == DRIVE_OPEN;
1685 #endif
1686   else if (condition == SYSTEM_CAN_POWERDOWN)
1687     bReturn = g_powerManager.CanPowerdown();
1688   else if (condition == SYSTEM_CAN_SUSPEND)
1689     bReturn = g_powerManager.CanSuspend();
1690   else if (condition == SYSTEM_CAN_HIBERNATE)
1691     bReturn = g_powerManager.CanHibernate();
1692   else if (condition == SYSTEM_CAN_REBOOT)
1693     bReturn = g_powerManager.CanReboot();
1694
1695   else if (condition == PLAYER_SHOWINFO)
1696     bReturn = m_playerShowInfo;
1697   else if (condition == PLAYER_SHOWCODEC)
1698     bReturn = m_playerShowCodec;
1699   else if (condition >= SKIN_HAS_THEME_START && condition <= SKIN_HAS_THEME_END)
1700   { // Note that the code used here could probably be extended to general
1701     // settings conditions (parameter would need to store both the setting name an
1702     // the and the comparison string)
1703     CStdString theme = g_guiSettings.GetString("lookandfeel.skintheme");
1704     theme.ToLower();
1705     CUtil::RemoveExtension(theme);
1706     bReturn = theme.Equals(m_stringParameters[condition - SKIN_HAS_THEME_START]);
1707   }
1708   else if (condition >= MULTI_INFO_START && condition <= MULTI_INFO_END)
1709   {
1710     // cache return value
1711     bool result = GetMultiInfoBool(m_multiInfo[condition - MULTI_INFO_START], dwContextWindow, item);
1712     if (!item)
1713       CacheBool(condition1, dwContextWindow, result);
1714     return result;
1715   }
1716   else if (condition == SYSTEM_HASLOCKS)
1717     bReturn = g_settings.m_vecProfiles[0].getLockMode() != LOCK_MODE_EVERYONE;
1718   else if (condition == SYSTEM_ISMASTER)
1719     bReturn = g_settings.m_vecProfiles[0].getLockMode() != LOCK_MODE_EVERYONE && g_passwordManager.bMasterUser;
1720   else if (condition == SYSTEM_LOGGEDON)
1721     bReturn = !(m_gWindowManager.GetActiveWindow() == WINDOW_LOGIN_SCREEN);
1722   else if (condition == SYSTEM_HAS_LOGINSCREEN)
1723     bReturn = g_settings.bUseLoginScreen;
1724   else if (condition == WEATHER_IS_FETCHED)
1725     bReturn = g_weatherManager.IsFetched();
1726   else if (condition == SYSTEM_INTERNET_STATE)
1727   {
1728     g_sysinfo.GetInfo(condition);
1729     bReturn = g_sysinfo.m_bInternetState;
1730   }
1731   else if (condition == SKIN_HAS_VIDEO_OVERLAY)
1732   {
1733     bReturn = !g_application.IsInScreenSaver() && m_gWindowManager.IsOverlayAllowed() &&
1734               g_application.IsPlayingVideo() && m_gWindowManager.GetActiveWindow() != WINDOW_FULLSCREEN_VIDEO;
1735   }
1736   else if (condition == SKIN_HAS_MUSIC_OVERLAY)
1737   {
1738     bReturn = !g_application.IsInScreenSaver() && m_gWindowManager.IsOverlayAllowed() &&
1739               g_application.IsPlayingAudio();
1740   }
1741   else if (condition == CONTAINER_HASFILES || condition == CONTAINER_HASFOLDERS)
1742   {
1743     CGUIWindow *pWindow = GetWindowWithCondition(dwContextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1744     if (pWindow)
1745     {
1746       const CFileItemList& items=((CGUIMediaWindow*)pWindow)->CurrentDirectory();
1747       for (int i=0;i<items.Size();++i)
1748       {
1749         CFileItemPtr item=items.Get(i);
1750         if (!item->m_bIsFolder && condition == CONTAINER_HASFILES)
1751         {
1752           bReturn=true;
1753           break;
1754         }
1755         else if (item->m_bIsFolder && !item->IsParentFolder() && condition == CONTAINER_HASFOLDERS)
1756         {
1757           bReturn=true;
1758           break;
1759         }
1760       }
1761     }
1762   }
1763   else if (condition == CONTAINER_STACKED)
1764   {
1765     CGUIWindow *pWindow = GetWindowWithCondition(dwContextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1766     if (pWindow)
1767       bReturn = ((CGUIMediaWindow*)pWindow)->CurrentDirectory().GetProperty("isstacked")=="1";
1768   }
1769   else if (condition == CONTAINER_HAS_THUMB)
1770   {
1771     CGUIWindow *pWindow = GetWindowWithCondition(dwContextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1772     if (pWindow)
1773       bReturn = ((CGUIMediaWindow*)pWindow)->CurrentDirectory().HasThumbnail();
1774   }
1775   else if (condition == VIDEOPLAYER_HAS_INFO)
1776     bReturn = m_currentFile->HasVideoInfoTag();
1777   else if (condition == CONTAINER_ON_NEXT || condition == CONTAINER_ON_PREVIOUS)
1778   {
1779     // no parameters, so we assume it's just requested for a media window.  It therefore
1780     // can only happen if the list has focus.
1781     CGUIWindow *pWindow = GetWindowWithCondition(dwContextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1782     if (pWindow)
1783     {
1784       map<int,int>::const_iterator it = m_containerMoves.find(pWindow->GetViewContainerID());
1785       if (it != m_containerMoves.end())
1786         bReturn = condition == CONTAINER_ON_NEXT ? it->second > 0 : it->second < 0;
1787     }
1788   }
1789   else if (g_application.IsPlaying())
1790   {
1791     switch (condition)
1792     {
1793     case PLAYER_HAS_MEDIA:
1794       bReturn = true;
1795       break;
1796     case PLAYER_HAS_AUDIO:
1797       bReturn = g_application.IsPlayingAudio();
1798       break;
1799     case PLAYER_HAS_VIDEO:
1800       bReturn = g_application.IsPlayingVideo();
1801       break;
1802     case PLAYER_PLAYING:
1803       bReturn = !g_application.IsPaused() && (g_application.GetPlaySpeed() == 1);
1804       break;
1805     case PLAYER_PAUSED:
1806       bReturn = g_application.IsPaused();
1807       break;
1808     case PLAYER_REWINDING:
1809       bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() < 1;
1810       break;
1811     case PLAYER_FORWARDING:
1812       bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() > 1;
1813       break;
1814     case PLAYER_REWINDING_2x:
1815       bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == -2;
1816       break;
1817     case PLAYER_REWINDING_4x:
1818       bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == -4;
1819       break;
1820     case PLAYER_REWINDING_8x:
1821       bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == -8;
1822       break;
1823     case PLAYER_REWINDING_16x:
1824       bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == -16;
1825       break;
1826     case PLAYER_REWINDING_32x:
1827       bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == -32;
1828       break;
1829     case PLAYER_FORWARDING_2x:
1830       bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == 2;
1831       break;
1832     case PLAYER_FORWARDING_4x:
1833       bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == 4;
1834       break;
1835     case PLAYER_FORWARDING_8x:
1836       bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == 8;
1837       break;
1838     case PLAYER_FORWARDING_16x:
1839       bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == 16;
1840       break;
1841     case PLAYER_FORWARDING_32x:
1842       bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == 32;
1843       break;
1844     case PLAYER_CAN_RECORD:
1845       bReturn = g_application.m_pPlayer->CanRecord();
1846       break;
1847     case PLAYER_RECORDING:
1848       bReturn = g_application.m_pPlayer->IsRecording();
1849     break;
1850     case PLAYER_DISPLAY_AFTER_SEEK:
1851       bReturn = GetDisplayAfterSeek();
1852     break;
1853     case PLAYER_CACHING:
1854       bReturn = g_application.m_pPlayer->IsCaching();
1855     break;
1856     case PLAYER_SEEKBAR:
1857       {
1858         CGUIDialogSeekBar *seekBar = (CGUIDialogSeekBar*)m_gWindowManager.GetWindow(WINDOW_DIALOG_SEEK_BAR);
1859         bReturn = seekBar ? seekBar->IsDialogRunning() : false;
1860       }
1861     break;
1862     case PLAYER_SEEKING:
1863       bReturn = m_playerSeeking;
1864     break;
1865     case PLAYER_SHOWTIME:
1866       bReturn = m_playerShowTime;
1867     break;
1868     case PLAYER_PASSTHROUGH:
1869       bReturn = g_application.m_pPlayer && g_application.m_pPlayer->IsPassthrough();
1870       break;
1871     case MUSICPM_ENABLED:
1872       bReturn = g_partyModeManager.IsEnabled();
1873     break;
1874     case AUDIOSCROBBLER_ENABLED:
1875       bReturn = CLastFmManager::GetInstance()->IsLastFmEnabled();
1876     break;
1877     case LASTFM_RADIOPLAYING:
1878       bReturn = CLastFmManager::GetInstance()->IsRadioEnabled();
1879       break;
1880     case LASTFM_CANLOVE:
1881       bReturn = CLastFmManager::GetInstance()->CanLove();
1882       break;
1883     case LASTFM_CANBAN:
1884       bReturn = CLastFmManager::GetInstance()->CanBan();
1885       break;
1886     case MUSICPLAYER_HASPREVIOUS:
1887       {
1888         // requires current playlist be PLAYLIST_MUSIC
1889         bReturn = false;
1890         if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
1891           bReturn = (g_playlistPlayer.GetCurrentSong() > 0); // not first song
1892       }
1893       break;
1894     case MUSICPLAYER_HASNEXT:
1895       {
1896         // requires current playlist be PLAYLIST_MUSIC
1897         bReturn = false;
1898         if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
1899           bReturn = (g_playlistPlayer.GetCurrentSong() < (g_playlistPlayer.GetPlaylist(PLAYLIST_MUSIC).size() - 1)); // not last song
1900       }
1901       break;
1902     case MUSICPLAYER_PLAYLISTPLAYING:
1903       {
1904         bReturn = false;
1905         if (g_application.IsPlayingAudio() && g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
1906           bReturn = true;
1907       }
1908       break;
1909     case VIDEOPLAYER_USING_OVERLAYS:
1910       bReturn = (g_guiSettings.GetInt("videoplayer.rendermethod") == RENDER_OVERLAYS);
1911     break;
1912     case VIDEOPLAYER_ISFULLSCREEN:
1913       bReturn = m_gWindowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO;
1914     break;
1915     case VIDEOPLAYER_HASMENU:
1916       bReturn = g_application.m_pPlayer->HasMenu();
1917     break;
1918     case PLAYLIST_ISRANDOM:
1919       bReturn = g_playlistPlayer.IsShuffled(g_playlistPlayer.GetCurrentPlaylist());
1920     break;
1921     case PLAYLIST_ISREPEAT:
1922       bReturn = g_playlistPlayer.GetRepeat(g_playlistPlayer.GetCurrentPlaylist()) == PLAYLIST::REPEAT_ALL;
1923     break;
1924     case PLAYLIST_ISREPEATONE:
1925       bReturn = g_playlistPlayer.GetRepeat(g_playlistPlayer.GetCurrentPlaylist()) == PLAYLIST::REPEAT_ONE;
1926     break;
1927     case PLAYER_HASDURATION:
1928       bReturn = g_application.GetTotalTime() > 0;
1929       break;
1930     case VISUALISATION_LOCKED:
1931       {
1932         CGUIMessage msg(GUI_MSG_GET_VISUALISATION, 0, 0);
1933         g_graphicsContext.SendMessage(msg);
1934         if (msg.GetLPVOID())
1935         {
1936           CVisualisation *pVis = (CVisualisation *)msg.GetLPVOID();
1937           bReturn = pVis->IsLocked();
1938         }
1939       }
1940     break;
1941     case VISUALISATION_ENABLED:
1942       bReturn = g_guiSettings.GetString("mymusic.visualisation") != "None";
1943     break;
1944     default: // default, use integer value different from 0 as true
1945       bReturn = GetInt(condition) != 0;
1946     }
1947   }
1948   // cache return value
1949   if (condition1 < 0) bReturn = !bReturn;
1950
1951   if (!item) // don't cache item properties
1952     CacheBool(condition1, dwContextWindow, bReturn);
1953
1954   return bReturn;
1955 }
1956
1957 /// \brief Examines the multi information sent and returns true or false accordingly.
1958 bool CGUIInfoManager::GetMultiInfoBool(const GUIInfo &info, DWORD dwContextWindow, const CGUIListItem *item)
1959 {
1960   bool bReturn = false;
1961   int condition = abs(info.m_info);
1962
1963   if (condition >= LISTITEM_START && condition <= LISTITEM_END)
1964   {
1965     // TODO: We currently don't use the item that is passed in to here, as these
1966     //       conditions only come from Container(id).ListItem(offset).* at this point.
1967     CGUIListItemPtr item;
1968     CGUIWindow *window = NULL;
1969     int data1 = info.GetData1();
1970     if (!data1) // No container specified, so we lookup the current view container
1971     {
1972       window = GetWindowWithCondition(dwContextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS);
1973       if (window && window->IsMediaWindow())
1974         data1 = ((CGUIMediaWindow*)(window))->GetViewContainerID();
1975     }
1976
1977     if (!window) // If we don't have a window already (from lookup above), get one
1978       window = GetWindowWithCondition(dwContextWindow, 0);
1979
1980     if (window)
1981     {
1982       const CGUIControl *control = window->GetControl(data1);
1983       if (control && control->IsContainer())
1984         item = ((CGUIBaseContainer *)control)->GetListItem(info.GetData2(), info.GetInfoFlag());
1985     }
1986
1987     if (item) // If we got a valid item, do the lookup
1988       bReturn = GetItemBool(item.get(), condition); // Image prioritizes images over labels (in the case of music item ratings for instance)
1989   }
1990   else
1991   {
1992     switch (condition)
1993     {
1994       case SKIN_BOOL:
1995         {
1996           bReturn = g_settings.GetSkinBool(info.GetData1());
1997         }
1998         break;
1999       case SKIN_STRING:
2000         {
2001           if (info.GetData2())
2002             bReturn = g_settings.GetSkinString(info.GetData1()).Equals(m_stringParameters[info.GetData2()]);
2003           else
2004             bReturn = !g_settings.GetSkinString(info.GetData1()).IsEmpty();
2005         }
2006         break;
2007       case STRING_IS_EMPTY:
2008         // note: Get*Image() falls back to Get*Label(), so this should cover all of them
2009         if (item && item->IsFileItem() && info.GetData1() >= LISTITEM_START && info.GetData1() < LISTITEM_END)
2010           bReturn = GetItemImage((const CFileItem *)item, info.GetData1()).IsEmpty();
2011         else
2012           bReturn = GetImage(info.GetData1(), dwContextWindow).IsEmpty();
2013         break;
2014       case STRING_COMPARE:
2015         if (item && item->IsFileItem() && info.GetData1() >= LISTITEM_START && info.GetData1() < LISTITEM_END)
2016           bReturn = GetItemImage((const CFileItem *)item, info.GetData1()).Equals(m_stringParameters[info.GetData2()]);
2017         else
2018           bReturn = GetImage(info.GetData1(), dwContextWindow).Equals(m_stringParameters[info.GetData2()]);
2019         break;
2020       case STRING_STR:
2021           {
2022             CStdString compare = m_stringParameters[info.GetData2()];
2023             // our compare string is already in lowercase, so lower case our label as well
2024             // as CStdString::Find() is case sensitive
2025             CStdString label;
2026             if (item && item->IsFileItem() && info.GetData1() >= LISTITEM_START && info.GetData1() < LISTITEM_END)
2027               label = GetItemImage((const CFileItem *)item, info.GetData1()).ToLower();
2028             else
2029               label = GetImage(info.GetData1(), dwContextWindow).ToLower();
2030             if (compare.Right(5).Equals(",left"))
2031               bReturn = label.Find(compare.Mid(0,compare.size()-5)) == 0;
2032             else if (compare.Right(6).Equals(",right"))
2033             {
2034               compare = compare.Mid(0,compare.size()-6);
2035               bReturn = label.Find(compare) == (int)(label.size()-compare.size());
2036             }
2037             else
2038               bReturn = label.Find(compare) > -1;
2039           }
2040         break;
2041     case SYSTEM_ALARM_LESS_OR_EQUAL:
2042     {
2043       int time = lrint(g_alarmClock.GetRemaining(m_stringParameters[info.GetData1()]));
2044       int timeCompare = atoi(m_stringParameters[info.GetData2()]);
2045       if (time > 0)
2046         bReturn = timeCompare >= time;
2047       else
2048         bReturn = false;
2049     }
2050     break;
2051       case CONTROL_GROUP_HAS_FOCUS:
2052         {
2053           CGUIWindow *window = GetWindowWithCondition(dwContextWindow, 0);
2054           if (window)
2055             bReturn = window->ControlGroupHasFocus(info.GetData1(), info.GetData2());
2056         }
2057         break;
2058       case CONTROL_IS_VISIBLE:
2059         {
2060           CGUIWindow *window = GetWindowWithCondition(dwContextWindow, 0);
2061           if (window)
2062           {
2063             // Note: This'll only work for unique id's
2064             const CGUIControl *control = window->GetControl(info.GetData1());
2065             if (control)
2066               bReturn = control->IsVisible();
2067           }
2068         }
2069         break;
2070       case CONTROL_IS_ENABLED:
2071         {
2072           CGUIWindow *window = GetWindowWithCondition(dwContextWindow, 0);
2073           if (window)
2074           {
2075             // Note: This'll only work for unique id's
2076             const CGUIControl *control = window->GetControl(info.GetData1());
2077             if (control)
2078               bReturn = !control->IsDisabled();
2079           }
2080         }
2081         break;
2082       case CONTROL_HAS_FOCUS:
2083         {
2084           CGUIWindow *window = GetWindowWithCondition(dwContextWindow, 0);
2085           if (window)
2086             bReturn = (window->GetFocusedControlID() == (int)info.GetData1());
2087         }
2088         break;
2089       case BUTTON_SCROLLER_HAS_ICON:
2090         {
2091           CGUIWindow *window = GetWindowWithCondition(dwContextWindow, 0);
2092           if (window)
2093           {
2094             CGUIControl *pControl = window->GetFocusedControl();
2095             if (pControl && pControl->GetControlType() == CGUIControl::GUICONTROL_BUTTONBAR)
2096               bReturn = ((CGUIButtonScroller *)pControl)->GetActiveButtonID() == (int)info.GetData1();
2097           }
2098         }
2099         break;
2100       case WINDOW_NEXT:
2101         if (info.GetData1())
2102           bReturn = ((int)info.GetData1() == m_nextWindowID);
2103         else
2104         {
2105           CGUIWindow *window = m_gWindowManager.GetWindow(m_nextWindowID);
2106           if (window && CUtil::GetFileName(window->GetXMLFile()).Equals(m_stringParameters[info.GetData2()]))
2107             bReturn = true;
2108         }
2109         break;
2110       case WINDOW_PREVIOUS:
2111         if (info.GetData1())
2112           bReturn = ((int)info.GetData1() == m_prevWindowID);
2113         else
2114         {
2115           CGUIWindow *window = m_gWindowManager.GetWindow(m_prevWindowID);
2116           if (window && CUtil::GetFileName(window->GetXMLFile()).Equals(m_stringParameters[info.GetData2()]))
2117             bReturn = true;
2118         }
2119         break;
2120       case WINDOW_IS_VISIBLE:
2121         if (info.GetData1())
2122           bReturn = m_gWindowManager.IsWindowVisible(info.GetData1());
2123         else
2124           bReturn = m_gWindowManager.IsWindowVisible(m_stringParameters[info.GetData2()]);
2125         break;
2126       case WINDOW_IS_TOPMOST:
2127         if (info.GetData1())
2128           bReturn = m_gWindowManager.IsWindowTopMost(info.GetData1());
2129         else
2130           bReturn = m_gWindowManager.IsWindowTopMost(m_stringParameters[info.GetData2()]);
2131         break;
2132       case WINDOW_IS_ACTIVE:
2133         if (info.GetData1())
2134           bReturn = m_gWindowManager.IsWindowActive(info.GetData1());
2135         else
2136           bReturn = m_gWindowManager.IsWindowActive(m_stringParameters[info.GetData2()]);
2137         break;
2138       case SYSTEM_HAS_ALARM:
2139         bReturn = g_alarmClock.hasAlarm(m_stringParameters[info.GetData1()]);
2140         break;
2141       case SYSTEM_GET_BOOL:
2142         bReturn = g_guiSettings.GetBool(m_stringParameters[info.GetData1()]);
2143         break;
2144       case SYSTEM_HAS_CORE_ID:
2145         bReturn = g_cpuInfo.HasCoreId(info.GetData1());
2146         break;
2147       case SYSTEM_SETTING:
2148         if ( m_stringParameters[info.GetData1()].Equals("hidewatched") ) 
2149           bReturn = g_stSettings.m_iMyVideoWatchMode == VIDEO_SHOW_UNWATCHED;
2150         break;
2151       case CONTAINER_ON_NEXT:
2152       case CONTAINER_ON_PREVIOUS:
2153         {
2154           map<int,int>::const_iterator it = m_containerMoves.find(info.GetData1());
2155           if (it != m_containerMoves.end())
2156             bReturn = condition == CONTAINER_ON_NEXT ? it->second > 0 : it->second < 0;
2157         }
2158         break;
2159       case CONTAINER_CONTENT:
2160         {
2161           CStdString content;
2162           CGUIWindow *window = GetWindowWithCondition(dwContextWindow, 0);
2163           if (window)
2164           {
2165             if (window->GetID() == WINDOW_MUSIC_INFO)
2166               content = ((CGUIWindowMusicInfo *)window)->CurrentDirectory().GetContent();
2167             else if (window->GetID() == WINDOW_VIDEO_INFO)
2168               content = ((CGUIWindowVideoInfo *)window)->CurrentDirectory().GetContent();
2169           }
2170           if (content.IsEmpty())
2171           {
2172             window = GetWindowWithCondition(dwContextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2173             if (window)
2174               content = ((CGUIMediaWindow *)window)->CurrentDirectory().GetContent();
2175           }
2176           bReturn = m_stringParameters[info.GetData1()].Equals(content);
2177         }
2178         break;
2179       case CONTAINER_ROW:
2180       case CONTAINER_COLUMN:
2181       case CONTAINER_POSITION:
2182       case CONTAINER_HAS_NEXT:
2183       case CONTAINER_HAS_PREVIOUS:
2184       case CONTAINER_SCROLLING:
2185       case CONTAINER_SUBITEM:
2186         {
2187           const CGUIControl *control = NULL;
2188           if (info.GetData1())
2189           { // container specified
2190             CGUIWindow *window = GetWindowWithCondition(dwContextWindow, 0);
2191             if (window)
2192               control = window->GetControl(info.GetData1());
2193           }
2194           else
2195           { // no container specified - assume a mediawindow
2196             CGUIWindow *window = GetWindowWithCondition(dwContextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2197             if (window)
2198               control = window->GetControl(window->GetViewContainerID());
2199           }
2200           if (control)
2201             bReturn = control->GetCondition(condition, info.GetData2());
2202         }
2203         break;
2204       case CONTAINER_HAS_FOCUS:
2205         { // grab our container
2206           CGUIWindow *window = GetWindowWithCondition(dwContextWindow, 0);
2207           if (window)
2208           {
2209             const CGUIControl *control = window->GetControl(info.GetData1());
2210             if (control && control->IsContainer())
2211             {
2212               CFileItemPtr item = boost::static_pointer_cast<CFileItem>(((CGUIBaseContainer *)control)->GetListItem(0));
2213               if (item && item->m_iprogramCount == info.GetData2())  // programcount used to store item id
2214                 bReturn = true;
2215             }
2216           }
2217           break;
2218         }
2219       case VIDEOPLAYER_CONTENT:
2220         {
2221           CStdString strContent="movies";
2222           if (!m_currentFile->HasVideoInfoTag())
2223             strContent = "files";
2224           if (m_currentFile->HasVideoInfoTag() && m_currentFile->GetVideoInfoTag()->m_iSeason > -1) // episode
2225             strContent = "episodes";
2226           if (m_currentFile->HasVideoInfoTag() && !m_currentFile->GetVideoInfoTag()->m_strArtist.IsEmpty())
2227             strContent = "musicvideos";
2228           if (m_currentFile->HasVideoInfoTag() && m_currentFile->GetVideoInfoTag()->m_strStatus == "livetv")
2229             strContent = "livetv";
2230           bReturn = m_stringParameters[info.GetData1()].Equals(strContent);
2231         }
2232         break;
2233       case CONTAINER_SORT_METHOD:
2234       {
2235         CGUIWindow *window = GetWindowWithCondition(dwContextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2236         if (window)
2237         {
2238           const CGUIViewState *viewState = ((CGUIMediaWindow*)window)->GetViewState();
2239           if (viewState)
2240             bReturn = ((unsigned int)viewState->GetSortMethod() == info.GetData1());
2241         }
2242         break;
2243       }
2244       case CONTAINER_SORT_DIRECTION:
2245       {
2246         CGUIWindow *window = GetWindowWithCondition(dwContextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2247         if (window)
2248         {
2249           const CGUIViewState *viewState = ((CGUIMediaWindow*)window)->GetViewState();
2250           if (viewState)
2251             bReturn = ((unsigned int)viewState->GetDisplaySortOrder() == info.GetData1());
2252         }
2253         break;
2254       }
2255       case SYSTEM_DATE:
2256         {
2257           CDateTime date = CDateTime::GetCurrentDateTime();
2258           int currentDate = date.GetMonth()*100+date.GetDay();
2259           int startDate = info.GetData1();
2260           int stopDate = info.GetData2();
2261
2262           if (stopDate < startDate)
2263             bReturn = currentDate >= startDate || currentDate < stopDate;
2264           else
2265             bReturn = currentDate >= startDate && currentDate < stopDate;
2266         }
2267         break;
2268       case SYSTEM_TIME:
2269         {
2270           CDateTime time=CDateTime::GetCurrentDateTime();
2271           int currentTime = time.GetMinuteOfDay();
2272           int startTime = info.GetData1();
2273           int stopTime = info.GetData2();
2274
2275           if (stopTime < startTime)
2276             bReturn = currentTime >= startTime || currentTime < stopTime;
2277           else
2278             bReturn = currentTime >= startTime && currentTime < stopTime;
2279         }
2280         break;
2281       case MUSICPLAYER_EXISTS:
2282         {
2283           int index = info.GetData2();
2284           if (info.GetData1() == 1)
2285           { // relative index
2286             if (g_playlistPlayer.GetCurrentPlaylist() != PLAYLIST_MUSIC)
2287               return false;
2288             index += g_playlistPlayer.GetCurrentSong();
2289           }
2290           if (index >= 0 && index < g_playlistPlayer.GetPlaylist(PLAYLIST_MUSIC).size())
2291             return true;
2292           return false;
2293         }
2294         break;
2295     }
2296   }
2297   return (info.m_info < 0) ? !bReturn : bReturn;
2298 }
2299
2300 /// \brief Examines the multi information sent and returns the string as appropriate
2301 CStdString CGUIInfoManager::GetMultiInfoLabel(const GUIInfo &info, DWORD contextWindow) const
2302 {
2303   if (info.m_info == SKIN_STRING)
2304   {
2305     return g_settings.GetSkinString(info.GetData1());
2306   }
2307   else if (info.m_info == SKIN_BOOL)
2308   {
2309     bool bInfo = g_settings.GetSkinBool(info.GetData1());
2310     if (bInfo)
2311       return g_localizeStrings.Get(20122);
2312   }
2313   if (info.m_info >= LISTITEM_START && info.m_info <= LISTITEM_END)
2314   {
2315     CFileItemPtr item;
2316     CGUIWindow *window = NULL;
2317
2318     int data1 = info.GetData1();
2319     if (!data1) // No container specified, so we lookup the current view container
2320     {
2321       window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS);
2322       if (window && window->IsMediaWindow())
2323         data1 = ((CGUIMediaWindow*)(window))->GetViewContainerID();
2324     }
2325
2326     if (!window) // If we don't have a window already (from lookup above), get one
2327       window = GetWindowWithCondition(contextWindow, 0);
2328
2329     if (window)
2330     {
2331       const CGUIControl *control = window->GetControl(data1);
2332       if (control && control->IsContainer())
2333         item = boost::static_pointer_cast<CFileItem>(((CGUIBaseContainer *)control)->GetListItem(info.GetData2(), info.GetInfoFlag()));
2334     }
2335
2336     if (item) // If we got a valid item, do the lookup
2337       return GetItemImage(item.get(), info.m_info); // Image prioritizes images over labels (in the case of music item ratings for instance)
2338   }
2339   else if (info.m_info == PLAYER_TIME)
2340   {
2341     return GetCurrentPlayTime((TIME_FORMAT)info.GetData1());
2342   }
2343   else if (info.m_info == PLAYER_TIME_REMAINING)
2344   {
2345     return GetCurrentPlayTimeRemaining((TIME_FORMAT)info.GetData1());
2346   }
2347   else if (info.m_info == PLAYER_FINISH_TIME)
2348   {
2349     CDateTime time = CDateTime::GetCurrentDateTime();
2350     time += CDateTimeSpan(0, 0, 0, GetPlayTimeRemaining());
2351     return LocalizeTime(time, (TIME_FORMAT)info.GetData1());
2352   }
2353   else if (info.m_info == PLAYER_TIME_SPEED)
2354   {
2355     CStdString strTime;
2356     if (g_application.GetPlaySpeed() != 1)
2357       strTime.Format("%s (%ix)", GetCurrentPlayTime((TIME_FORMAT)info.GetData1()).c_str(), g_application.GetPlaySpeed());
2358     else
2359       strTime = GetCurrentPlayTime();
2360     return strTime;
2361   }
2362   else if (info.m_info == PLAYER_DURATION)
2363   {
2364     return GetDuration((TIME_FORMAT)info.GetData1());
2365   }
2366   else if (info.m_info == PLAYER_SEEKTIME)
2367   {
2368     TIME_FORMAT format = (TIME_FORMAT)info.GetData1();
2369     if (format == TIME_FORMAT_GUESS && GetTotalPlayTime() >= 3600)
2370       format = TIME_FORMAT_HH_MM_SS;
2371     CGUIDialogSeekBar *seekBar = (CGUIDialogSeekBar*)m_gWindowManager.GetWindow(WINDOW_DIALOG_SEEK_BAR);
2372     if (seekBar)
2373       return seekBar->GetSeekTimeLabel(format);
2374   }
2375   else if (info.m_info == SYSTEM_TIME)
2376   {
2377     return GetTime((TIME_FORMAT)info.GetData1());
2378   }
2379   else if (info.m_info == CONTAINER_NUM_PAGES || info.m_info == CONTAINER_CURRENT_PAGE ||
2380            info.m_info == CONTAINER_NUM_ITEMS || info.m_info == CONTAINER_POSITION)
2381   {
2382     const CGUIControl *control = NULL;
2383     if (info.GetData1())
2384     { // container specified
2385       CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
2386       if (window)
2387         control = window->GetControl(info.GetData1());
2388     }
2389     else
2390     { // no container specified - assume a mediawindow
2391       CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2392       if (window)
2393         control = window->GetControl(window->GetViewContainerID());
2394     }
2395     if (control)
2396     {
2397       if (control->IsContainer())
2398         return ((CGUIBaseContainer *)control)->GetLabel(info.m_info);
2399       else if (control->GetControlType() == CGUIControl::GUICONTROL_TEXTBOX)
2400         return ((CGUITextBox *)control)->GetLabel(info.m_info);
2401     }
2402   }
2403   else if (info.m_info == SYSTEM_GET_CORE_USAGE)
2404   {
2405     CStdString strCpu;
2406     strCpu.Format("%4.2f", g_cpuInfo.GetCoreInfo(info.GetData1()).m_fPct);
2407     return strCpu;
2408   }
2409   else if (info.m_info >= MUSICPLAYER_TITLE && info.m_info <= MUSICPLAYER_DISC_NUMBER)
2410     return GetMusicPlaylistInfo(info);
2411   else if (info.m_info == CONTAINER_PROPERTY)
2412   {
2413     CGUIWindow *window = NULL;
2414     if (info.GetData1())
2415     { // container specified
2416       window = GetWindowWithCondition(contextWindow, 0);
2417     }
2418     else
2419     { // no container specified - assume a mediawindow
2420       window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2421     }
2422     if (window)
2423       return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty(m_stringParameters[info.GetData2()]);
2424   }
2425   else if (info.m_info == CONTROL_GET_LABEL)
2426   {
2427     CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
2428     if (window)
2429     {
2430       const CGUIControl *control = window->GetControl(info.GetData1());
2431       if (control)
2432         return control->GetDescription();
2433     }
2434   }
2435   else if (info.m_info == WINDOW_PROPERTY)
2436   {
2437     CGUIWindow *window = NULL;
2438     if (info.GetData1())
2439     { // window specified
2440       window = m_gWindowManager.GetWindow(info.GetData1());//GetWindowWithCondition(contextWindow, 0);
2441     }
2442     else
2443     { // no window specified - assume active
2444       window = m_gWindowManager.GetWindow(m_gWindowManager.GetActiveWindow());
2445     }
2446
2447     if (window)
2448       return window->GetProperty(m_stringParameters[info.GetData2()]);
2449   }
2450
2451   return StringUtils::EmptyString;
2452 }
2453
2454 /// \brief Obtains the filename of the image to show from whichever subsystem is needed
2455 CStdString CGUIInfoManager::GetImage(int info, DWORD contextWindow)
2456 {
2457   if (info >= MULTI_INFO_START && info <= MULTI_INFO_END)
2458   {
2459     return GetMultiInfoLabel(m_multiInfo[info - MULTI_INFO_START], contextWindow);
2460   }
2461   else if (info == WEATHER_CONDITIONS)
2462     return g_weatherManager.GetInfo(WEATHER_IMAGE_CURRENT_ICON);
2463   else if (info == SYSTEM_PROFILETHUMB)
2464   {
2465     CStdString thumb = g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].getThumb();
2466     if (thumb.IsEmpty())
2467       thumb = "unknown-user.png";
2468     return thumb;
2469   }
2470   else if (info == MUSICPLAYER_COVER)
2471   {
2472     if (!g_application.IsPlayingAudio()) return "";
2473     return m_currentFile->HasThumbnail() ? m_currentFile->GetThumbnailImage() : "DefaultAlbumCover.png";
2474   }
2475   else if (info == MUSICPLAYER_RATING)
2476   {
2477     if (!g_application.IsPlayingAudio()) return "";
2478     return GetItemImage(m_currentFile, LISTITEM_RATING);
2479   }
2480   else if (info == PLAYER_STAR_RATING)
2481   {
2482     if (!g_application.IsPlaying()) return "";
2483     return GetItemImage(m_currentFile, LISTITEM_STAR_RATING);
2484   }
2485   else if (info == VIDEOPLAYER_COVER)
2486   {
2487     if (!g_application.IsPlayingVideo()) return "";
2488     if(m_currentMovieThumb.IsEmpty())
2489       return m_currentFile->HasThumbnail() ? m_currentFile->GetThumbnailImage() : "DefaultVideoCover.png";
2490     else return m_currentMovieThumb;
2491   }
2492   else if (info == CONTAINER_FOLDERTHUMB)
2493   {
2494     CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2495     if (window)
2496       return GetItemImage(&const_cast<CFileItemList&>(((CGUIMediaWindow*)window)->CurrentDirectory()), LISTITEM_THUMB);
2497   }
2498   else if (info == CONTAINER_TVSHOWTHUMB)
2499   {
2500     CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2501     if (window)
2502       return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("tvshowthumb");
2503   }
2504   else if (info == CONTAINER_SEASONTHUMB)
2505   {
2506     CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2507     if (window)
2508       return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("seasonthumb");
2509   }
2510   else if (info == LISTITEM_THUMB || info == LISTITEM_ICON || info == LISTITEM_ACTUAL_ICON ||
2511           info == LISTITEM_OVERLAY || info == LISTITEM_RATING || info == LISTITEM_STAR_RATING)
2512   {
2513     CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS);
2514     if (window)
2515     {
2516       CFileItemPtr item = window->GetCurrentListItem();
2517       if (item)
2518         return GetItemImage(item.get(), info);
2519     }
2520   }
2521   return GetLabel(info, contextWindow);
2522 }
2523
2524 CStdString CGUIInfoManager::GetDate(bool bNumbersOnly)
2525 {
2526   CDateTime time=CDateTime::GetCurrentDateTime();
2527   return time.GetAsLocalizedDate(!bNumbersOnly);
2528 }
2529
2530 CStdString CGUIInfoManager::GetTime(TIME_FORMAT format) const
2531 {
2532   CDateTime time=CDateTime::GetCurrentDateTime();
2533   return LocalizeTime(time, format);
2534 }
2535
2536 CStdString CGUIInfoManager::GetLcdTime( int _eInfo ) const
2537 {
2538   CDateTime time=CDateTime::GetCurrentDateTime();
2539   CStdString strLcdTime;
2540
2541 #ifdef HAS_LCD
2542
2543   UINT       nCharset;
2544   UINT       nLine;
2545   CStdString strTimeMarker;
2546
2547   nCharset = 0;
2548   nLine = 0;
2549
2550   switch ( _eInfo )
2551   {
2552     case LCD_TIME_21:
2553       nCharset = 1; // CUSTOM_CHARSET_SMALLCHAR;
2554       nLine = 0;
2555       strTimeMarker = ".";
2556     break;
2557     case LCD_TIME_22:
2558       nCharset = 1; // CUSTOM_CHARSET_SMALLCHAR;
2559       nLine = 1;
2560       strTimeMarker = ".";
2561     break;
2562
2563     case LCD_TIME_W21:
2564       nCharset = 2; // CUSTOM_CHARSET_MEDIUMCHAR;
2565       nLine = 0;
2566       strTimeMarker = ".";
2567     break;
2568     case LCD_TIME_W22:
2569       nCharset = 2; // CUSTOM_CHARSET_MEDIUMCHAR;
2570       nLine = 1;
2571       strTimeMarker = ".";
2572     break;
2573
2574     case LCD_TIME_41:
2575       nCharset = 3; // CUSTOM_CHARSET_BIGCHAR;
2576       nLine = 0;
2577       strTimeMarker = " ";
2578     break;
2579     case LCD_TIME_42:
2580       nCharset = 3; // CUSTOM_CHARSET_BIGCHAR;
2581       nLine = 1;
2582       strTimeMarker = "o";
2583     break;
2584     case LCD_TIME_43:
2585       nCharset = 3; // CUSTOM_CHARSET_BIGCHAR;
2586       nLine = 2;
2587       strTimeMarker = "o";
2588     break;
2589     case LCD_TIME_44:
2590       nCharset = 3; // CUSTOM_CHARSET_BIGCHAR;
2591       nLine = 3;
2592       strTimeMarker = " ";
2593     break;
2594   }
2595
2596   strLcdTime += g_lcd->GetBigDigit( nCharset, time.GetHour()  , nLine, 2, 2, true );
2597   strLcdTime += strTimeMarker;
2598   strLcdTime += g_lcd->GetBigDigit( nCharset, time.GetMinute(), nLine, 2, 2, false );
2599   strLcdTime += strTimeMarker;
2600   strLcdTime += g_lcd->GetBigDigit( nCharset, time.GetSecond(), nLine, 2, 2, false );
2601
2602 #endif
2603
2604   return strLcdTime;
2605 }
2606
2607 CStdString CGUIInfoManager::LocalizeTime(const CDateTime &time, TIME_FORMAT format) const
2608 {
2609   const CStdString timeFormat = g_langInfo.GetTimeFormat();
2610   bool use12hourclock = timeFormat.Find('h') != -1;
2611   switch (format)
2612   {
2613   case TIME_FORMAT_GUESS:
2614     return time.GetAsLocalizedTime("", false);
2615   case TIME_FORMAT_SS:
2616     return time.GetAsLocalizedTime("ss", true);
2617   case TIME_FORMAT_MM:
2618     return time.GetAsLocalizedTime("mm", true);
2619   case TIME_FORMAT_MM_SS:
2620     return time.GetAsLocalizedTime("mm:ss", true);
2621   case TIME_FORMAT_HH:  // this forces it to a 12 hour clock
2622     return time.GetAsLocalizedTime(use12hourclock ? "h" : "HH", false);
2623   case TIME_FORMAT_HH_MM:
2624     return time.GetAsLocalizedTime(use12hourclock ? "h:mm" : "HH:mm", false);
2625   case TIME_FORMAT_HH_MM_SS:
2626     return time.GetAsLocalizedTime("", true);
2627   default:
2628     break;
2629   }
2630   return time.GetAsLocalizedTime("", false);
2631 }
2632
2633 CStdString CGUIInfoManager::GetDuration(TIME_FORMAT format) const
2634 {
2635   CStdString strDuration;
2636   if (g_application.IsPlayingAudio() && m_currentFile->HasMusicInfoTag())
2637   {
2638     const CMusicInfoTag& tag = *m_currentFile->GetMusicInfoTag();
2639     if (tag.GetDuration() > 0)
2640       StringUtils::SecondsToTimeString(tag.GetDuration(), strDuration, format);
2641   }
2642   if (g_application.IsPlayingVideo() && !m_currentMovieDuration.IsEmpty())
2643     return m_currentMovieDuration;  // for tuxbox
2644   if (strDuration.IsEmpty())
2645   {
2646     unsigned int iTotal = (unsigned int)g_application.GetTotalTime();
2647     if (iTotal > 0)
2648       StringUtils::SecondsToTimeString(iTotal, strDuration, format);
2649   }
2650   return strDuration;
2651 }
2652
2653 CStdString CGUIInfoManager::GetMusicPartyModeLabel(int item)
2654 {
2655   // get song counts
2656   if (item >= MUSICPM_SONGSPLAYED && item <= MUSICPM_RANDOMSONGSPICKED)
2657   {
2658     int iSongs = -1;
2659     switch (item)
2660     {
2661     case MUSICPM_SONGSPLAYED:
2662       {
2663         iSongs = g_partyModeManager.GetSongsPlayed();
2664         break;
2665       }
2666     case MUSICPM_MATCHINGSONGS:
2667       {
2668         iSongs = g_partyModeManager.GetMatchingSongs();
2669         break;
2670       }
2671     case MUSICPM_MATCHINGSONGSPICKED:
2672       {
2673         iSongs = g_partyModeManager.GetMatchingSongsPicked();
2674         break;
2675       }
2676     case MUSICPM_MATCHINGSONGSLEFT:
2677       {
2678         iSongs = g_partyModeManager.GetMatchingSongsLeft();
2679         break;
2680       }
2681     case MUSICPM_RELAXEDSONGSPICKED:
2682       {
2683         iSongs = g_partyModeManager.GetRelaxedSongs();
2684         break;
2685       }
2686     case MUSICPM_RANDOMSONGSPICKED:
2687       {
2688         iSongs = g_partyModeManager.GetRandomSongs();
2689         break;
2690       }
2691     }
2692     if (iSongs < 0)
2693       return "";
2694     CStdString strLabel;
2695     strLabel.Format("%i", iSongs);
2696     return strLabel;
2697   }
2698   return "";
2699 }
2700
2701 const CStdString CGUIInfoManager::GetMusicPlaylistInfo(const GUIInfo& info) const
2702 {
2703   PLAYLIST::CPlayList& playlist = g_playlistPlayer.GetPlaylist(PLAYLIST_MUSIC);
2704   if (playlist.size() < 1)
2705     return "";
2706   int index = info.GetData2();
2707   if (info.GetData1() == 1)
2708   { // relative index (requires current playlist is PLAYLIST_MUSIC)
2709     if (g_playlistPlayer.GetCurrentPlaylist() != PLAYLIST_MUSIC)
2710       return "";
2711     index = g_playlistPlayer.GetNextSong(index);
2712   }
2713   if (index < 0 || index >= playlist.size())
2714     return "";
2715   CFileItemPtr playlistItem = playlist[index];
2716   if (!playlistItem->GetMusicInfoTag()->Loaded())
2717   {
2718     playlistItem->LoadMusicTag();
2719     playlistItem->GetMusicInfoTag()->SetLoaded();
2720   }
2721   // try to set a thumbnail
2722   if (!playlistItem->HasThumbnail())
2723   {
2724     playlistItem->SetMusicThumb();
2725     // still no thumb? then just the set the default cover
2726     if (!playlistItem->HasThumbnail())
2727       playlistItem->SetThumbnailImage("DefaultAlbumCover.png");
2728   }
2729   if (info.m_info == MUSICPLAYER_PLAYLISTPOS)
2730   {
2731     CStdString strPosition = "";
2732     strPosition.Format("%i", index + 1);
2733     return strPosition;
2734   }
2735   else if (info.m_info == MUSICPLAYER_COVER)
2736     return playlistItem->GetThumbnailImage();
2737   return GetMusicTagLabel(info.m_info, playlistItem.get());
2738 }
2739
2740 CStdString CGUIInfoManager::GetPlaylistLabel(int item) const
2741 {
2742   if (!g_application.IsPlaying()) return "";
2743   int iPlaylist = g_playlistPlayer.GetCurrentPlaylist();
2744   switch (item)
2745   {
2746   case PLAYLIST_LENGTH:
2747     {
2748       CStdString strLength = "";
2749       strLength.Format("%i", g_playlistPlayer.GetPlaylist(iPlaylist).size());
2750       return strLength;
2751     }
2752   case PLAYLIST_POSITION:
2753     {
2754       CStdString strPosition = "";
2755       strPosition.Format("%i", g_playlistPlayer.GetCurrentSong() + 1);
2756       return strPosition;
2757     }
2758   case PLAYLIST_RANDOM:
2759     {
2760       if (g_playlistPlayer.IsShuffled(iPlaylist))
2761         return g_localizeStrings.Get(590); // 590: Random
2762       else
2763         return g_localizeStrings.Get(591); // 591: Off
2764     }
2765   case PLAYLIST_REPEAT:
2766     {
2767       PLAYLIST::REPEAT_STATE state = g_playlistPlayer.GetRepeat(iPlaylist);
2768       if (state == PLAYLIST::REPEAT_ONE)
2769         return g_localizeStrings.Get(592); // 592: One
2770       else if (state == PLAYLIST::REPEAT_ALL)
2771         return g_localizeStrings.Get(593); // 593: All
2772       else
2773         return g_localizeStrings.Get(594); // 594: Off
2774     }
2775   }
2776   return "";
2777 }
2778
2779 CStdString CGUIInfoManager::GetMusicLabel(int item)
2780 {
2781   if (!g_application.IsPlayingAudio() || !m_currentFile->HasMusicInfoTag()) return "";
2782   switch (item)
2783   {
2784   case MUSICPLAYER_PLAYLISTLEN:
2785     {
2786       if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
2787         return GetPlaylistLabel(PLAYLIST_LENGTH);
2788     }
2789    &