2 * Copyright (C) 2005-2008 Team XBMC
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)
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.
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
23 #include "dialogs/GUIDialogSeekBar.h"
24 #include "windows/GUIMediaWindow.h"
25 #include "dialogs/GUIDialogFileBrowser.h"
26 #include "settings/GUIDialogContentSettings.h"
27 #include "dialogs/GUIDialogProgress.h"
28 #include "Application.h"
30 #include "network/libscrobbler/lastfmscrobbler.h"
31 #include "utils/URIUtils.h"
32 #include "utils/Weather.h"
33 #include "PartyModeManager.h"
34 #include "addons/Visualisation.h"
35 #include "input/ButtonTranslator.h"
36 #include "utils/AlarmClock.h"
38 #include "utils/LCD.h"
40 #include "GUIPassword.h"
42 #include "utils/SystemInfo.h"
43 #include "guilib/GUIButtonScroller.h"
44 #include "guilib/GUITextBox.h"
45 #include "GUIInfoManager.h"
46 #include "pictures/GUIWindowSlideShow.h"
47 #include "music/LastFmManager.h"
48 #include "pictures/PictureInfoTag.h"
49 #include "music/tags/MusicInfoTag.h"
50 #include "music/dialogs/GUIDialogMusicScan.h"
51 #include "video/dialogs/GUIDialogVideoScan.h"
52 #include "guilib/GUIWindowManager.h"
53 #include "filesystem/File.h"
54 #include "playlists/PlayList.h"
55 #include "utils/TuxBoxUtil.h"
56 #include "windowing/WindowingFactory.h"
57 #include "powermanagement/PowerManager.h"
58 #include "settings/AdvancedSettings.h"
59 #include "settings/Settings.h"
60 #include "guilib/LocalizeStrings.h"
61 #include "utils/CPUInfo.h"
62 #include "utils/StringUtils.h"
63 #include "utils/MathUtils.h"
65 // stuff for current song
66 #include "music/tags/MusicInfoTagLoaderFactory.h"
67 #include "music/MusicInfoLoader.h"
68 #include "utils/LabelFormatter.h"
70 #include "GUIUserMessages.h"
71 #include "video/dialogs/GUIDialogVideoInfo.h"
72 #include "music/dialogs/GUIDialogMusicInfo.h"
73 #include "storage/MediaManager.h"
74 #include "utils/TimeUtils.h"
75 #include "threads/SingleLock.h"
76 #include "utils/log.h"
78 #include "addons/AddonManager.h"
80 #define SYSHEATUPDATEINTERVAL 60000
83 using namespace XFILE;
84 using namespace MUSIC_INFO;
85 using namespace ADDON;
87 CGUIInfoManager::CCombinedValue& CGUIInfoManager::CCombinedValue::operator =(const CGUIInfoManager::CCombinedValue& mSrc)
89 this->m_info = mSrc.m_info;
90 this->m_id = mSrc.m_id;
91 this->m_postfix = mSrc.m_postfix;
95 CGUIInfoManager::CGUIInfoManager(void)
97 m_lastSysHeatInfoTime = -SYSHEATUPDATEINTERVAL; // make sure we grab CPU temp on the first pass
98 m_lastMusicBitrateTime = 0;
100 m_AfterSeekTimeout = 0;
102 m_playerSeeking = false;
103 m_performingSeek = false;
104 m_nextWindowID = WINDOW_INVALID;
105 m_prevWindowID = WINDOW_INVALID;
106 m_stringParameters.push_back("__ZZZZ__"); // to offset the string parameters by 1 to assure that all entries are non-zero
107 m_currentFile = new CFileItem;
108 m_currentSlide = new CFileItem;
114 CGUIInfoManager::~CGUIInfoManager(void)
116 delete m_currentFile;
117 delete m_currentSlide;
120 bool CGUIInfoManager::OnMessage(CGUIMessage &message)
122 if (message.GetMessage() == GUI_MSG_NOTIFY_ALL)
124 if (message.GetParam1() == GUI_MSG_UPDATE_ITEM && message.GetItem())
126 CFileItemPtr item = boost::static_pointer_cast<CFileItem>(message.GetItem());
127 if (item && m_currentFile->m_strPath.Equals(item->m_strPath))
128 *m_currentFile = *item;
135 /// \brief Translates a string as given by the skin into an int that we use for more
136 /// efficient retrieval of data. Can handle combined strings on the form
137 /// Player.Caching + VideoPlayer.IsFullscreen (Logical and)
138 /// Player.HasVideo | Player.HasAudio (Logical or)
139 int CGUIInfoManager::TranslateString(const CStdString &condition)
141 // translate $LOCALIZE as required
142 CStdString strCondition(CGUIInfoLabel::ReplaceLocalize(condition));
143 if (strCondition.find_first_of("|") != strCondition.npos ||
144 strCondition.find_first_of("+") != strCondition.npos ||
145 strCondition.find_first_of("[") != strCondition.npos ||
146 strCondition.find_first_of("]") != strCondition.npos)
148 // Have a boolean expression
149 // Check if this was added before
150 vector<CCombinedValue>::iterator it;
151 for(it = m_CombinedValues.begin(); it != m_CombinedValues.end(); it++)
153 if(strCondition.CompareNoCase(it->m_info) == 0)
156 return TranslateBooleanExpression(strCondition);
158 //Just single command.
159 return TranslateSingleString(strCondition);
163 /// \brief Translates a string as given by the skin into an int that we use for more
164 /// efficient retrieval of data.
165 int CGUIInfoManager::TranslateSingleString(const CStdString &strCondition)
167 // trim whitespace, and convert to lowercase
168 CStdString strTest = strCondition;
169 strTest.TrimLeft(" \t\r\n");
170 strTest.TrimRight(" \t\r\n");
171 if (strTest.IsEmpty()) return 0;
173 bool bNegate = strTest[0] == '!';
177 strTest.Delete(0, 1);
178 CStdString original(strTest);
181 CStdString strCategory = strTest.Left(strTest.Find("."));
183 // translate conditions...
184 if (strTest.Equals("false") || strTest.Equals("no") || strTest.Equals("off")) ret = SYSTEM_ALWAYS_FALSE;
185 else if (strTest.Equals("true") || strTest.Equals("yes") || strTest.Equals("on")) ret = SYSTEM_ALWAYS_TRUE;
186 if (strCategory.Equals("player"))
188 if (strTest.Equals("player.hasmedia")) ret = PLAYER_HAS_MEDIA;
189 else if (strTest.Equals("player.hasaudio")) ret = PLAYER_HAS_AUDIO;
190 else if (strTest.Equals("player.hasvideo")) ret = PLAYER_HAS_VIDEO;
191 else if (strTest.Equals("player.playing")) ret = PLAYER_PLAYING;
192 else if (strTest.Equals("player.paused")) ret = PLAYER_PAUSED;
193 else if (strTest.Equals("player.rewinding")) ret = PLAYER_REWINDING;
194 else if (strTest.Equals("player.forwarding")) ret = PLAYER_FORWARDING;
195 else if (strTest.Equals("player.rewinding2x")) ret = PLAYER_REWINDING_2x;
196 else if (strTest.Equals("player.rewinding4x")) ret = PLAYER_REWINDING_4x;
197 else if (strTest.Equals("player.rewinding8x")) ret = PLAYER_REWINDING_8x;
198 else if (strTest.Equals("player.rewinding16x")) ret = PLAYER_REWINDING_16x;
199 else if (strTest.Equals("player.rewinding32x")) ret = PLAYER_REWINDING_32x;
200 else if (strTest.Equals("player.forwarding2x")) ret = PLAYER_FORWARDING_2x;
201 else if (strTest.Equals("player.forwarding4x")) ret = PLAYER_FORWARDING_4x;
202 else if (strTest.Equals("player.forwarding8x")) ret = PLAYER_FORWARDING_8x;
203 else if (strTest.Equals("player.forwarding16x")) ret = PLAYER_FORWARDING_16x;
204 else if (strTest.Equals("player.forwarding32x")) ret = PLAYER_FORWARDING_32x;
205 else if (strTest.Equals("player.canrecord")) ret = PLAYER_CAN_RECORD;
206 else if (strTest.Equals("player.recording")) ret = PLAYER_RECORDING;
207 else if (strTest.Equals("player.displayafterseek")) ret = PLAYER_DISPLAY_AFTER_SEEK;
208 else if (strTest.Equals("player.caching")) ret = PLAYER_CACHING;
209 else if (strTest.Equals("player.cachelevel")) ret = PLAYER_CACHELEVEL;
210 else if (strTest.Equals("player.seekbar")) ret = PLAYER_SEEKBAR;
211 else if (strTest.Equals("player.progress")) ret = PLAYER_PROGRESS;
212 else if (strTest.Equals("player.seeking")) ret = PLAYER_SEEKING;
213 else if (strTest.Equals("player.showtime")) ret = PLAYER_SHOWTIME;
214 else if (strTest.Equals("player.showcodec")) ret = PLAYER_SHOWCODEC;
215 else if (strTest.Equals("player.showinfo")) ret = PLAYER_SHOWINFO;
216 else if (strTest.Left(15).Equals("player.seektime")) return AddMultiInfo(GUIInfo(PLAYER_SEEKTIME, TranslateTimeFormat(strTest.Mid(15))));
217 else if (strTest.Left(17).Equals("player.seekoffset")) return AddMultiInfo(GUIInfo(PLAYER_SEEKOFFSET, TranslateTimeFormat(strTest.Mid(17))));
218 else if (strTest.Left(20).Equals("player.timeremaining")) return AddMultiInfo(GUIInfo(PLAYER_TIME_REMAINING, TranslateTimeFormat(strTest.Mid(20))));
219 else if (strTest.Left(16).Equals("player.timespeed")) return AddMultiInfo(GUIInfo(PLAYER_TIME_SPEED, TranslateTimeFormat(strTest.Mid(16))));
220 else if (strTest.Left(11).Equals("player.time")) return AddMultiInfo(GUIInfo(PLAYER_TIME, TranslateTimeFormat(strTest.Mid(11))));
221 else if (strTest.Left(15).Equals("player.duration")) return AddMultiInfo(GUIInfo(PLAYER_DURATION, TranslateTimeFormat(strTest.Mid(15))));
222 else if (strTest.Left(17).Equals("player.finishtime")) return AddMultiInfo(GUIInfo(PLAYER_FINISH_TIME, TranslateTimeFormat(strTest.Mid(17))));
223 else if (strTest.Equals("player.volume")) ret = PLAYER_VOLUME;
224 else if (strTest.Equals("player.subtitledelay")) ret = PLAYER_SUBTITLE_DELAY;
225 else if (strTest.Equals("player.audiodelay")) ret = PLAYER_AUDIO_DELAY;
226 else if (strTest.Equals("player.muted")) ret = PLAYER_MUTED;
227 else if (strTest.Equals("player.hasduration")) ret = PLAYER_HASDURATION;
228 else if (strTest.Equals("player.chapter")) ret = PLAYER_CHAPTER;
229 else if (strTest.Equals("player.chaptercount")) ret = PLAYER_CHAPTERCOUNT;
230 else if (strTest.Equals("player.chaptername")) ret = PLAYER_CHAPTERNAME;
231 else if (strTest.Equals("player.starrating")) ret = PLAYER_STAR_RATING;
232 else if (strTest.Equals("player.passthrough")) ret = PLAYER_PASSTHROUGH;
233 else if (strTest.Equals("player.folderpath")) ret = PLAYER_PATH;
234 else if (strTest.Equals("player.filenameandpath")) ret = PLAYER_FILEPATH;
236 else if (strCategory.Equals("weather"))
238 if (strTest.Equals("weather.conditions")) ret = WEATHER_CONDITIONS;
239 else if (strTest.Equals("weather.temperature")) ret = WEATHER_TEMPERATURE;
240 else if (strTest.Equals("weather.location")) ret = WEATHER_LOCATION;
241 else if (strTest.Equals("weather.isfetched")) ret = WEATHER_IS_FETCHED;
242 else if (strTest.Equals("weather.fanartcode")) ret = WEATHER_FANART_CODE;
243 else if (strTest.Equals("weather.plugin")) ret = WEATHER_PLUGIN;
245 else if (strCategory.Equals("bar"))
247 if (strTest.Equals("bar.gputemperature")) ret = SYSTEM_GPU_TEMPERATURE;
248 else if (strTest.Equals("bar.cputemperature")) ret = SYSTEM_CPU_TEMPERATURE;
249 else if (strTest.Equals("bar.cpuusage")) ret = SYSTEM_CPU_USAGE;
250 else if (strTest.Equals("bar.freememory")) ret = SYSTEM_FREE_MEMORY;
251 else if (strTest.Equals("bar.usedmemory")) ret = SYSTEM_USED_MEMORY;
252 else if (strTest.Equals("bar.fanspeed")) ret = SYSTEM_FAN_SPEED;
253 else if (strTest.Equals("bar.usedspace")) ret = SYSTEM_USED_SPACE;
254 else if (strTest.Equals("bar.freespace")) ret = SYSTEM_FREE_SPACE;
255 else if (strTest.Equals("bar.usedspace(c)")) ret = SYSTEM_USED_SPACE_C;
256 else if (strTest.Equals("bar.freespace(c)")) ret = SYSTEM_FREE_SPACE_C;
257 else if (strTest.Equals("bar.usedspace(e)")) ret = SYSTEM_USED_SPACE_E;
258 else if (strTest.Equals("bar.freespace(e)")) ret = SYSTEM_FREE_SPACE_E;
259 else if (strTest.Equals("bar.usedspace(f)")) ret = SYSTEM_USED_SPACE_F;
260 else if (strTest.Equals("bar.freespace(f)")) ret = SYSTEM_FREE_SPACE_F;
261 else if (strTest.Equals("bar.usedspace(g)")) ret = SYSTEM_USED_SPACE_G;
262 else if (strTest.Equals("bar.freespace(g)")) ret = SYSTEM_FREE_SPACE_G;
263 else if (strTest.Equals("bar.usedspace(x)")) ret = SYSTEM_USED_SPACE_X;
264 else if (strTest.Equals("bar.freespace(x)")) ret = SYSTEM_FREE_SPACE_X;
265 else if (strTest.Equals("bar.usedspace(y)")) ret = SYSTEM_USED_SPACE_Y;
266 else if (strTest.Equals("bar.freespace(y)")) ret = SYSTEM_FREE_SPACE_Y;
267 else if (strTest.Equals("bar.usedspace(z)")) ret = SYSTEM_USED_SPACE_Z;
268 else if (strTest.Equals("bar.freespace(z)")) ret = SYSTEM_FREE_SPACE_Z;
269 else if (strTest.Equals("bar.hddtemperature")) ret = SYSTEM_HDD_TEMPERATURE;
271 else if (strCategory.Equals("system"))
273 if (strTest.Equals("system.date")) ret = SYSTEM_DATE;
274 else if (strTest.Left(12).Equals("system.date("))
276 // the skin must submit the date in the format MM-DD
277 // This InfoBool is designed for generic range checking, so year is NOT used. Only Month-Day.
278 CStdString param = strTest.Mid(12, strTest.length() - 13);
279 CStdStringArray params;
280 StringUtils::SplitString(param, ",", params);
281 if (params.size() == 2)
282 return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_DATE : SYSTEM_DATE, StringUtils::DateStringToYYYYMMDD(params[0]) % 10000, StringUtils::DateStringToYYYYMMDD(params[1]) % 10000));
283 else if (params.size() == 1)
284 return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_DATE : SYSTEM_DATE, StringUtils::DateStringToYYYYMMDD(params[0]) % 10000));
286 else if (strTest.Left(11).Equals("system.time"))
288 // 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
289 // essentially if it isn't a valid TIME_FORMAT then its considered to be the latter.
290 CStdString param = strTest.Mid(11);
291 TIME_FORMAT timeFormat = TranslateTimeFormat(param);
292 if ((timeFormat == TIME_FORMAT_GUESS) && (!param.IsEmpty()))
294 param = strTest.Mid(12, strTest.length() - 13);
295 CStdStringArray params;
296 StringUtils::SplitString(param, ",", params);
297 if (params.size() == 2)
298 return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_TIME : SYSTEM_TIME, StringUtils::TimeStringToSeconds(params[0]), StringUtils::TimeStringToSeconds(params[1])));
299 else if (params.size() == 1)
300 return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_TIME : SYSTEM_TIME, StringUtils::TimeStringToSeconds(params[0])));
303 return AddMultiInfo(GUIInfo(SYSTEM_TIME, timeFormat));
305 else if (strTest.Equals("system.cputemperature")) ret = SYSTEM_CPU_TEMPERATURE;
306 else if (strTest.Equals("system.cpuusage")) ret = SYSTEM_CPU_USAGE;
307 else if (strTest.Equals("system.gputemperature")) ret = SYSTEM_GPU_TEMPERATURE;
308 else if (strTest.Equals("system.fanspeed")) ret = SYSTEM_FAN_SPEED;
309 else if (strTest.Equals("system.freespace")) ret = SYSTEM_FREE_SPACE;
310 else if (strTest.Equals("system.usedspace")) ret = SYSTEM_USED_SPACE;
311 else if (strTest.Equals("system.totalspace")) ret = SYSTEM_TOTAL_SPACE;
312 else if (strTest.Equals("system.usedspacepercent")) ret = SYSTEM_USED_SPACE_PERCENT;
313 else if (strTest.Equals("system.freespacepercent")) ret = SYSTEM_FREE_SPACE_PERCENT;
314 else if (strTest.Equals("system.freespace(c)")) ret = SYSTEM_FREE_SPACE_C;
315 else if (strTest.Equals("system.usedspace(c)")) ret = SYSTEM_USED_SPACE_C;
316 else if (strTest.Equals("system.totalspace(c)")) ret = SYSTEM_TOTAL_SPACE_C;
317 else if (strTest.Equals("system.usedspacepercent(c)")) ret = SYSTEM_USED_SPACE_PERCENT_C;
318 else if (strTest.Equals("system.freespacepercent(c)")) ret = SYSTEM_FREE_SPACE_PERCENT_C;
319 else if (strTest.Equals("system.freespace(e)")) ret = SYSTEM_FREE_SPACE_E;
320 else if (strTest.Equals("system.usedspace(e)")) ret = SYSTEM_USED_SPACE_E;
321 else if (strTest.Equals("system.totalspace(e)")) ret = SYSTEM_TOTAL_SPACE_E;
322 else if (strTest.Equals("system.usedspacepercent(e)")) ret = SYSTEM_USED_SPACE_PERCENT_E;
323 else if (strTest.Equals("system.freespacepercent(e)")) ret = SYSTEM_FREE_SPACE_PERCENT_E;
324 else if (strTest.Equals("system.freespace(f)")) ret = SYSTEM_FREE_SPACE_F;
325 else if (strTest.Equals("system.usedspace(f)")) ret = SYSTEM_USED_SPACE_F;
326 else if (strTest.Equals("system.totalspace(f)")) ret = SYSTEM_TOTAL_SPACE_F;
327 else if (strTest.Equals("system.usedspacepercent(f)")) ret = SYSTEM_USED_SPACE_PERCENT_F;
328 else if (strTest.Equals("system.freespacepercent(f)")) ret = SYSTEM_FREE_SPACE_PERCENT_F;
329 else if (strTest.Equals("system.freespace(g)")) ret = SYSTEM_FREE_SPACE_G;
330 else if (strTest.Equals("system.usedspace(g)")) ret = SYSTEM_USED_SPACE_G;
331 else if (strTest.Equals("system.totalspace(g)")) ret = SYSTEM_TOTAL_SPACE_G;
332 else if (strTest.Equals("system.usedspacepercent(g)")) ret = SYSTEM_USED_SPACE_PERCENT_G;
333 else if (strTest.Equals("system.freespacepercent(g)")) ret = SYSTEM_FREE_SPACE_PERCENT_G;
334 else if (strTest.Equals("system.usedspace(x)")) ret = SYSTEM_USED_SPACE_X;
335 else if (strTest.Equals("system.freespace(x)")) ret = SYSTEM_FREE_SPACE_X;
336 else if (strTest.Equals("system.totalspace(x)")) ret = SYSTEM_TOTAL_SPACE_X;
337 else if (strTest.Equals("system.usedspace(y)")) ret = SYSTEM_USED_SPACE_Y;
338 else if (strTest.Equals("system.freespace(y)")) ret = SYSTEM_FREE_SPACE_Y;
339 else if (strTest.Equals("system.totalspace(y)")) ret = SYSTEM_TOTAL_SPACE_Y;
340 else if (strTest.Equals("system.usedspace(z)")) ret = SYSTEM_USED_SPACE_Z;
341 else if (strTest.Equals("system.freespace(z)")) ret = SYSTEM_FREE_SPACE_Z;
342 else if (strTest.Equals("system.totalspace(z)")) ret = SYSTEM_TOTAL_SPACE_Z;
343 else if (strTest.Equals("system.buildversion")) ret = SYSTEM_BUILD_VERSION;
344 else if (strTest.Equals("system.builddate")) ret = SYSTEM_BUILD_DATE;
345 else if (strTest.Equals("system.hasnetwork")) ret = SYSTEM_ETHERNET_LINK_ACTIVE;
346 else if (strTest.Equals("system.fps")) ret = SYSTEM_FPS;
347 else if (strTest.Equals("system.hasmediadvd")) ret = SYSTEM_MEDIA_DVD;
348 else if (strTest.Equals("system.dvdready")) ret = SYSTEM_DVDREADY;
349 else if (strTest.Equals("system.trayopen")) ret = SYSTEM_TRAYOPEN;
350 else if (strTest.Equals("system.dvdtraystate")) ret = SYSTEM_DVD_TRAY_STATE;
352 else if (strTest.Equals("system.memory(free)") || strTest.Equals("system.freememory")) ret = SYSTEM_FREE_MEMORY;
353 else if (strTest.Equals("system.memory(free.percent)")) ret = SYSTEM_FREE_MEMORY_PERCENT;
354 else if (strTest.Equals("system.memory(used)")) ret = SYSTEM_USED_MEMORY;
355 else if (strTest.Equals("system.memory(used.percent)")) ret = SYSTEM_USED_MEMORY_PERCENT;
356 else if (strTest.Equals("system.memory(total)")) ret = SYSTEM_TOTAL_MEMORY;
358 else if (strTest.Equals("system.language")) ret = SYSTEM_LANGUAGE;
359 else if (strTest.Equals("system.temperatureunits")) ret = SYSTEM_TEMPERATURE_UNITS;
360 else if (strTest.Equals("system.screenmode")) ret = SYSTEM_SCREEN_MODE;
361 else if (strTest.Equals("system.screenwidth")) ret = SYSTEM_SCREEN_WIDTH;
362 else if (strTest.Equals("system.screenheight")) ret = SYSTEM_SCREEN_HEIGHT;
363 else if (strTest.Equals("system.currentwindow")) ret = SYSTEM_CURRENT_WINDOW;
364 else if (strTest.Equals("system.currentcontrol")) ret = SYSTEM_CURRENT_CONTROL;
365 else if (strTest.Equals("system.dvdlabel")) ret = SYSTEM_DVD_LABEL;
366 else if (strTest.Equals("system.haslocks")) ret = SYSTEM_HASLOCKS;
367 else if (strTest.Equals("system.hasloginscreen")) ret = SYSTEM_HAS_LOGINSCREEN;
368 else if (strTest.Equals("system.ismaster")) ret = SYSTEM_ISMASTER;
369 else if (strTest.Equals("system.internetstate")) ret = SYSTEM_INTERNET_STATE;
370 else if (strTest.Equals("system.loggedon")) ret = SYSTEM_LOGGEDON;
371 else if (strTest.Equals("system.hasdrivef")) ret = SYSTEM_HAS_DRIVE_F;
372 else if (strTest.Equals("system.hasdriveg")) ret = SYSTEM_HAS_DRIVE_G;
373 else if (strTest.Equals("system.kernelversion")) ret = SYSTEM_KERNEL_VERSION;
374 else if (strTest.Equals("system.uptime")) ret = SYSTEM_UPTIME;
375 else if (strTest.Equals("system.totaluptime")) ret = SYSTEM_TOTALUPTIME;
376 else if (strTest.Equals("system.cpufrequency")) ret = SYSTEM_CPUFREQUENCY;
377 else if (strTest.Equals("system.screenresolution")) ret = SYSTEM_SCREEN_RESOLUTION;
378 else if (strTest.Equals("system.videoencoderinfo")) ret = SYSTEM_VIDEO_ENCODER_INFO;
379 else if (strTest.Left(16).Equals("system.idletime("))
381 int time = atoi((strTest.Mid(16, strTest.GetLength() - 17).c_str()));
382 if (time > SYSTEM_IDLE_TIME_FINISH - SYSTEM_IDLE_TIME_START)
383 time = SYSTEM_IDLE_TIME_FINISH - SYSTEM_IDLE_TIME_START;
385 ret = SYSTEM_IDLE_TIME_START + time;
387 else if (strTest.Left(16).Equals("system.hasalarm("))
388 return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_HAS_ALARM : SYSTEM_HAS_ALARM, ConditionalStringParameter(strTest.Mid(16,strTest.size()-17)), 0));
389 else if (strTest.Equals("system.alarmpos")) ret = SYSTEM_ALARM_POS;
390 else if (strTest.Left(24).Equals("system.alarmlessorequal("))
392 int pos = strTest.Find(",");
393 int skinOffset = ConditionalStringParameter(strTest.Mid(24, pos-24));
394 int compareString = ConditionalStringParameter(strTest.Mid(pos + 1, strTest.GetLength() - (pos + 2)));
395 return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_ALARM_LESS_OR_EQUAL: SYSTEM_ALARM_LESS_OR_EQUAL, skinOffset, compareString));
397 else if (strTest.Equals("system.profilename")) ret = SYSTEM_PROFILENAME;
398 else if (strTest.Equals("system.profilethumb")) ret = SYSTEM_PROFILETHUMB;
399 else if (strTest.Equals("system.profilecount")) ret = SYSTEM_PROFILECOUNT;
400 else if (strTest.Equals("system.progressbar")) ret = SYSTEM_PROGRESS_BAR;
401 else if (strTest.Equals("system.platform.linux")) ret = SYSTEM_PLATFORM_LINUX;
402 else if (strTest.Equals("system.platform.xbox")) ret = SYSTEM_PLATFORM_XBOX;
403 else if (strTest.Equals("system.platform.windows")) ret = SYSTEM_PLATFORM_WINDOWS;
404 else if (strTest.Equals("system.platform.osx")) ret = SYSTEM_PLATFORM_OSX;
405 else if (strTest.Left(15).Equals("system.getbool("))
406 return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_GET_BOOL : SYSTEM_GET_BOOL, ConditionalStringParameter(strTest.Mid(15,strTest.size()-16)), 0));
407 else if (strTest.Left(17).Equals("system.coreusage("))
408 return AddMultiInfo(GUIInfo(SYSTEM_GET_CORE_USAGE, atoi(strTest.Mid(17,strTest.size()-18)), 0));
409 else if (strTest.Left(17).Equals("system.hascoreid("))
410 return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_HAS_CORE_ID : SYSTEM_HAS_CORE_ID, ConditionalStringParameter(strTest.Mid(17,strTest.size()-18)), 0));
411 else if (strTest.Left(15).Equals("system.setting("))
412 return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_SETTING : SYSTEM_SETTING, ConditionalStringParameter(strTest.Mid(15,strTest.size()-16)), 0));
413 else if (strTest.Equals("system.canpowerdown")) ret = SYSTEM_CAN_POWERDOWN;
414 else if (strTest.Equals("system.cansuspend")) ret = SYSTEM_CAN_SUSPEND;
415 else if (strTest.Equals("system.canhibernate")) ret = SYSTEM_CAN_HIBERNATE;
416 else if (strTest.Equals("system.canreboot")) ret = SYSTEM_CAN_REBOOT;
417 else if (strTest.Left(16).Equals("system.hasaddon("))
418 return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_HAS_ADDON: SYSTEM_HAS_ADDON, ConditionalStringParameter(strTest.Mid(16,strTest.size()-17)), 0));
419 else if (strTest.Left(18).Equals("system.addontitle("))
421 CStdString param = strTest.Mid(18,strTest.size()-19);
422 int info = TranslateString(param);
424 return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_ADDON_TITLE: SYSTEM_ADDON_TITLE, info, 0));
425 // pipe our original string through the localize parsing then make it lowercase (picks up $LBRACKET etc.)
426 CStdString label = CGUIInfoLabel::GetLabel(param).ToLower();
427 int compareString = ConditionalStringParameter(label);
428 return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_ADDON_TITLE: SYSTEM_ADDON_TITLE, compareString, 1));
430 else if (strTest.Left(17).Equals("system.addonicon("))
432 CStdString param = strTest.Mid(17,strTest.size()-18);
433 int info = TranslateString(param);
435 return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_ADDON_ICON: SYSTEM_ADDON_ICON, info, 0));
436 // pipe our original string through the localize parsing then make it lowercase (picks up $LBRACKET etc.)
437 CStdString label = CGUIInfoLabel::GetLabel(param).ToLower();
438 int compareString = ConditionalStringParameter(label);
439 return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_ADDON_ICON : SYSTEM_ADDON_ICON, compareString, 1));
442 // library test conditions
443 else if (strTest.Left(7).Equals("library"))
445 if (strTest.Equals("library.hascontent(music)")) ret = LIBRARY_HAS_MUSIC;
446 else if (strTest.Equals("library.hascontent(video)")) ret = LIBRARY_HAS_VIDEO;
447 else if (strTest.Equals("library.hascontent(movies)")) ret = LIBRARY_HAS_MOVIES;
448 else if (strTest.Equals("library.hascontent(tvshows)")) ret = LIBRARY_HAS_TVSHOWS;
449 else if (strTest.Equals("library.hascontent(musicvideos)")) ret = LIBRARY_HAS_MUSICVIDEOS;
450 else if (strTest.Equals("library.isscanning")) ret = LIBRARY_IS_SCANNING;
452 else if (strTest.Left(8).Equals("isempty("))
454 CStdString str = strTest.Mid(8, strTest.GetLength() - 9);
455 return AddMultiInfo(GUIInfo(bNegate ? -STRING_IS_EMPTY : STRING_IS_EMPTY, TranslateSingleString(str)));
457 else if (strTest.Left(14).Equals("stringcompare("))
459 int pos = strTest.Find(",");
460 int info = TranslateString(strTest.Mid(14, pos-14));
461 int info2 = TranslateString(strTest.Mid(pos + 1, strTest.GetLength() - (pos + 2)));
463 return AddMultiInfo(GUIInfo(bNegate ? -STRING_COMPARE: STRING_COMPARE, info, -info2));
464 // pipe our original string through the localize parsing then make it lowercase (picks up $LBRACKET etc.)
465 CStdString label = CGUIInfoLabel::GetLabel(original.Mid(pos + 1, original.GetLength() - (pos + 2))).ToLower();
466 int compareString = ConditionalStringParameter(label);
467 return AddMultiInfo(GUIInfo(bNegate ? -STRING_COMPARE: STRING_COMPARE, info, compareString));
469 else if (strTest.Left(19).Equals("integergreaterthan("))
471 int pos = strTest.Find(",");
472 int info = TranslateString(strTest.Mid(19, pos-19));
473 int compareInt = atoi(strTest.Mid(pos + 1, strTest.GetLength() - (pos + 2)).c_str());
474 return AddMultiInfo(GUIInfo(bNegate ? -INTEGER_GREATER_THAN: INTEGER_GREATER_THAN, info, compareInt));
476 else if (strTest.Left(10).Equals("substring("))
478 int pos = strTest.Find(",");
479 int info = TranslateString(strTest.Mid(10, pos-10));
480 // pipe our original string through the localize parsing then make it lowercase (picks up $LBRACKET etc.)
481 CStdString label = CGUIInfoLabel::GetLabel(original.Mid(pos + 1, original.GetLength() - (pos + 2))).ToLower();
482 int compareString = ConditionalStringParameter(label);
483 return AddMultiInfo(GUIInfo(bNegate ? -STRING_STR: STRING_STR, info, compareString));
485 else if (strCategory.Equals("lcd"))
487 if (strTest.Equals("lcd.playicon")) ret = LCD_PLAY_ICON;
488 else if (strTest.Equals("lcd.progressbar")) ret = LCD_PROGRESS_BAR;
489 else if (strTest.Equals("lcd.cputemperature")) ret = LCD_CPU_TEMPERATURE;
490 else if (strTest.Equals("lcd.gputemperature")) ret = LCD_GPU_TEMPERATURE;
491 else if (strTest.Equals("lcd.hddtemperature")) ret = LCD_HDD_TEMPERATURE;
492 else if (strTest.Equals("lcd.fanspeed")) ret = LCD_FAN_SPEED;
493 else if (strTest.Equals("lcd.date")) ret = LCD_DATE;
494 else if (strTest.Equals("lcd.freespace(c)")) ret = LCD_FREE_SPACE_C;
495 else if (strTest.Equals("lcd.freespace(e)")) ret = LCD_FREE_SPACE_E;
496 else if (strTest.Equals("lcd.freespace(f)")) ret = LCD_FREE_SPACE_F;
497 else if (strTest.Equals("lcd.freespace(g)")) ret = LCD_FREE_SPACE_G;
498 else if (strTest.Equals("lcd.Time21")) ret = LCD_TIME_21; // Small LCD numbers
499 else if (strTest.Equals("lcd.Time22")) ret = LCD_TIME_22;
500 else if (strTest.Equals("lcd.TimeWide21")) ret = LCD_TIME_W21; // Medium LCD numbers
501 else if (strTest.Equals("lcd.TimeWide22")) ret = LCD_TIME_W22;
502 else if (strTest.Equals("lcd.Time41")) ret = LCD_TIME_41; // Big LCD numbers
503 else if (strTest.Equals("lcd.Time42")) ret = LCD_TIME_42;
504 else if (strTest.Equals("lcd.Time43")) ret = LCD_TIME_43;
505 else if (strTest.Equals("lcd.Time44")) ret = LCD_TIME_44;
507 else if (strCategory.Equals("network"))
509 if (strTest.Equals("network.ipaddress")) ret = NETWORK_IP_ADDRESS;
510 if (strTest.Equals("network.isdhcp")) ret = NETWORK_IS_DHCP;
511 if (strTest.Equals("network.linkstate")) ret = NETWORK_LINK_STATE;
512 if (strTest.Equals("network.macaddress")) ret = NETWORK_MAC_ADDRESS;
513 if (strTest.Equals("network.subnetaddress")) ret = NETWORK_SUBNET_ADDRESS;
514 if (strTest.Equals("network.gatewayaddress")) ret = NETWORK_GATEWAY_ADDRESS;
515 if (strTest.Equals("network.dns1address")) ret = NETWORK_DNS1_ADDRESS;
516 if (strTest.Equals("network.dns2address")) ret = NETWORK_DNS2_ADDRESS;
517 if (strTest.Equals("network.dhcpaddress")) ret = NETWORK_DHCP_ADDRESS;
519 else if (strCategory.Equals("musicplayer"))
521 CStdString info = strTest.Mid(strCategory.GetLength() + 1);
522 if (info.Left(9).Equals("position("))
524 int position = atoi(info.Mid(9));
525 int value = TranslateMusicPlayerString(info.Mid(info.Find(".")+1));
526 ret = AddMultiInfo(GUIInfo(value, 0, position));
528 else if (info.Left(7).Equals("offset("))
530 int position = atoi(info.Mid(7));
531 int value = TranslateMusicPlayerString(info.Mid(info.Find(".")+1));
532 ret = AddMultiInfo(GUIInfo(value, 1, position));
534 else if (info.Left(13).Equals("timeremaining")) return AddMultiInfo(GUIInfo(PLAYER_TIME_REMAINING, TranslateTimeFormat(info.Mid(13))));
535 else if (info.Left(9).Equals("timespeed")) return AddMultiInfo(GUIInfo(PLAYER_TIME_SPEED, TranslateTimeFormat(info.Mid(9))));
536 else if (info.Left(4).Equals("time")) return AddMultiInfo(GUIInfo(PLAYER_TIME, TranslateTimeFormat(info.Mid(4))));
537 else if (info.Left(8).Equals("duration")) return AddMultiInfo(GUIInfo(PLAYER_DURATION, TranslateTimeFormat(info.Mid(8))));
538 else if (info.Left(9).Equals("property("))
539 return AddListItemProp(info.Mid(9, info.GetLength() - 10), MUSICPLAYER_PROPERTY_OFFSET);
541 ret = TranslateMusicPlayerString(strTest.Mid(12));
543 else if (strCategory.Equals("videoplayer"))
545 if (strTest.Equals("videoplayer.title")) ret = VIDEOPLAYER_TITLE;
546 else if (strTest.Equals("videoplayer.genre")) ret = VIDEOPLAYER_GENRE;
547 else if (strTest.Equals("videoplayer.country")) ret = VIDEOPLAYER_COUNTRY;
548 else if (strTest.Equals("videoplayer.originaltitle")) ret = VIDEOPLAYER_ORIGINALTITLE;
549 else if (strTest.Equals("videoplayer.director")) ret = VIDEOPLAYER_DIRECTOR;
550 else if (strTest.Equals("videoplayer.year")) ret = VIDEOPLAYER_YEAR;
551 else if (strTest.Left(25).Equals("videoplayer.timeremaining")) ret = AddMultiInfo(GUIInfo(PLAYER_TIME_REMAINING, TranslateTimeFormat(strTest.Mid(25))));
552 else if (strTest.Left(21).Equals("videoplayer.timespeed")) ret = AddMultiInfo(GUIInfo(PLAYER_TIME_SPEED, TranslateTimeFormat(strTest.Mid(21))));
553 else if (strTest.Left(16).Equals("videoplayer.time")) ret = AddMultiInfo(GUIInfo(PLAYER_TIME, TranslateTimeFormat(strTest.Mid(16))));
554 else if (strTest.Left(20).Equals("videoplayer.duration")) ret = AddMultiInfo(GUIInfo(PLAYER_DURATION, TranslateTimeFormat(strTest.Mid(20))));
555 else if (strTest.Equals("videoplayer.cover")) ret = VIDEOPLAYER_COVER;
556 else if (strTest.Equals("videoplayer.usingoverlays")) ret = VIDEOPLAYER_USING_OVERLAYS;
557 else if (strTest.Equals("videoplayer.isfullscreen")) ret = VIDEOPLAYER_ISFULLSCREEN;
558 else if (strTest.Equals("videoplayer.hasmenu")) ret = VIDEOPLAYER_HASMENU;
559 else if (strTest.Equals("videoplayer.playlistlength")) ret = VIDEOPLAYER_PLAYLISTLEN;
560 else if (strTest.Equals("videoplayer.playlistposition")) ret = VIDEOPLAYER_PLAYLISTPOS;
561 else if (strTest.Equals("videoplayer.plot")) ret = VIDEOPLAYER_PLOT;
562 else if (strTest.Equals("videoplayer.plotoutline")) ret = VIDEOPLAYER_PLOT_OUTLINE;
563 else if (strTest.Equals("videoplayer.episode")) ret = VIDEOPLAYER_EPISODE;
564 else if (strTest.Equals("videoplayer.season")) ret = VIDEOPLAYER_SEASON;
565 else if (strTest.Equals("videoplayer.rating")) ret = VIDEOPLAYER_RATING;
566 else if (strTest.Equals("videoplayer.ratingandvotes")) ret = VIDEOPLAYER_RATING_AND_VOTES;
567 else if (strTest.Equals("videoplayer.tvshowtitle")) ret = VIDEOPLAYER_TVSHOW;
568 else if (strTest.Equals("videoplayer.premiered")) ret = VIDEOPLAYER_PREMIERED;
569 else if (strTest.Left(19).Equals("videoplayer.content")) return AddMultiInfo(GUIInfo(bNegate ? -VIDEOPLAYER_CONTENT : VIDEOPLAYER_CONTENT, ConditionalStringParameter(strTest.Mid(20,strTest.size()-21)), 0));
570 else if (strTest.Equals("videoplayer.studio")) ret = VIDEOPLAYER_STUDIO;
571 else if (strTest.Equals("videoplayer.mpaa")) return VIDEOPLAYER_MPAA;
572 else if (strTest.Equals("videoplayer.top250")) return VIDEOPLAYER_TOP250;
573 else if (strTest.Equals("videoplayer.cast")) return VIDEOPLAYER_CAST;
574 else if (strTest.Equals("videoplayer.castandrole")) return VIDEOPLAYER_CAST_AND_ROLE;
575 else if (strTest.Equals("videoplayer.artist")) return VIDEOPLAYER_ARTIST;
576 else if (strTest.Equals("videoplayer.album")) return VIDEOPLAYER_ALBUM;
577 else if (strTest.Equals("videoplayer.writer")) return VIDEOPLAYER_WRITER;
578 else if (strTest.Equals("videoplayer.tagline")) return VIDEOPLAYER_TAGLINE;
579 else if (strTest.Equals("videoplayer.hasinfo")) return VIDEOPLAYER_HAS_INFO;
580 else if (strTest.Equals("videoplayer.trailer")) return VIDEOPLAYER_TRAILER;
581 else if (strTest.Equals("videoplayer.videocodec")) return VIDEOPLAYER_VIDEO_CODEC;
582 else if (strTest.Equals("videoplayer.videoresolution")) return VIDEOPLAYER_VIDEO_RESOLUTION;
583 else if (strTest.Equals("videoplayer.videoaspect")) return VIDEOPLAYER_VIDEO_ASPECT;
584 else if (strTest.Equals("videoplayer.audiocodec")) return VIDEOPLAYER_AUDIO_CODEC;
585 else if (strTest.Equals("videoplayer.audiochannels")) return VIDEOPLAYER_AUDIO_CHANNELS;
586 else if (strTest.Equals("videoplayer.hasteletext")) return VIDEOPLAYER_HASTELETEXT;
587 else if (strTest.Equals("videoplayer.lastplayed")) return VIDEOPLAYER_LASTPLAYED;
588 else if (strTest.Equals("videoplayer.playcount")) return VIDEOPLAYER_PLAYCOUNT;
590 else if (strCategory.Equals("playlist"))
592 if (strTest.Equals("playlist.length")) ret = PLAYLIST_LENGTH;
593 else if (strTest.Equals("playlist.position")) ret = PLAYLIST_POSITION;
594 else if (strTest.Equals("playlist.random")) ret = PLAYLIST_RANDOM;
595 else if (strTest.Equals("playlist.repeat")) ret = PLAYLIST_REPEAT;
596 else if (strTest.Equals("playlist.israndom")) ret = PLAYLIST_ISRANDOM;
597 else if (strTest.Equals("playlist.isrepeat")) ret = PLAYLIST_ISREPEAT;
598 else if (strTest.Equals("playlist.isrepeatone")) ret = PLAYLIST_ISREPEATONE;
600 else if (strCategory.Equals("musicpartymode"))
602 if (strTest.Equals("musicpartymode.enabled")) ret = MUSICPM_ENABLED;
603 else if (strTest.Equals("musicpartymode.songsplayed")) ret = MUSICPM_SONGSPLAYED;
604 else if (strTest.Equals("musicpartymode.matchingsongs")) ret = MUSICPM_MATCHINGSONGS;
605 else if (strTest.Equals("musicpartymode.matchingsongspicked")) ret = MUSICPM_MATCHINGSONGSPICKED;
606 else if (strTest.Equals("musicpartymode.matchingsongsleft")) ret = MUSICPM_MATCHINGSONGSLEFT;
607 else if (strTest.Equals("musicpartymode.relaxedsongspicked")) ret = MUSICPM_RELAXEDSONGSPICKED;
608 else if (strTest.Equals("musicpartymode.randomsongspicked")) ret = MUSICPM_RANDOMSONGSPICKED;
610 else if (strCategory.Equals("audioscrobbler"))
612 if (strTest.Equals("audioscrobbler.enabled")) ret = AUDIOSCROBBLER_ENABLED;
613 else if (strTest.Equals("audioscrobbler.connectstate")) ret = AUDIOSCROBBLER_CONN_STATE;
614 else if (strTest.Equals("audioscrobbler.submitinterval")) ret = AUDIOSCROBBLER_SUBMIT_INT;
615 else if (strTest.Equals("audioscrobbler.filescached")) ret = AUDIOSCROBBLER_FILES_CACHED;
616 else if (strTest.Equals("audioscrobbler.submitstate")) ret = AUDIOSCROBBLER_SUBMIT_STATE;
618 else if (strCategory.Equals("lastfm"))
620 if (strTest.Equals("lastfm.radioplaying")) ret = LASTFM_RADIOPLAYING;
621 else if (strTest.Equals("lastfm.canlove")) ret = LASTFM_CANLOVE;
622 else if (strTest.Equals("lastfm.canban")) ret = LASTFM_CANBAN;
624 else if (strCategory.Equals("slideshow"))
625 ret = CPictureInfoTag::TranslateString(strTest.Mid(strCategory.GetLength() + 1));
626 else if (strCategory.Left(9).Equals("container"))
628 int id = atoi(strCategory.Mid(10, strCategory.GetLength() - 11));
629 CStdString info = strTest.Mid(strCategory.GetLength() + 1);
630 if (info.Left(14).Equals("listitemnowrap"))
632 int offset = atoi(info.Mid(15, info.GetLength() - 16));
633 ret = TranslateListItem(info.Mid(info.Find(".")+1));
635 return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, id, offset));
637 else if (info.Left(16).Equals("listitemposition"))
639 int offset = atoi(info.Mid(17, info.GetLength() - 18));
640 ret = TranslateListItem(info.Mid(info.Find(".")+1));
642 return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, id, offset, INFOFLAG_LISTITEM_POSITION));
644 else if (info.Left(8).Equals("listitem"))
646 int offset = atoi(info.Mid(9, info.GetLength() - 10));
647 ret = TranslateListItem(info.Mid(info.Find(".")+1));
649 return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, id, offset, INFOFLAG_LISTITEM_WRAP));
651 else if (info.Equals("hasfiles")) ret = CONTAINER_HASFILES;
652 else if (info.Equals("hasfolders")) ret = CONTAINER_HASFOLDERS;
653 else if (info.Equals("isstacked")) ret = CONTAINER_STACKED;
654 else if (info.Equals("folderthumb")) ret = CONTAINER_FOLDERTHUMB;
655 else if (info.Equals("tvshowthumb")) ret = CONTAINER_TVSHOWTHUMB;
656 else if (info.Equals("seasonthumb")) ret = CONTAINER_SEASONTHUMB;
657 else if (info.Equals("folderpath")) ret = CONTAINER_FOLDERPATH;
658 else if (info.Equals("foldername")) ret = CONTAINER_FOLDERNAME;
659 else if (info.Equals("pluginname")) ret = CONTAINER_PLUGINNAME;
660 else if (info.Equals("viewmode")) ret = CONTAINER_VIEWMODE;
661 else if (info.Equals("onnext")) ret = CONTAINER_MOVE_NEXT;
662 else if (info.Equals("onprevious")) ret = CONTAINER_MOVE_PREVIOUS;
663 else if (info.Equals("onscrollnext")) ret = CONTAINER_SCROLL_NEXT;
664 else if (info.Equals("onscrollprevious")) ret = CONTAINER_SCROLL_PREVIOUS;
665 else if (info.Equals("totaltime")) ret = CONTAINER_TOTALTIME;
666 else if (info.Equals("scrolling"))
667 return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_SCROLLING : CONTAINER_SCROLLING, id, 0));
668 else if (info.Equals("hasnext"))
669 return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_HAS_NEXT : CONTAINER_HAS_NEXT, id, 0));
670 else if (info.Equals("hasprevious"))
671 return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_HAS_PREVIOUS : CONTAINER_HAS_PREVIOUS, id, 0));
672 else if (info.Left(8).Equals("content("))
673 return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_CONTENT : CONTAINER_CONTENT, ConditionalStringParameter(info.Mid(8,info.GetLength()-9)), 0));
674 else if (info.Left(4).Equals("row("))
675 return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_ROW : CONTAINER_ROW, id, atoi(info.Mid(4, info.GetLength() - 5))));
676 else if (info.Left(7).Equals("column("))
677 return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_COLUMN : CONTAINER_COLUMN, id, atoi(info.Mid(7, info.GetLength() - 8))));
678 else if (info.Left(8).Equals("position"))
679 return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_POSITION : CONTAINER_POSITION, id, atoi(info.Mid(9, info.GetLength() - 10))));
680 else if (info.Left(8).Equals("subitem("))
681 return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_SUBITEM : CONTAINER_SUBITEM, id, atoi(info.Mid(8, info.GetLength() - 9))));
682 else if (info.Equals("hasthumb")) ret = CONTAINER_HAS_THUMB;
683 else if (info.Equals("numpages")) ret = CONTAINER_NUM_PAGES;
684 else if (info.Equals("numitems")) ret = CONTAINER_NUM_ITEMS;
685 else if (info.Equals("currentpage")) ret = CONTAINER_CURRENT_PAGE;
686 else if (info.Equals("sortmethod")) ret = CONTAINER_SORT_METHOD;
687 else if (info.Left(13).Equals("sortdirection"))
689 CStdString direction = info.Mid(14, info.GetLength() - 15);
690 SORT_ORDER order = SORT_ORDER_NONE;
691 if (direction == "ascending")
692 order = SORT_ORDER_ASC;
693 else if (direction == "descending")
694 order = SORT_ORDER_DESC;
695 return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_SORT_DIRECTION : CONTAINER_SORT_DIRECTION, order));
697 else if (info.Left(5).Equals("sort("))
699 SORT_METHOD sort = SORT_METHOD_NONE;
700 CStdString method(info.Mid(5, info.GetLength() - 6));
701 if (method.Equals("songrating")) sort = SORT_METHOD_SONG_RATING;
702 if (sort != SORT_METHOD_NONE)
703 return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_SORT_METHOD : CONTAINER_SORT_METHOD, sort));
705 else if (id && info.Left(9).Equals("hasfocus("))
707 int itemID = atoi(info.Mid(9, info.GetLength() - 10));
708 return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_HAS_FOCUS : CONTAINER_HAS_FOCUS, id, itemID));
710 else if (info.Left(9).Equals("property("))
712 int compareString = ConditionalStringParameter(info.Mid(9, info.GetLength() - 10));
713 return AddMultiInfo(GUIInfo(CONTAINER_PROPERTY, id, compareString));
715 else if (info.Equals("showplot")) ret = CONTAINER_SHOWPLOT;
716 if (id && ((ret >= CONTAINER_SCROLL_PREVIOUS && ret <= CONTAINER_SCROLL_NEXT) || ret == CONTAINER_NUM_PAGES ||
717 ret == CONTAINER_NUM_ITEMS || ret == CONTAINER_CURRENT_PAGE))
718 return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, id));
720 else if (strCategory.Left(8).Equals("listitem"))
722 int offset = atoi(strCategory.Mid(9, strCategory.GetLength() - 10));
723 ret = TranslateListItem(strTest.Mid(strCategory.GetLength() + 1));
724 if (offset || ret == LISTITEM_ISSELECTED || ret == LISTITEM_ISPLAYING || ret == LISTITEM_IS_FOLDER)
725 return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, 0, offset, INFOFLAG_LISTITEM_WRAP));
727 else if (strCategory.Left(16).Equals("listitemposition"))
729 int offset = atoi(strCategory.Mid(17, strCategory.GetLength() - 18));
730 ret = TranslateListItem(strCategory.Mid(strCategory.GetLength()+1));
731 if (offset || ret == LISTITEM_ISSELECTED || ret == LISTITEM_ISPLAYING || ret == LISTITEM_IS_FOLDER)
732 return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, 0, offset, INFOFLAG_LISTITEM_POSITION));
734 else if (strCategory.Left(14).Equals("listitemnowrap"))
736 int offset = atoi(strCategory.Mid(15, strCategory.GetLength() - 16));
737 ret = TranslateListItem(strTest.Mid(strCategory.GetLength() + 1));
738 if (offset || ret == LISTITEM_ISSELECTED || ret == LISTITEM_ISPLAYING || ret == LISTITEM_IS_FOLDER)
739 return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, 0, offset));
741 else if (strCategory.Equals("visualisation"))
743 if (strTest.Equals("visualisation.locked")) ret = VISUALISATION_LOCKED;
744 else if (strTest.Equals("visualisation.preset")) ret = VISUALISATION_PRESET;
745 else if (strTest.Equals("visualisation.name")) ret = VISUALISATION_NAME;
746 else if (strTest.Equals("visualisation.enabled")) ret = VISUALISATION_ENABLED;
748 else if (strCategory.Equals("fanart"))
750 if (strTest.Equals("fanart.color1")) ret = FANART_COLOR1;
751 else if (strTest.Equals("fanart.color2")) ret = FANART_COLOR2;
752 else if (strTest.Equals("fanart.color3")) ret = FANART_COLOR3;
753 else if (strTest.Equals("fanart.image")) ret = FANART_IMAGE;
755 else if (strCategory.Equals("skin"))
757 if (strTest.Equals("skin.currenttheme"))
759 else if (strTest.Equals("skin.currentcolourtheme"))
760 ret = SKIN_COLOUR_THEME;
761 else if (strTest.Left(12).Equals("skin.string("))
763 int pos = strTest.Find(",");
766 int skinOffset = g_settings.TranslateSkinString(strTest.Mid(12, pos - 12));
767 int compareString = ConditionalStringParameter(strTest.Mid(pos + 1, strTest.GetLength() - (pos + 2)));
768 return AddMultiInfo(GUIInfo(bNegate ? -SKIN_STRING : SKIN_STRING, skinOffset, compareString));
770 int skinOffset = g_settings.TranslateSkinString(strTest.Mid(12, strTest.GetLength() - 13));
771 return AddMultiInfo(GUIInfo(bNegate ? -SKIN_STRING : SKIN_STRING, skinOffset));
773 else if (strTest.Left(16).Equals("skin.hassetting("))
775 int skinOffset = g_settings.TranslateSkinBool(strTest.Mid(16, strTest.GetLength() - 17));
776 return AddMultiInfo(GUIInfo(bNegate ? -SKIN_BOOL : SKIN_BOOL, skinOffset));
778 else if (strTest.Left(14).Equals("skin.hastheme("))
779 ret = SKIN_HAS_THEME_START + ConditionalStringParameter(strTest.Mid(14, strTest.GetLength() - 15));
781 else if (strCategory.Left(6).Equals("window"))
783 CStdString info = strTest.Mid(strCategory.GetLength() + 1);
784 // special case for window.xml parameter, fails above
785 if (info.Left(5).Equals("xml)."))
786 info = info.Mid(5, info.GetLength() + 1);
787 if (info.Left(9).Equals("property("))
790 if (strTest.Left(7).Equals("window("))
792 CStdString window(strTest.Mid(7, strTest.Find(")", 7) - 7).ToLower());
793 winID = CButtonTranslator::TranslateWindow(window);
795 if (winID != WINDOW_INVALID)
797 int compareString = ConditionalStringParameter(info.Mid(9, info.GetLength() - 10));
798 return AddMultiInfo(GUIInfo(WINDOW_PROPERTY, winID, compareString));
801 else if (info.Left(9).Equals("isactive("))
803 CStdString window(strTest.Mid(16, strTest.GetLength() - 17).ToLower());
804 if (window.Find("xml") >= 0)
805 return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_ACTIVE : WINDOW_IS_ACTIVE, 0, ConditionalStringParameter(window)));
806 int winID = CButtonTranslator::TranslateWindow(window);
807 if (winID != WINDOW_INVALID)
808 return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_ACTIVE : WINDOW_IS_ACTIVE, winID, 0));
810 else if (info.Left(7).Equals("ismedia")) return WINDOW_IS_MEDIA;
811 else if (info.Left(10).Equals("istopmost("))
813 CStdString window(strTest.Mid(17, strTest.GetLength() - 18).ToLower());
814 if (window.Find("xml") >= 0)
815 return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_TOPMOST : WINDOW_IS_TOPMOST, 0, ConditionalStringParameter(window)));
816 int winID = CButtonTranslator::TranslateWindow(window);
817 if (winID != WINDOW_INVALID)
818 return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_TOPMOST : WINDOW_IS_TOPMOST, winID, 0));
820 else if (info.Left(10).Equals("isvisible("))
822 CStdString window(strTest.Mid(17, strTest.GetLength() - 18).ToLower());
823 if (window.Find("xml") >= 0)
824 return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_VISIBLE : WINDOW_IS_VISIBLE, 0, ConditionalStringParameter(window)));
825 int winID = CButtonTranslator::TranslateWindow(window);
826 if (winID != WINDOW_INVALID)
827 return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_VISIBLE : WINDOW_IS_VISIBLE, winID, 0));
829 else if (info.Left(9).Equals("previous("))
831 CStdString window(strTest.Mid(16, strTest.GetLength() - 17).ToLower());
832 if (window.Find("xml") >= 0)
833 return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_PREVIOUS : WINDOW_PREVIOUS, 0, ConditionalStringParameter(window)));
834 int winID = CButtonTranslator::TranslateWindow(window);
835 if (winID != WINDOW_INVALID)
836 return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_PREVIOUS : WINDOW_PREVIOUS, winID, 0));
838 else if (info.Left(5).Equals("next("))
840 CStdString window(strTest.Mid(12, strTest.GetLength() - 13).ToLower());
841 if (window.Find("xml") >= 0)
842 return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_NEXT : WINDOW_NEXT, 0, ConditionalStringParameter(window)));
843 int winID = CButtonTranslator::TranslateWindow(window);
844 if (winID != WINDOW_INVALID)
845 return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_NEXT : WINDOW_NEXT, winID, 0));
848 else if (strTest.Left(17).Equals("control.hasfocus("))
850 int controlID = atoi(strTest.Mid(17, strTest.GetLength() - 18).c_str());
852 return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_HAS_FOCUS : CONTROL_HAS_FOCUS, controlID, 0));
854 else if (strTest.Left(18).Equals("control.isvisible("))
856 int controlID = atoi(strTest.Mid(18, strTest.GetLength() - 19).c_str());
858 return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_IS_VISIBLE : CONTROL_IS_VISIBLE, controlID, 0));
860 else if (strTest.Left(18).Equals("control.isenabled("))
862 int controlID = atoi(strTest.Mid(18, strTest.GetLength() - 19).c_str());
864 return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_IS_ENABLED : CONTROL_IS_ENABLED, controlID, 0));
866 else if (strTest.Left(17).Equals("control.getlabel("))
868 int controlID = atoi(strTest.Mid(17, strTest.GetLength() - 18).c_str());
870 return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_GET_LABEL : CONTROL_GET_LABEL, controlID, 0));
872 else if (strTest.Left(13).Equals("controlgroup("))
874 int groupID = atoi(strTest.Mid(13).c_str());
876 int controlPos = strTest.Find(".hasfocus(");
878 controlID = atoi(strTest.Mid(controlPos + 10).c_str());
881 return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_GROUP_HAS_FOCUS : CONTROL_GROUP_HAS_FOCUS, groupID, controlID));
884 else if (strTest.Left(24).Equals("buttonscroller.hasfocus("))
886 int controlID = atoi(strTest.Mid(24, strTest.GetLength() - 24).c_str());
888 return AddMultiInfo(GUIInfo(bNegate ? -BUTTON_SCROLLER_HAS_ICON : BUTTON_SCROLLER_HAS_ICON, controlID, 0));
891 return bNegate ? -ret : ret;
894 int CGUIInfoManager::TranslateListItem(const CStdString &info)
896 if (info.Equals("thumb")) return LISTITEM_THUMB;
897 else if (info.Equals("icon")) return LISTITEM_ICON;
898 else if (info.Equals("actualicon")) return LISTITEM_ACTUAL_ICON;
899 else if (info.Equals("overlay")) return LISTITEM_OVERLAY;
900 else if (info.Equals("label")) return LISTITEM_LABEL;
901 else if (info.Equals("label2")) return LISTITEM_LABEL2;
902 else if (info.Equals("title")) return LISTITEM_TITLE;
903 else if (info.Equals("tracknumber")) return LISTITEM_TRACKNUMBER;
904 else if (info.Equals("artist")) return LISTITEM_ARTIST;
905 else if (info.Equals("album")) return LISTITEM_ALBUM;
906 else if (info.Equals("albumartist")) return LISTITEM_ALBUM_ARTIST;
907 else if (info.Equals("year")) return LISTITEM_YEAR;
908 else if (info.Equals("genre")) return LISTITEM_GENRE;
909 else if (info.Equals("director")) return LISTITEM_DIRECTOR;
910 else if (info.Equals("filename")) return LISTITEM_FILENAME;
911 else if (info.Equals("filenameandpath")) return LISTITEM_FILENAME_AND_PATH;
912 else if (info.Equals("date")) return LISTITEM_DATE;
913 else if (info.Equals("size")) return LISTITEM_SIZE;
914 else if (info.Equals("rating")) return LISTITEM_RATING;
915 else if (info.Equals("ratingandvotes")) return LISTITEM_RATING_AND_VOTES;
916 else if (info.Equals("programcount")) return LISTITEM_PROGRAM_COUNT;
917 else if (info.Equals("duration")) return LISTITEM_DURATION;
918 else if (info.Equals("isselected")) return LISTITEM_ISSELECTED;
919 else if (info.Equals("isplaying")) return LISTITEM_ISPLAYING;
920 else if (info.Equals("plot")) return LISTITEM_PLOT;
921 else if (info.Equals("plotoutline")) return LISTITEM_PLOT_OUTLINE;
922 else if (info.Equals("episode")) return LISTITEM_EPISODE;
923 else if (info.Equals("season")) return LISTITEM_SEASON;
924 else if (info.Equals("tvshowtitle")) return LISTITEM_TVSHOW;
925 else if (info.Equals("premiered")) return LISTITEM_PREMIERED;
926 else if (info.Equals("comment")) return LISTITEM_COMMENT;
927 else if (info.Equals("path")) return LISTITEM_PATH;
928 else if (info.Equals("foldername")) return LISTITEM_FOLDERNAME;
929 else if (info.Equals("folderpath")) return LISTITEM_FOLDERPATH;
930 else if (info.Equals("picturepath")) return LISTITEM_PICTURE_PATH;
931 else if (info.Equals("pictureresolution")) return LISTITEM_PICTURE_RESOLUTION;
932 else if (info.Equals("picturedatetime")) return LISTITEM_PICTURE_DATETIME;
933 else if (info.Equals("studio")) return LISTITEM_STUDIO;
934 else if (info.Equals("country")) return LISTITEM_COUNTRY;
935 else if (info.Equals("mpaa")) return LISTITEM_MPAA;
936 else if (info.Equals("cast")) return LISTITEM_CAST;
937 else if (info.Equals("castandrole")) return LISTITEM_CAST_AND_ROLE;
938 else if (info.Equals("writer")) return LISTITEM_WRITER;
939 else if (info.Equals("tagline")) return LISTITEM_TAGLINE;
940 else if (info.Equals("top250")) return LISTITEM_TOP250;
941 else if (info.Equals("trailer")) return LISTITEM_TRAILER;
942 else if (info.Equals("starrating")) return LISTITEM_STAR_RATING;
943 else if (info.Equals("sortletter")) return LISTITEM_SORT_LETTER;
944 else if (info.Equals("videocodec")) return LISTITEM_VIDEO_CODEC;
945 else if (info.Equals("videoresolution")) return LISTITEM_VIDEO_RESOLUTION;
946 else if (info.Equals("videoaspect")) return LISTITEM_VIDEO_ASPECT;
947 else if (info.Equals("audiocodec")) return LISTITEM_AUDIO_CODEC;
948 else if (info.Equals("audiochannels")) return LISTITEM_AUDIO_CHANNELS;
949 else if (info.Equals("audiolanguage")) return LISTITEM_AUDIO_LANGUAGE;
950 else if (info.Equals("subtitlelanguage")) return LISTITEM_SUBTITLE_LANGUAGE;
951 else if (info.Equals("isfolder")) return LISTITEM_IS_FOLDER;
952 else if (info.Equals("originaltitle")) return LISTITEM_ORIGINALTITLE;
953 else if (info.Equals("lastplayed")) return LISTITEM_LASTPLAYED;
954 else if (info.Equals("playcount")) return LISTITEM_PLAYCOUNT;
955 else if (info.Left(9).Equals("property(")) return AddListItemProp(info.Mid(9, info.GetLength() - 10));
959 int CGUIInfoManager::TranslateMusicPlayerString(const CStdString &info) const
961 if (info.Equals("title")) return MUSICPLAYER_TITLE;
962 else if (info.Equals("album")) return MUSICPLAYER_ALBUM;
963 else if (info.Equals("artist")) return MUSICPLAYER_ARTIST;
964 else if (info.Equals("albumartist")) return MUSICPLAYER_ALBUM_ARTIST;
965 else if (info.Equals("year")) return MUSICPLAYER_YEAR;
966 else if (info.Equals("genre")) return MUSICPLAYER_GENRE;
967 else if (info.Equals("duration")) return MUSICPLAYER_DURATION;
968 else if (info.Equals("tracknumber")) return MUSICPLAYER_TRACK_NUMBER;
969 else if (info.Equals("cover")) return MUSICPLAYER_COVER;
970 else if (info.Equals("bitrate")) return MUSICPLAYER_BITRATE;
971 else if (info.Equals("playlistlength")) return MUSICPLAYER_PLAYLISTLEN;
972 else if (info.Equals("playlistposition")) return MUSICPLAYER_PLAYLISTPOS;
973 else if (info.Equals("channels")) return MUSICPLAYER_CHANNELS;
974 else if (info.Equals("bitspersample")) return MUSICPLAYER_BITSPERSAMPLE;
975 else if (info.Equals("samplerate")) return MUSICPLAYER_SAMPLERATE;
976 else if (info.Equals("codec")) return MUSICPLAYER_CODEC;
977 else if (info.Equals("discnumber")) return MUSICPLAYER_DISC_NUMBER;
978 else if (info.Equals("rating")) return MUSICPLAYER_RATING;
979 else if (info.Equals("comment")) return MUSICPLAYER_COMMENT;
980 else if (info.Equals("lyrics")) return MUSICPLAYER_LYRICS;
981 else if (info.Equals("playlistplaying")) return MUSICPLAYER_PLAYLISTPLAYING;
982 else if (info.Equals("exists")) return MUSICPLAYER_EXISTS;
983 else if (info.Equals("hasprevious")) return MUSICPLAYER_HASPREVIOUS;
984 else if (info.Equals("hasnext")) return MUSICPLAYER_HASNEXT;
985 else if (info.Equals("playcount")) return MUSICPLAYER_PLAYCOUNT;
986 else if (info.Equals("lastplayed")) return MUSICPLAYER_LASTPLAYED;
990 TIME_FORMAT CGUIInfoManager::TranslateTimeFormat(const CStdString &format)
992 if (format.IsEmpty()) return TIME_FORMAT_GUESS;
993 else if (format.Equals("(hh)")) return TIME_FORMAT_HH;
994 else if (format.Equals("(mm)")) return TIME_FORMAT_MM;
995 else if (format.Equals("(ss)")) return TIME_FORMAT_SS;
996 else if (format.Equals("(hh:mm)")) return TIME_FORMAT_HH_MM;
997 else if (format.Equals("(mm:ss)")) return TIME_FORMAT_MM_SS;
998 else if (format.Equals("(hh:mm:ss)")) return TIME_FORMAT_HH_MM_SS;
999 return TIME_FORMAT_GUESS;
1002 CStdString CGUIInfoManager::GetLabel(int info, int contextWindow)
1004 CStdString strLabel;
1005 if (info >= MULTI_INFO_START && info <= MULTI_INFO_END)
1006 return GetMultiInfoLabel(m_multiInfo[info - MULTI_INFO_START], contextWindow);
1008 if (info >= SLIDE_INFO_START && info <= SLIDE_INFO_END)
1009 return GetPictureLabel(info);
1011 if (info >= LISTITEM_PROPERTY_START+MUSICPLAYER_PROPERTY_OFFSET &&
1012 info - (LISTITEM_PROPERTY_START+MUSICPLAYER_PROPERTY_OFFSET) < (int)m_listitemProperties.size())
1013 { // grab the property
1017 CStdString property = m_listitemProperties[info - LISTITEM_PROPERTY_START-MUSICPLAYER_PROPERTY_OFFSET];
1018 return m_currentFile->GetProperty(property);
1021 if (info >= LISTITEM_START && info <= LISTITEM_END)
1023 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS); // true for has list items
1026 CFileItemPtr item = window->GetCurrentListItem();
1027 strLabel = GetItemLabel(item.get(), info);
1035 case WEATHER_CONDITIONS:
1036 strLabel = g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_COND);
1037 strLabel = strLabel.Trim();
1039 case WEATHER_TEMPERATURE:
1040 strLabel.Format("%s%s", g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_TEMP), g_langInfo.GetTempUnitString().c_str());
1042 case WEATHER_LOCATION:
1043 strLabel = g_weatherManager.GetInfo(WEATHER_LABEL_LOCATION);
1045 case WEATHER_FANART_CODE:
1046 strLabel = URIUtils::GetFileName(g_weatherManager.GetInfo(WEATHER_IMAGE_CURRENT_ICON));
1047 URIUtils::RemoveExtension(strLabel);
1049 case WEATHER_PLUGIN:
1050 strLabel = g_guiSettings.GetString("weather.script");
1053 strLabel = GetDate();
1056 strLabel = GetDate(true);
1059 strLabel.Format("%02.2f", m_fps);
1062 strLabel.Format("%2.1f dB", (float)(g_settings.m_nVolumeLevel + g_settings.m_dynamicRangeCompressionLevel) * 0.01f);
1064 case PLAYER_SUBTITLE_DELAY:
1065 strLabel.Format("%2.3f s", g_settings.m_currentVideoSettings.m_SubtitleDelay);
1067 case PLAYER_AUDIO_DELAY:
1068 strLabel.Format("%2.3f s", g_settings.m_currentVideoSettings.m_AudioDelay);
1070 case PLAYER_CHAPTER:
1071 if(g_application.IsPlaying() && g_application.m_pPlayer)
1072 strLabel.Format("%02d", g_application.m_pPlayer->GetChapter());
1074 case PLAYER_CHAPTERCOUNT:
1075 if(g_application.IsPlaying() && g_application.m_pPlayer)
1076 strLabel.Format("%02d", g_application.m_pPlayer->GetChapterCount());
1078 case PLAYER_CHAPTERNAME:
1079 if(g_application.IsPlaying() && g_application.m_pPlayer)
1080 g_application.m_pPlayer->GetChapterName(strLabel);
1082 case PLAYER_CACHELEVEL:
1085 if(g_application.IsPlaying() && ((iLevel = GetInt(PLAYER_CACHELEVEL)) >= 0))
1086 strLabel.Format("%i", iLevel);
1090 if(g_application.IsPlaying() && g_application.m_pPlayer)
1091 strLabel = GetCurrentPlayTime(TIME_FORMAT_HH_MM);
1093 case PLAYER_DURATION:
1094 if(g_application.IsPlaying() && g_application.m_pPlayer)
1095 strLabel = GetDuration(TIME_FORMAT_HH_MM);
1098 case PLAYER_FILEPATH:
1101 if (m_currentFile->HasMusicInfoTag())
1102 strLabel = m_currentFile->GetMusicInfoTag()->GetURL();
1103 else if (m_currentFile->HasVideoInfoTag())
1104 strLabel = m_currentFile->GetVideoInfoTag()->m_strFileNameAndPath;
1105 if (strLabel.IsEmpty())
1106 strLabel = m_currentFile->m_strPath;
1108 if (info == PLAYER_PATH)
1110 // do this twice since we want the path outside the archive if this
1112 if (URIUtils::IsInArchive(strLabel))
1113 strLabel = URIUtils::GetParentPath(strLabel);
1114 strLabel = URIUtils::GetParentPath(strLabel);
1117 case MUSICPLAYER_TITLE:
1118 case MUSICPLAYER_ALBUM:
1119 case MUSICPLAYER_ARTIST:
1120 case MUSICPLAYER_ALBUM_ARTIST:
1121 case MUSICPLAYER_GENRE:
1122 case MUSICPLAYER_YEAR:
1123 case MUSICPLAYER_TRACK_NUMBER:
1124 case MUSICPLAYER_BITRATE:
1125 case MUSICPLAYER_PLAYLISTLEN:
1126 case MUSICPLAYER_PLAYLISTPOS:
1127 case MUSICPLAYER_CHANNELS:
1128 case MUSICPLAYER_BITSPERSAMPLE:
1129 case MUSICPLAYER_SAMPLERATE:
1130 case MUSICPLAYER_CODEC:
1131 case MUSICPLAYER_DISC_NUMBER:
1132 case MUSICPLAYER_RATING:
1133 case MUSICPLAYER_COMMENT:
1134 case MUSICPLAYER_LYRICS:
1135 case MUSICPLAYER_PLAYCOUNT:
1136 case MUSICPLAYER_LASTPLAYED:
1137 strLabel = GetMusicLabel(info);
1139 case VIDEOPLAYER_TITLE:
1140 case VIDEOPLAYER_ORIGINALTITLE:
1141 case VIDEOPLAYER_GENRE:
1142 case VIDEOPLAYER_DIRECTOR:
1143 case VIDEOPLAYER_YEAR:
1144 case VIDEOPLAYER_PLAYLISTLEN:
1145 case VIDEOPLAYER_PLAYLISTPOS:
1146 case VIDEOPLAYER_PLOT:
1147 case VIDEOPLAYER_PLOT_OUTLINE:
1148 case VIDEOPLAYER_EPISODE:
1149 case VIDEOPLAYER_SEASON:
1150 case VIDEOPLAYER_RATING:
1151 case VIDEOPLAYER_RATING_AND_VOTES:
1152 case VIDEOPLAYER_TVSHOW:
1153 case VIDEOPLAYER_PREMIERED:
1154 case VIDEOPLAYER_STUDIO:
1155 case VIDEOPLAYER_COUNTRY:
1156 case VIDEOPLAYER_MPAA:
1157 case VIDEOPLAYER_TOP250:
1158 case VIDEOPLAYER_CAST:
1159 case VIDEOPLAYER_CAST_AND_ROLE:
1160 case VIDEOPLAYER_ARTIST:
1161 case VIDEOPLAYER_ALBUM:
1162 case VIDEOPLAYER_WRITER:
1163 case VIDEOPLAYER_TAGLINE:
1164 case VIDEOPLAYER_TRAILER:
1165 case VIDEOPLAYER_PLAYCOUNT:
1166 case VIDEOPLAYER_LASTPLAYED:
1167 strLabel = GetVideoLabel(info);
1169 case VIDEOPLAYER_VIDEO_CODEC:
1170 if(g_application.IsPlaying() && g_application.m_pPlayer)
1171 strLabel = g_application.m_pPlayer->GetVideoCodecName();
1173 case VIDEOPLAYER_VIDEO_RESOLUTION:
1174 if(g_application.IsPlaying() && g_application.m_pPlayer)
1175 return CStreamDetails::VideoDimsToResolutionDescription(g_application.m_pPlayer->GetPictureWidth(), g_application.m_pPlayer->GetPictureHeight());
1177 case VIDEOPLAYER_AUDIO_CODEC:
1178 if(g_application.IsPlaying() && g_application.m_pPlayer)
1179 strLabel = g_application.m_pPlayer->GetAudioCodecName();
1181 case VIDEOPLAYER_VIDEO_ASPECT:
1182 if (g_application.IsPlaying() && g_application.m_pPlayer)
1185 g_application.m_pPlayer->GetVideoAspectRatio(aspect);
1186 strLabel = CStreamDetails::VideoAspectToAspectDescription(aspect);
1189 case VIDEOPLAYER_AUDIO_CHANNELS:
1190 if(g_application.IsPlaying() && g_application.m_pPlayer)
1191 strLabel.Format("%i", g_application.m_pPlayer->GetChannels());
1193 case PLAYLIST_LENGTH:
1194 case PLAYLIST_POSITION:
1195 case PLAYLIST_RANDOM:
1196 case PLAYLIST_REPEAT:
1197 strLabel = GetPlaylistLabel(info);
1199 case MUSICPM_SONGSPLAYED:
1200 case MUSICPM_MATCHINGSONGS:
1201 case MUSICPM_MATCHINGSONGSPICKED:
1202 case MUSICPM_MATCHINGSONGSLEFT:
1203 case MUSICPM_RELAXEDSONGSPICKED:
1204 case MUSICPM_RANDOMSONGSPICKED:
1205 strLabel = GetMusicPartyModeLabel(info);
1208 case SYSTEM_FREE_SPACE:
1209 case SYSTEM_FREE_SPACE_C:
1210 case SYSTEM_FREE_SPACE_E:
1211 case SYSTEM_FREE_SPACE_F:
1212 case SYSTEM_FREE_SPACE_G:
1213 case SYSTEM_USED_SPACE:
1214 case SYSTEM_USED_SPACE_C:
1215 case SYSTEM_USED_SPACE_E:
1216 case SYSTEM_USED_SPACE_F:
1217 case SYSTEM_USED_SPACE_G:
1218 case SYSTEM_TOTAL_SPACE:
1219 case SYSTEM_TOTAL_SPACE_C:
1220 case SYSTEM_TOTAL_SPACE_E:
1221 case SYSTEM_TOTAL_SPACE_F:
1222 case SYSTEM_TOTAL_SPACE_G:
1223 case SYSTEM_FREE_SPACE_PERCENT:
1224 case SYSTEM_FREE_SPACE_PERCENT_C:
1225 case SYSTEM_FREE_SPACE_PERCENT_E:
1226 case SYSTEM_FREE_SPACE_PERCENT_F:
1227 case SYSTEM_FREE_SPACE_PERCENT_G:
1228 case SYSTEM_USED_SPACE_PERCENT:
1229 case SYSTEM_USED_SPACE_PERCENT_C:
1230 case SYSTEM_USED_SPACE_PERCENT_E:
1231 case SYSTEM_USED_SPACE_PERCENT_F:
1232 case SYSTEM_USED_SPACE_PERCENT_G:
1233 case SYSTEM_USED_SPACE_X:
1234 case SYSTEM_FREE_SPACE_X:
1235 case SYSTEM_TOTAL_SPACE_X:
1236 case SYSTEM_USED_SPACE_Y:
1237 case SYSTEM_FREE_SPACE_Y:
1238 case SYSTEM_TOTAL_SPACE_Y:
1239 case SYSTEM_USED_SPACE_Z:
1240 case SYSTEM_FREE_SPACE_Z:
1241 case SYSTEM_TOTAL_SPACE_Z:
1242 return g_sysinfo.GetHddSpaceInfo(info);
1245 case LCD_FREE_SPACE_C:
1246 case LCD_FREE_SPACE_E:
1247 case LCD_FREE_SPACE_F:
1248 case LCD_FREE_SPACE_G:
1249 return g_sysinfo.GetHddSpaceInfo(info, true);
1252 case SYSTEM_CPU_TEMPERATURE:
1253 case SYSTEM_GPU_TEMPERATURE:
1254 case SYSTEM_FAN_SPEED:
1255 case LCD_CPU_TEMPERATURE:
1256 case LCD_GPU_TEMPERATURE:
1258 case SYSTEM_CPU_USAGE:
1259 return GetSystemHeatInfo(info);
1262 case SYSTEM_VIDEO_ENCODER_INFO:
1263 case NETWORK_MAC_ADDRESS:
1264 case SYSTEM_KERNEL_VERSION:
1265 case SYSTEM_CPUFREQUENCY:
1266 case SYSTEM_INTERNET_STATE:
1268 case SYSTEM_TOTALUPTIME:
1269 return g_sysinfo.GetInfo(info);
1272 case SYSTEM_SCREEN_RESOLUTION:
1273 if (g_settings.m_ResInfo[g_guiSettings.m_LookAndFeelResolution].bFullScreen)
1274 strLabel.Format("%ix%i@%.2fHz - %s (%02.2f fps)",
1275 g_settings.m_ResInfo[g_guiSettings.m_LookAndFeelResolution].iWidth,
1276 g_settings.m_ResInfo[g_guiSettings.m_LookAndFeelResolution].iHeight,
1277 g_settings.m_ResInfo[g_guiSettings.m_LookAndFeelResolution].fRefreshRate,
1278 g_localizeStrings.Get(244), GetFPS());
1280 strLabel.Format("%ix%i - %s (%02.2f fps)",
1281 g_settings.m_ResInfo[g_guiSettings.m_LookAndFeelResolution].iWidth,
1282 g_settings.m_ResInfo[g_guiSettings.m_LookAndFeelResolution].iHeight,
1283 g_localizeStrings.Get(242), GetFPS());
1287 case CONTAINER_FOLDERPATH:
1288 case CONTAINER_FOLDERNAME:
1290 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1293 strLabel = CURL(((CGUIMediaWindow*)window)->CurrentDirectory().m_strPath).GetWithoutUserDetails();
1294 if (info==CONTAINER_FOLDERNAME)
1296 URIUtils::RemoveSlashAtEnd(strLabel);
1297 strLabel=URIUtils::GetFileName(strLabel);
1302 case CONTAINER_PLUGINNAME:
1304 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1307 CURL url(((CGUIMediaWindow*)window)->CurrentDirectory().m_strPath);
1308 if (url.GetProtocol().Equals("plugin"))
1310 strLabel = url.GetFileName();
1311 URIUtils::RemoveSlashAtEnd(strLabel);
1316 case CONTAINER_VIEWMODE:
1318 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1321 const CGUIControl *control = window->GetControl(window->GetViewContainerID());
1322 if (control && control->IsContainer())
1323 strLabel = ((CGUIBaseContainer *)control)->GetLabel();
1327 case CONTAINER_SORT_METHOD:
1329 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1332 const CGUIViewState *viewState = ((CGUIMediaWindow*)window)->GetViewState();
1334 strLabel = g_localizeStrings.Get(viewState->GetSortMethodLabel());
1338 case CONTAINER_NUM_PAGES:
1339 case CONTAINER_NUM_ITEMS:
1340 case CONTAINER_CURRENT_PAGE:
1341 return GetMultiInfoLabel(GUIInfo(info), contextWindow);
1343 case CONTAINER_SHOWPLOT:
1345 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1347 return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("showplot");
1350 case CONTAINER_TOTALTIME:
1352 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1355 const CFileItemList& items=((CGUIMediaWindow *)window)->CurrentDirectory();
1357 for (int i=0;i<items.Size();++i)
1359 CFileItemPtr item=items.Get(i);
1360 if (item->HasMusicInfoTag())
1361 duration += item->GetMusicInfoTag()->GetDuration();
1362 else if (item->HasVideoInfoTag())
1363 duration += item->GetVideoInfoTag()->m_streamDetails.GetVideoDuration();
1366 return StringUtils::SecondsToTimeString(duration);
1370 case SYSTEM_BUILD_VERSION:
1371 strLabel = GetVersion();
1373 case SYSTEM_BUILD_DATE:
1374 strLabel = GetBuild();
1376 case SYSTEM_FREE_MEMORY:
1377 case SYSTEM_FREE_MEMORY_PERCENT:
1378 case SYSTEM_USED_MEMORY:
1379 case SYSTEM_USED_MEMORY_PERCENT:
1380 case SYSTEM_TOTAL_MEMORY:
1383 GlobalMemoryStatus(&stat);
1384 int iMemPercentFree = 100 - ((int)( 100.0f* (stat.dwTotalPhys - stat.dwAvailPhys)/stat.dwTotalPhys + 0.5f ));
1385 int iMemPercentUsed = 100 - iMemPercentFree;
1387 if (info == SYSTEM_FREE_MEMORY)
1388 strLabel.Format("%luMB", (ULONG)(stat.dwAvailPhys/MB));
1389 else if (info == SYSTEM_FREE_MEMORY_PERCENT)
1390 strLabel.Format("%i%%", iMemPercentFree);
1391 else if (info == SYSTEM_USED_MEMORY)
1392 strLabel.Format("%luMB", (ULONG)((stat.dwTotalPhys - stat.dwAvailPhys)/MB));
1393 else if (info == SYSTEM_USED_MEMORY_PERCENT)
1394 strLabel.Format("%i%%", iMemPercentUsed);
1395 else if (info == SYSTEM_TOTAL_MEMORY)
1396 strLabel.Format("%luMB", (ULONG)(stat.dwTotalPhys/MB));
1399 case SYSTEM_SCREEN_MODE:
1400 strLabel = g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()].strMode;
1402 case SYSTEM_SCREEN_WIDTH:
1403 strLabel.Format("%i", g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()].iWidth);
1405 case SYSTEM_SCREEN_HEIGHT:
1406 strLabel.Format("%i", g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()].iHeight);
1408 case SYSTEM_CURRENT_WINDOW:
1409 return g_localizeStrings.Get(g_windowManager.GetFocusedWindow());
1411 case SYSTEM_CURRENT_CONTROL:
1413 CGUIWindow *window = g_windowManager.GetWindow(g_windowManager.GetFocusedWindow());
1416 CGUIControl *control = window->GetFocusedControl();
1418 strLabel = control->GetDescription();
1422 #ifdef HAS_DVD_DRIVE
1423 case SYSTEM_DVD_LABEL:
1424 strLabel = g_mediaManager.GetDiskLabel();
1427 case SYSTEM_ALARM_POS:
1428 if (g_alarmClock.GetRemaining("shutdowntimer") == 0.f)
1432 double fTime = g_alarmClock.GetRemaining("shutdowntimer");
1434 strLabel.Format(g_localizeStrings.Get(13213).c_str(),g_alarmClock.GetRemaining("shutdowntimer")/60.f);
1436 strLabel.Format(g_localizeStrings.Get(13214).c_str(),g_alarmClock.GetRemaining("shutdowntimer"));
1439 case SYSTEM_PROFILENAME:
1440 strLabel = g_settings.GetCurrentProfile().getName();
1442 case SYSTEM_PROFILECOUNT:
1443 strLabel.Format("%i", g_settings.GetNumProfiles());
1445 case SYSTEM_LANGUAGE:
1446 strLabel = g_guiSettings.GetString("locale.language");
1448 case SYSTEM_TEMPERATURE_UNITS:
1449 strLabel = g_langInfo.GetTempUnitString();
1451 case SYSTEM_PROGRESS_BAR:
1453 int percent = GetInt(SYSTEM_PROGRESS_BAR);
1455 strLabel.Format("%i", percent);
1460 int iPlaySpeed = g_application.GetPlaySpeed();
1461 if (g_application.IsPaused())
1462 strLabel.Format("\7");
1463 else if (iPlaySpeed < 1)
1464 strLabel.Format("\3:%ix", iPlaySpeed);
1465 else if (iPlaySpeed > 1)
1466 strLabel.Format("\4:%ix", iPlaySpeed);
1468 strLabel.Format("\5");
1480 //alternatively, set strLabel
1481 return GetLcdTime( info );
1485 if (g_guiSettings.GetString("lookandfeel.skintheme").Equals("skindefault"))
1486 strLabel = g_localizeStrings.Get(15109);
1488 strLabel = g_guiSettings.GetString("lookandfeel.skintheme");
1490 case SKIN_COLOUR_THEME:
1491 if (g_guiSettings.GetString("lookandfeel.skincolors").Equals("skindefault"))
1492 strLabel = g_localizeStrings.Get(15109);
1494 strLabel = g_guiSettings.GetString("lookandfeel.skincolors");
1497 case LCD_PROGRESS_BAR:
1498 if (g_lcd) strLabel = g_lcd->GetProgressBar(g_application.GetTime(), g_application.GetTotalTime());
1501 case NETWORK_IP_ADDRESS:
1503 CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
1505 return iface->GetCurrentIPAddress();
1508 case NETWORK_SUBNET_ADDRESS:
1510 CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
1512 return iface->GetCurrentNetmask();
1515 case NETWORK_GATEWAY_ADDRESS:
1517 CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
1519 return iface->GetCurrentDefaultGateway();
1522 case NETWORK_DNS1_ADDRESS:
1524 vector<CStdString> nss = g_application.getNetwork().GetNameServers();
1525 if (nss.size() >= 1)
1529 case NETWORK_DNS2_ADDRESS:
1531 vector<CStdString> nss = g_application.getNetwork().GetNameServers();
1532 if (nss.size() >= 2)
1536 case NETWORK_DHCP_ADDRESS:
1538 CStdString dhcpserver;
1542 case NETWORK_LINK_STATE:
1544 CStdString linkStatus = g_localizeStrings.Get(151);
1546 CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
1547 if (iface && iface->IsConnected())
1548 linkStatus += g_localizeStrings.Get(15207);
1550 linkStatus += g_localizeStrings.Get(15208);
1555 case AUDIOSCROBBLER_CONN_STATE:
1556 case AUDIOSCROBBLER_SUBMIT_INT:
1557 case AUDIOSCROBBLER_FILES_CACHED:
1558 case AUDIOSCROBBLER_SUBMIT_STATE:
1559 strLabel=GetAudioScrobblerLabel(info);
1561 case VISUALISATION_PRESET:
1563 CGUIMessage msg(GUI_MSG_GET_VISUALISATION, 0, 0);
1564 g_windowManager.SendMessage(msg);
1565 if (msg.GetPointer())
1567 CVisualisation* viz = NULL;
1568 viz = (CVisualisation*)msg.GetPointer();
1571 strLabel = viz->GetPresetName();
1572 URIUtils::RemoveExtension(strLabel);
1577 case VISUALISATION_NAME:
1580 strLabel = g_guiSettings.GetString("musicplayer.visualisation");
1581 if (CAddonMgr::Get().GetAddon(strLabel,addon) && addon)
1582 strLabel = addon->Name();
1587 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1589 return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("fanart_color1");
1594 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1596 return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("fanart_color2");
1601 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1603 return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("fanart_color3");
1608 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1610 return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("fanart_image");
1613 case SYSTEM_RENDER_VENDOR:
1614 strLabel = g_Windowing.GetRenderVendor();
1616 case SYSTEM_RENDER_RENDERER:
1617 strLabel = g_Windowing.GetRenderRenderer();
1619 case SYSTEM_RENDER_VERSION:
1620 strLabel = g_Windowing.GetRenderVersionString();
1627 // tries to get a integer value for use in progressbars/sliders and such
1628 int CGUIInfoManager::GetInt(int info, int contextWindow) const
1633 return g_application.GetVolume();
1634 case PLAYER_SUBTITLE_DELAY:
1635 return g_application.GetSubtitleDelay();
1636 case PLAYER_AUDIO_DELAY:
1637 return g_application.GetAudioDelay();
1638 case PLAYER_PROGRESS:
1639 case PLAYER_SEEKBAR:
1640 case PLAYER_CACHELEVEL:
1641 case PLAYER_CHAPTER:
1642 case PLAYER_CHAPTERCOUNT:
1644 if( g_application.IsPlaying() && g_application.m_pPlayer)
1648 case PLAYER_PROGRESS:
1649 return (int)(g_application.GetPercentage());
1650 case PLAYER_SEEKBAR:
1652 CGUIDialogSeekBar *seekBar = (CGUIDialogSeekBar*)g_windowManager.GetWindow(WINDOW_DIALOG_SEEK_BAR);
1653 return seekBar ? (int)seekBar->GetPercentage() : 0;
1655 case PLAYER_CACHELEVEL:
1656 return (int)(g_application.m_pPlayer->GetCacheLevel());
1657 case PLAYER_CHAPTER:
1658 return g_application.m_pPlayer->GetChapter();
1659 case PLAYER_CHAPTERCOUNT:
1660 return g_application.m_pPlayer->GetChapterCount();
1665 case SYSTEM_FREE_MEMORY:
1666 case SYSTEM_USED_MEMORY:
1669 GlobalMemoryStatus(&stat);
1670 int memPercentUsed = (int)( 100.0f* (stat.dwTotalPhys - stat.dwAvailPhys)/stat.dwTotalPhys + 0.5f );
1671 if (info == SYSTEM_FREE_MEMORY)
1672 return 100 - memPercentUsed;
1673 return memPercentUsed;
1675 case SYSTEM_PROGRESS_BAR:
1677 CGUIDialogProgress *bar = (CGUIDialogProgress *)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
1678 if (bar && bar->IsDialogRunning())
1679 return bar->GetPercentage();
1681 case SYSTEM_FREE_SPACE:
1682 case SYSTEM_FREE_SPACE_C:
1683 case SYSTEM_FREE_SPACE_E:
1684 case SYSTEM_FREE_SPACE_F:
1685 case SYSTEM_FREE_SPACE_G:
1686 case SYSTEM_USED_SPACE:
1687 case SYSTEM_USED_SPACE_C:
1688 case SYSTEM_USED_SPACE_E:
1689 case SYSTEM_USED_SPACE_F:
1690 case SYSTEM_USED_SPACE_G:
1691 case SYSTEM_FREE_SPACE_X:
1692 case SYSTEM_USED_SPACE_X:
1693 case SYSTEM_FREE_SPACE_Y:
1694 case SYSTEM_USED_SPACE_Y:
1695 case SYSTEM_FREE_SPACE_Z:
1696 case SYSTEM_USED_SPACE_Z:
1699 g_sysinfo.GetHddSpaceInfo(ret, info, true);
1702 case SYSTEM_CPU_USAGE:
1703 return g_cpuInfo.getUsedPercentage();
1707 // checks the condition and returns it as necessary. Currently used
1708 // for toggle button controls and visibility of images.
1709 bool CGUIInfoManager::GetBool(int condition1, int contextWindow, const CGUIListItem *item)
1712 bool bReturn = false;
1713 if (!item && IsCached(condition1, contextWindow, bReturn)) // never use cache for list items
1716 int condition = abs(condition1);
1718 if(condition >= COMBINED_VALUES_START && (condition - COMBINED_VALUES_START) < (int)(m_CombinedValues.size()) )
1720 const CCombinedValue &comb = m_CombinedValues[condition - COMBINED_VALUES_START];
1721 if (!EvaluateBooleanExpression(comb, bReturn, contextWindow, item))
1724 else if (item && condition >= LISTITEM_START && condition < LISTITEM_END)
1725 bReturn = GetItemBool(item, condition);
1726 // Ethernet Link state checking
1727 // Will check if the Xbox has a Ethernet Link connection! [Cable in!]
1728 // This can used for the skinner to switch off Network or Inter required functions
1729 else if ( condition == SYSTEM_ALWAYS_TRUE)
1731 else if (condition == SYSTEM_ALWAYS_FALSE)
1733 else if (condition == SYSTEM_ETHERNET_LINK_ACTIVE)
1735 else if (condition > SYSTEM_IDLE_TIME_START && condition <= SYSTEM_IDLE_TIME_FINISH)
1736 bReturn = (g_application.GlobalIdleTime() >= condition - SYSTEM_IDLE_TIME_START);
1737 else if (condition == WINDOW_IS_MEDIA)
1738 { // note: This doesn't return true for dialogs (content, favourites, login, videoinfo)
1739 CGUIWindow *pWindow = g_windowManager.GetWindow(g_windowManager.GetActiveWindow());
1740 bReturn = (pWindow && pWindow->IsMediaWindow());
1742 else if (condition == PLAYER_MUTED)
1743 bReturn = g_settings.m_bMute;
1744 else if (condition >= LIBRARY_HAS_MUSIC && condition <= LIBRARY_HAS_MUSICVIDEOS)
1745 bReturn = GetLibraryBool(condition);
1746 else if (condition == LIBRARY_IS_SCANNING)
1748 CGUIDialogMusicScan *musicScanner = (CGUIDialogMusicScan *)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN);
1749 CGUIDialogVideoScan *videoScanner = (CGUIDialogVideoScan *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
1750 if (musicScanner->IsScanning() || videoScanner->IsScanning())
1755 else if (condition == SYSTEM_PLATFORM_LINUX)
1756 #if defined(_LINUX) && !defined(__APPLE__)
1761 else if (condition == SYSTEM_PLATFORM_WINDOWS)
1767 else if (condition == SYSTEM_PLATFORM_OSX)
1773 else if (condition == SYSTEM_PLATFORM_XBOX)
1775 else if (condition == SYSTEM_MEDIA_DVD)
1776 bReturn = g_mediaManager.IsDiscInDrive();
1777 #ifdef HAS_DVD_DRIVE
1778 else if (condition == SYSTEM_HAS_DRIVE_F)
1779 bReturn = CIoSupport::DriveExists('F');
1780 else if (condition == SYSTEM_HAS_DRIVE_G)
1781 bReturn = CIoSupport::DriveExists('G');
1782 else if (condition == SYSTEM_DVDREADY)
1783 bReturn = g_mediaManager.GetDriveStatus() != DRIVE_NOT_READY;
1784 else if (condition == SYSTEM_TRAYOPEN)
1785 bReturn = g_mediaManager.GetDriveStatus() == DRIVE_OPEN;
1787 else if (condition == SYSTEM_CAN_POWERDOWN)
1788 bReturn = g_powerManager.CanPowerdown();
1789 else if (condition == SYSTEM_CAN_SUSPEND)
1790 bReturn = g_powerManager.CanSuspend();
1791 else if (condition == SYSTEM_CAN_HIBERNATE)
1792 bReturn = g_powerManager.CanHibernate();
1793 else if (condition == SYSTEM_CAN_REBOOT)
1794 bReturn = g_powerManager.CanReboot();
1796 else if (condition == PLAYER_SHOWINFO)
1797 bReturn = m_playerShowInfo;
1798 else if (condition == PLAYER_SHOWCODEC)
1799 bReturn = m_playerShowCodec;
1800 else if (condition >= SKIN_HAS_THEME_START && condition <= SKIN_HAS_THEME_END)
1801 { // Note that the code used here could probably be extended to general
1802 // settings conditions (parameter would need to store both the setting name an
1803 // the and the comparison string)
1804 CStdString theme = g_guiSettings.GetString("lookandfeel.skintheme");
1806 URIUtils::RemoveExtension(theme);
1807 bReturn = theme.Equals(m_stringParameters[condition - SKIN_HAS_THEME_START]);
1809 else if (condition >= MULTI_INFO_START && condition <= MULTI_INFO_END)
1811 // cache return value
1812 bool result = GetMultiInfoBool(m_multiInfo[condition - MULTI_INFO_START], contextWindow, item);
1814 CacheBool(condition1, contextWindow, result);
1817 else if (condition == SYSTEM_HASLOCKS)
1818 bReturn = g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE;
1819 else if (condition == SYSTEM_ISMASTER)
1820 bReturn = g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && g_passwordManager.bMasterUser;
1821 else if (condition == SYSTEM_LOGGEDON)
1822 bReturn = !(g_windowManager.GetActiveWindow() == WINDOW_LOGIN_SCREEN);
1823 else if (condition == SYSTEM_HAS_LOGINSCREEN)
1824 bReturn = g_settings.UsingLoginScreen();
1825 else if (condition == WEATHER_IS_FETCHED)
1826 bReturn = g_weatherManager.IsFetched();
1827 else if (condition == SYSTEM_INTERNET_STATE)
1829 g_sysinfo.GetInfo(condition);
1830 bReturn = g_sysinfo.HasInternet();
1832 else if (condition == SKIN_HAS_VIDEO_OVERLAY)
1834 bReturn = g_windowManager.IsOverlayAllowed() && g_application.IsPlayingVideo();
1836 else if (condition == SKIN_HAS_MUSIC_OVERLAY)
1838 bReturn = g_windowManager.IsOverlayAllowed() && g_application.IsPlayingAudio();
1840 else if (condition == CONTAINER_HASFILES || condition == CONTAINER_HASFOLDERS)
1842 CGUIWindow *pWindow = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1845 const CFileItemList& items=((CGUIMediaWindow*)pWindow)->CurrentDirectory();
1846 for (int i=0;i<items.Size();++i)
1848 CFileItemPtr item=items.Get(i);
1849 if (!item->m_bIsFolder && condition == CONTAINER_HASFILES)
1854 else if (item->m_bIsFolder && !item->IsParentFolder() && condition == CONTAINER_HASFOLDERS)
1862 else if (condition == CONTAINER_STACKED)
1864 CGUIWindow *pWindow = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1866 bReturn = ((CGUIMediaWindow*)pWindow)->CurrentDirectory().GetProperty("isstacked")=="1";
1868 else if (condition == CONTAINER_HAS_THUMB)
1870 CGUIWindow *pWindow = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1872 bReturn = ((CGUIMediaWindow*)pWindow)->CurrentDirectory().HasThumbnail();
1874 else if (condition == VIDEOPLAYER_HAS_INFO)
1875 bReturn = (m_currentFile->HasVideoInfoTag() && !m_currentFile->GetVideoInfoTag()->IsEmpty());
1876 else if (condition >= CONTAINER_SCROLL_PREVIOUS && condition <= CONTAINER_SCROLL_NEXT)
1878 // no parameters, so we assume it's just requested for a media window. It therefore
1879 // can only happen if the list has focus.
1880 CGUIWindow *pWindow = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
1883 map<int,int>::const_iterator it = m_containerMoves.find(pWindow->GetViewContainerID());
1884 if (it != m_containerMoves.end())
1886 if (condition > CONTAINER_STATIC) // moving up
1887 bReturn = it->second >= std::max(condition - CONTAINER_STATIC, 1);
1889 bReturn = it->second <= std::min(condition - CONTAINER_STATIC, -1);
1893 else if (g_application.IsPlaying())
1897 case PLAYER_HAS_MEDIA:
1900 case PLAYER_HAS_AUDIO:
1901 bReturn = g_application.IsPlayingAudio();
1903 case PLAYER_HAS_VIDEO:
1904 bReturn = g_application.IsPlayingVideo();
1906 case PLAYER_PLAYING:
1907 bReturn = !g_application.IsPaused() && (g_application.GetPlaySpeed() == 1);
1910 bReturn = g_application.IsPaused();
1912 case PLAYER_REWINDING:
1913 bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() < 1;
1915 case PLAYER_FORWARDING:
1916 bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() > 1;
1918 case PLAYER_REWINDING_2x:
1919 bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == -2;
1921 case PLAYER_REWINDING_4x:
1922 bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == -4;
1924 case PLAYER_REWINDING_8x:
1925 bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == -8;
1927 case PLAYER_REWINDING_16x:
1928 bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == -16;
1930 case PLAYER_REWINDING_32x:
1931 bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == -32;
1933 case PLAYER_FORWARDING_2x:
1934 bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == 2;
1936 case PLAYER_FORWARDING_4x:
1937 bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == 4;
1939 case PLAYER_FORWARDING_8x:
1940 bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == 8;
1942 case PLAYER_FORWARDING_16x:
1943 bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == 16;
1945 case PLAYER_FORWARDING_32x:
1946 bReturn = !g_application.IsPaused() && g_application.GetPlaySpeed() == 32;
1948 case PLAYER_CAN_RECORD:
1949 bReturn = g_application.m_pPlayer->CanRecord();
1951 case PLAYER_RECORDING:
1952 bReturn = g_application.m_pPlayer->IsRecording();
1954 case PLAYER_DISPLAY_AFTER_SEEK:
1955 bReturn = GetDisplayAfterSeek();
1957 case PLAYER_CACHING:
1958 bReturn = g_application.m_pPlayer->IsCaching();
1960 case PLAYER_SEEKBAR:
1962 CGUIDialogSeekBar *seekBar = (CGUIDialogSeekBar*)g_windowManager.GetWindow(WINDOW_DIALOG_SEEK_BAR);
1963 bReturn = seekBar ? seekBar->IsDialogRunning() : false;
1966 case PLAYER_SEEKING:
1967 bReturn = m_playerSeeking;
1969 case PLAYER_SHOWTIME:
1970 bReturn = m_playerShowTime;
1972 case PLAYER_PASSTHROUGH:
1973 bReturn = g_application.m_pPlayer && g_application.m_pPlayer->IsPassthrough();
1975 case MUSICPM_ENABLED:
1976 bReturn = g_partyModeManager.IsEnabled();
1978 case AUDIOSCROBBLER_ENABLED:
1979 bReturn = CLastFmManager::GetInstance()->IsLastFmEnabled();
1981 case LASTFM_RADIOPLAYING:
1982 bReturn = CLastFmManager::GetInstance()->IsRadioEnabled();
1984 case LASTFM_CANLOVE:
1985 bReturn = CLastFmManager::GetInstance()->CanLove();
1988 bReturn = CLastFmManager::GetInstance()->CanBan();
1990 case MUSICPLAYER_HASPREVIOUS:
1992 // requires current playlist be PLAYLIST_MUSIC
1994 if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
1995 bReturn = (g_playlistPlayer.GetCurrentSong() > 0); // not first song
1998 case MUSICPLAYER_HASNEXT:
2000 // requires current playlist be PLAYLIST_MUSIC
2002 if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
2003 bReturn = (g_playlistPlayer.GetCurrentSong() < (g_playlistPlayer.GetPlaylist(PLAYLIST_MUSIC).size() - 1)); // not last song
2006 case MUSICPLAYER_PLAYLISTPLAYING:
2009 if (g_application.IsPlayingAudio() && g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
2013 case VIDEOPLAYER_USING_OVERLAYS:
2014 bReturn = (g_guiSettings.GetInt("videoplayer.rendermethod") == RENDER_OVERLAYS);
2016 case VIDEOPLAYER_ISFULLSCREEN:
2017 bReturn = g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO;
2019 case VIDEOPLAYER_HASMENU:
2020 bReturn = g_application.m_pPlayer->HasMenu();
2022 case PLAYLIST_ISRANDOM:
2023 bReturn = g_playlistPlayer.IsShuffled(g_playlistPlayer.GetCurrentPlaylist());
2025 case PLAYLIST_ISREPEAT:
2026 bReturn = g_playlistPlayer.GetRepeat(g_playlistPlayer.GetCurrentPlaylist()) == PLAYLIST::REPEAT_ALL;
2028 case PLAYLIST_ISREPEATONE:
2029 bReturn = g_playlistPlayer.GetRepeat(g_playlistPlayer.GetCurrentPlaylist()) == PLAYLIST::REPEAT_ONE;
2031 case PLAYER_HASDURATION:
2032 bReturn = g_application.GetTotalTime() > 0;
2034 case VIDEOPLAYER_HASTELETEXT:
2035 if (g_application.m_pPlayer->GetTeletextCache())
2038 case VISUALISATION_LOCKED:
2040 CGUIMessage msg(GUI_MSG_GET_VISUALISATION, 0, 0);
2041 g_windowManager.SendMessage(msg);
2042 if (msg.GetPointer())
2044 CVisualisation *pVis = (CVisualisation *)msg.GetPointer();
2045 bReturn = pVis->IsLocked();
2049 case VISUALISATION_ENABLED:
2050 bReturn = g_guiSettings.GetString("musicplayer.visualisation") != "None";
2052 default: // default, use integer value different from 0 as true
2053 bReturn = GetInt(condition) != 0;
2056 // cache return value
2057 if (condition1 < 0) bReturn = !bReturn;
2059 if (!item) // don't cache item properties
2060 CacheBool(condition1, contextWindow, bReturn);
2065 /// \brief Examines the multi information sent and returns true or false accordingly.
2066 bool CGUIInfoManager::GetMultiInfoBool(const GUIInfo &info, int contextWindow, const CGUIListItem *item)
2068 bool bReturn = false;
2069 int condition = abs(info.m_info);
2071 if (condition >= LISTITEM_START && condition <= LISTITEM_END)
2073 // TODO: We currently don't use the item that is passed in to here, as these
2074 // conditions only come from Container(id).ListItem(offset).* at this point.
2075 CGUIListItemPtr item;
2076 CGUIWindow *window = NULL;
2077 int data1 = info.GetData1();
2078 if (!data1) // No container specified, so we lookup the current view container
2080 window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS);
2081 if (window && window->IsMediaWindow())
2082 data1 = ((CGUIMediaWindow*)(window))->GetViewContainerID();
2085 if (!window) // If we don't have a window already (from lookup above), get one
2086 window = GetWindowWithCondition(contextWindow, 0);
2090 const CGUIControl *control = window->GetControl(data1);
2091 if (control && control->IsContainer())
2092 item = ((CGUIBaseContainer *)control)->GetListItem(info.GetData2(), info.GetInfoFlag());
2095 if (item) // If we got a valid item, do the lookup
2096 bReturn = GetItemBool(item.get(), condition); // Image prioritizes images over labels (in the case of music item ratings for instance)
2104 bReturn = g_settings.GetSkinBool(info.GetData1());
2109 if (info.GetData2())
2110 bReturn = g_settings.GetSkinString(info.GetData1()).Equals(m_stringParameters[info.GetData2()]);
2112 bReturn = !g_settings.GetSkinString(info.GetData1()).IsEmpty();
2115 case STRING_IS_EMPTY:
2116 // note: Get*Image() falls back to Get*Label(), so this should cover all of them
2117 if (item && item->IsFileItem() && info.GetData1() >= LISTITEM_START && info.GetData1() < LISTITEM_END)
2118 bReturn = GetItemImage((const CFileItem *)item, info.GetData1()).IsEmpty();
2120 bReturn = GetImage(info.GetData1(), contextWindow).IsEmpty();
2122 case STRING_COMPARE:
2125 if (info.GetData2() < 0) // info labels are stored with negative numbers
2127 int info2 = -info.GetData2();
2128 if (item && item->IsFileItem() && info2 >= LISTITEM_START && info2 < LISTITEM_END)
2129 compare = GetItemImage((const CFileItem *)item, info2);
2131 compare = GetImage(info2, contextWindow);
2133 else if (info.GetData2() < (int)m_stringParameters.size())
2134 { // conditional string
2135 compare = m_stringParameters[info.GetData2()];
2137 if (item && item->IsFileItem() && info.GetData1() >= LISTITEM_START && info.GetData1() < LISTITEM_END)
2138 bReturn = GetItemImage((const CFileItem *)item, info.GetData1()).Equals(compare);
2140 bReturn = GetImage(info.GetData1(), contextWindow).Equals(compare);
2143 case INTEGER_GREATER_THAN:
2147 if (item && item->IsFileItem() && info.GetData1() >= LISTITEM_START && info.GetData1() < LISTITEM_END)
2148 value = GetItemImage((const CFileItem *)item, info.GetData1());
2150 value = GetImage(info.GetData1(), contextWindow);
2152 // Handle the case when a value contains time separator (:). This makes IntegerGreaterThan
2153 // useful for Player.Time* members without adding a separate set of members returning time in seconds
2154 if ( value.find_first_of( ':' ) != value.npos )
2155 bReturn = StringUtils::TimeStringToSeconds( value ) > info.GetData2();
2157 bReturn = atoi( value.c_str() ) > info.GetData2();
2162 CStdString compare = m_stringParameters[info.GetData2()];
2163 // our compare string is already in lowercase, so lower case our label as well
2164 // as CStdString::Find() is case sensitive
2166 if (item && item->IsFileItem() && info.GetData1() >= LISTITEM_START && info.GetData1() < LISTITEM_END)
2167 label = GetItemImage((const CFileItem *)item, info.GetData1()).ToLower();
2169 label = GetImage(info.GetData1(), contextWindow).ToLower();
2170 if (compare.Right(5).Equals(",left"))
2171 bReturn = label.Find(compare.Mid(0,compare.size()-5)) == 0;
2172 else if (compare.Right(6).Equals(",right"))
2174 compare = compare.Mid(0,compare.size()-6);
2175 bReturn = label.Find(compare) == (int)(label.size()-compare.size());
2178 bReturn = label.Find(compare) > -1;
2181 case SYSTEM_ALARM_LESS_OR_EQUAL:
2183 int time = lrint(g_alarmClock.GetRemaining(m_stringParameters[info.GetData1()]));
2184 int timeCompare = atoi(m_stringParameters[info.GetData2()]);
2186 bReturn = timeCompare >= time;
2191 case CONTROL_GROUP_HAS_FOCUS:
2193 CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
2195 bReturn = window->ControlGroupHasFocus(info.GetData1(), info.GetData2());
2198 case CONTROL_IS_VISIBLE:
2200 CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
2203 // Note: This'll only work for unique id's
2204 const CGUIControl *control = window->GetControl(info.GetData1());
2206 bReturn = control->IsVisible();
2210 case CONTROL_IS_ENABLED:
2212 CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
2215 // Note: This'll only work for unique id's
2216 const CGUIControl *control = window->GetControl(info.GetData1());
2218 bReturn = !control->IsDisabled();
2222 case CONTROL_HAS_FOCUS:
2224 CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
2226 bReturn = (window->GetFocusedControlID() == (int)info.GetData1());
2229 case BUTTON_SCROLLER_HAS_ICON:
2231 CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
2234 CGUIControl *pControl = window->GetFocusedControl();
2235 if (pControl && pControl->GetControlType() == CGUIControl::GUICONTROL_BUTTONBAR)
2236 bReturn = ((CGUIButtonScroller *)pControl)->GetActiveButtonID() == (int)info.GetData1();
2241 if (info.GetData1())
2242 bReturn = ((int)info.GetData1() == m_nextWindowID);
2245 CGUIWindow *window = g_windowManager.GetWindow(m_nextWindowID);
2246 if (window && URIUtils::GetFileName(window->GetProperty("xmlfile")).Equals(m_stringParameters[info.GetData2()]))
2250 case WINDOW_PREVIOUS:
2251 if (info.GetData1())
2252 bReturn = ((int)info.GetData1() == m_prevWindowID);
2255 CGUIWindow *window = g_windowManager.GetWindow(m_prevWindowID);
2256 if (window && URIUtils::GetFileName(window->GetProperty("xmlfile")).Equals(m_stringParameters[info.GetData2()]))
2260 case WINDOW_IS_VISIBLE:
2261 if (info.GetData1())
2262 bReturn = g_windowManager.IsWindowVisible(info.GetData1());
2264 bReturn = g_windowManager.IsWindowVisible(m_stringParameters[info.GetData2()]);
2266 case WINDOW_IS_TOPMOST:
2267 if (info.GetData1())
2268 bReturn = g_windowManager.IsWindowTopMost(info.GetData1());
2270 bReturn = g_windowManager.IsWindowTopMost(m_stringParameters[info.GetData2()]);
2272 case WINDOW_IS_ACTIVE:
2273 if (info.GetData1())
2274 bReturn = g_windowManager.IsWindowActive(info.GetData1());
2276 bReturn = g_windowManager.IsWindowActive(m_stringParameters[info.GetData2()]);
2278 case SYSTEM_HAS_ALARM:
2279 bReturn = g_alarmClock.HasAlarm(m_stringParameters[info.GetData1()]);
2281 case SYSTEM_GET_BOOL:
2282 bReturn = g_guiSettings.GetBool(m_stringParameters[info.GetData1()]);
2284 case SYSTEM_HAS_CORE_ID:
2285 bReturn = g_cpuInfo.HasCoreId(info.GetData1());
2287 case SYSTEM_SETTING:
2289 if ( m_stringParameters[info.GetData1()].Equals("hidewatched") )
2291 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2293 bReturn = g_settings.GetWatchMode(((CGUIMediaWindow *)window)->CurrentDirectory().GetContent()) == VIDEO_SHOW_UNWATCHED;
2297 case SYSTEM_HAS_ADDON:
2300 bReturn = CAddonMgr::Get().GetAddon(m_stringParameters[info.GetData1()],addon) && addon;
2303 case CONTAINER_SCROLL_PREVIOUS:
2304 case CONTAINER_MOVE_PREVIOUS:
2305 case CONTAINER_MOVE_NEXT:
2306 case CONTAINER_SCROLL_NEXT:
2308 map<int,int>::const_iterator it = m_containerMoves.find(info.GetData1());
2309 if (it != m_containerMoves.end())
2311 if (condition > CONTAINER_STATIC) // moving up
2312 bReturn = it->second >= std::max(condition - CONTAINER_STATIC, 1);
2314 bReturn = it->second <= std::min(condition - CONTAINER_STATIC, -1);
2318 case CONTAINER_CONTENT:
2321 CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
2324 if (window->GetID() == WINDOW_DIALOG_MUSIC_INFO)
2325 content = ((CGUIDialogMusicInfo *)window)->CurrentDirectory().GetContent();
2326 else if (window->GetID() == WINDOW_DIALOG_VIDEO_INFO)
2327 content = ((CGUIDialogVideoInfo *)window)->CurrentDirectory().GetContent();
2329 if (content.IsEmpty())
2331 window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2333 content = ((CGUIMediaWindow *)window)->CurrentDirectory().GetContent();
2335 bReturn = m_stringParameters[info.GetData1()].Equals(content);
2339 case CONTAINER_COLUMN:
2340 case CONTAINER_POSITION:
2341 case CONTAINER_HAS_NEXT:
2342 case CONTAINER_HAS_PREVIOUS:
2343 case CONTAINER_SCROLLING:
2344 case CONTAINER_SUBITEM:
2346 const CGUIControl *control = NULL;
2347 if (info.GetData1())
2348 { // container specified
2349 CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
2351 control = window->GetControl(info.GetData1());
2354 { // no container specified - assume a mediawindow
2355 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2357 control = window->GetControl(window->GetViewContainerID());
2360 bReturn = control->GetCondition(condition, info.GetData2());
2363 case CONTAINER_HAS_FOCUS:
2364 { // grab our container
2365 CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
2368 const CGUIControl *control = window->GetControl(info.GetData1());
2369 if (control && control->IsContainer())
2371 CFileItemPtr item = boost::static_pointer_cast<CFileItem>(((CGUIBaseContainer *)control)->GetListItem(0));
2372 if (item && item->m_iprogramCount == info.GetData2()) // programcount used to store item id
2378 case VIDEOPLAYER_CONTENT:
2380 CStdString strContent="movies";
2381 if (!m_currentFile->HasVideoInfoTag() || m_currentFile->GetVideoInfoTag()->IsEmpty())
2382 strContent = "files";
2383 if (m_currentFile->HasVideoInfoTag() && m_currentFile->GetVideoInfoTag()->m_iSeason > -1) // episode
2384 strContent = "episodes";
2385 if (m_currentFile->HasVideoInfoTag() && !m_currentFile->GetVideoInfoTag()->m_strArtist.IsEmpty())
2386 strContent = "musicvideos";
2387 if (m_currentFile->HasVideoInfoTag() && m_currentFile->GetVideoInfoTag()->m_strStatus == "livetv")
2388 strContent = "livetv";
2389 bReturn = m_stringParameters[info.GetData1()].Equals(strContent);
2392 case CONTAINER_SORT_METHOD:
2394 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2397 const CGUIViewState *viewState = ((CGUIMediaWindow*)window)->GetViewState();
2399 bReturn = ((unsigned int)viewState->GetSortMethod() == info.GetData1());
2403 case CONTAINER_SORT_DIRECTION:
2405 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2408 const CGUIViewState *viewState = ((CGUIMediaWindow*)window)->GetViewState();
2410 bReturn = ((unsigned int)viewState->GetDisplaySortOrder() == info.GetData1());
2416 CDateTime date = CDateTime::GetCurrentDateTime();
2417 int currentDate = date.GetMonth()*100+date.GetDay();
2418 int startDate = info.GetData1();
2419 int stopDate = info.GetData2();
2421 if (stopDate < startDate)
2422 bReturn = currentDate >= startDate || currentDate < stopDate;
2424 bReturn = currentDate >= startDate && currentDate < stopDate;
2429 CDateTime time=CDateTime::GetCurrentDateTime();
2430 int currentTime = time.GetMinuteOfDay();
2431 int startTime = info.GetData1();
2432 int stopTime = info.GetData2();
2434 if (stopTime < startTime)
2435 bReturn = currentTime >= startTime || currentTime < stopTime;
2437 bReturn = currentTime >= startTime && currentTime < stopTime;
2440 case MUSICPLAYER_EXISTS:
2442 int index = info.GetData2();
2443 if (info.GetData1() == 1)
2445 if (g_playlistPlayer.GetCurrentPlaylist() != PLAYLIST_MUSIC)
2447 index += g_playlistPlayer.GetCurrentSong();
2449 if (index >= 0 && index < g_playlistPlayer.GetPlaylist(PLAYLIST_MUSIC).size())
2456 return (info.m_info < 0) ? !bReturn : bReturn;
2459 /// \brief Examines the multi information sent and returns the string as appropriate
2460 CStdString CGUIInfoManager::GetMultiInfoLabel(const GUIInfo &info, int contextWindow) const
2462 if (info.m_info == SKIN_STRING)
2464 return g_settings.GetSkinString(info.GetData1());
2466 else if (info.m_info == SKIN_BOOL)
2468 bool bInfo = g_settings.GetSkinBool(info.GetData1());
2470 return g_localizeStrings.Get(20122);
2472 if (info.m_info >= LISTITEM_START && info.m_info <= LISTITEM_END)
2475 CGUIWindow *window = NULL;
2477 int data1 = info.GetData1();
2478 if (!data1) // No container specified, so we lookup the current view container
2480 window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS);
2481 if (window && window->IsMediaWindow())
2482 data1 = ((CGUIMediaWindow*)(window))->GetViewContainerID();
2485 if (!window) // If we don't have a window already (from lookup above), get one
2486 window = GetWindowWithCondition(contextWindow, 0);
2490 const CGUIControl *control = window->GetControl(data1);
2491 if (control && control->IsContainer())
2492 item = boost::static_pointer_cast<CFileItem>(((CGUIBaseContainer *)control)->GetListItem(info.GetData2(), info.GetInfoFlag()));
2495 if (item) // If we got a valid item, do the lookup
2496 return GetItemImage(item.get(), info.m_info); // Image prioritizes images over labels (in the case of music item ratings for instance)
2498 else if (info.m_info == PLAYER_TIME)
2500 return GetCurrentPlayTime((TIME_FORMAT)info.GetData1());
2502 else if (info.m_info == PLAYER_TIME_REMAINING)
2504 return GetCurrentPlayTimeRemaining((TIME_FORMAT)info.GetData1());
2506 else if (info.m_info == PLAYER_FINISH_TIME)
2508 CDateTime time = CDateTime::GetCurrentDateTime();
2509 time += CDateTimeSpan(0, 0, 0, GetPlayTimeRemaining());
2510 return LocalizeTime(time, (TIME_FORMAT)info.GetData1());
2512 else if (info.m_info == PLAYER_TIME_SPEED)
2515 if (g_application.GetPlaySpeed() != 1)
2516 strTime.Format("%s (%ix)", GetCurrentPlayTime((TIME_FORMAT)info.GetData1()).c_str(), g_application.GetPlaySpeed());
2518 strTime = GetCurrentPlayTime();
2521 else if (info.m_info == PLAYER_DURATION)
2523 return GetDuration((TIME_FORMAT)info.GetData1());
2525 else if (info.m_info == PLAYER_SEEKTIME)
2527 TIME_FORMAT format = (TIME_FORMAT)info.GetData1();
2528 if (format == TIME_FORMAT_GUESS && GetTotalPlayTime() >= 3600)
2529 format = TIME_FORMAT_HH_MM_SS;
2530 CGUIDialogSeekBar *seekBar = (CGUIDialogSeekBar*)g_windowManager.GetWindow(WINDOW_DIALOG_SEEK_BAR);
2532 return seekBar->GetSeekTimeLabel(format);
2534 else if (info.m_info == PLAYER_SEEKOFFSET)
2536 CStdString seekOffset = StringUtils::SecondsToTimeString(abs(m_seekOffset), (TIME_FORMAT)info.GetData1());
2537 if (m_seekOffset < 0)
2538 return "-" + seekOffset;
2539 if (m_seekOffset > 0)
2540 return "+" + seekOffset;
2542 else if (info.m_info == SYSTEM_TIME)
2544 return GetTime((TIME_FORMAT)info.GetData1());
2546 else if (info.m_info == CONTAINER_NUM_PAGES || info.m_info == CONTAINER_CURRENT_PAGE ||
2547 info.m_info == CONTAINER_NUM_ITEMS || info.m_info == CONTAINER_POSITION)
2549 const CGUIControl *control = NULL;
2550 if (info.GetData1())
2551 { // container specified
2552 CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
2554 control = window->GetControl(info.GetData1());
2557 { // no container specified - assume a mediawindow
2558 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2560 control = window->GetControl(window->GetViewContainerID());
2564 if (control->IsContainer())
2565 return ((CGUIBaseContainer *)control)->GetLabel(info.m_info);
2566 else if (control->GetControlType() == CGUIControl::GUICONTROL_TEXTBOX)
2567 return ((CGUITextBox *)control)->GetLabel(info.m_info);
2570 else if (info.m_info == SYSTEM_GET_CORE_USAGE)
2573 strCpu.Format("%4.2f", g_cpuInfo.GetCoreInfo(info.GetData1()).m_fPct);
2576 else if (info.m_info >= MUSICPLAYER_TITLE && info.m_info <= MUSICPLAYER_ALBUM_ARTIST)
2577 return GetMusicPlaylistInfo(info);
2578 else if (info.m_info == CONTAINER_PROPERTY)
2580 CGUIWindow *window = NULL;
2581 if (info.GetData1())
2582 { // container specified
2583 window = GetWindowWithCondition(contextWindow, 0);
2586 { // no container specified - assume a mediawindow
2587 window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2590 return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty(m_stringParameters[info.GetData2()]);
2592 else if (info.m_info == CONTROL_GET_LABEL)
2594 CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
2597 const CGUIControl *control = window->GetControl(info.GetData1());
2599 return control->GetDescription();
2602 else if (info.m_info == WINDOW_PROPERTY)
2604 CGUIWindow *window = NULL;
2605 if (info.GetData1())
2606 { // window specified
2607 window = g_windowManager.GetWindow(info.GetData1());//GetWindowWithCondition(contextWindow, 0);
2610 { // no window specified - assume active
2611 window = GetWindowWithCondition(contextWindow, 0);
2615 return window->GetProperty(m_stringParameters[info.GetData2()]);
2617 else if (info.m_info == SYSTEM_ADDON_TITLE ||
2618 info.m_info == SYSTEM_ADDON_ICON)
2621 if (info.GetData2() == 0)
2622 CAddonMgr::Get().GetAddon(const_cast<CGUIInfoManager*>(this)->GetLabel(info.GetData1(), contextWindow),addon);
2624 CAddonMgr::Get().GetAddon(m_stringParameters[info.GetData1()],addon);
2625 if (addon && info.m_info == SYSTEM_ADDON_TITLE)
2626 return addon->Name();
2627 if (addon && info.m_info == SYSTEM_ADDON_ICON)
2628 return addon->Icon();
2631 return StringUtils::EmptyString;
2634 /// \brief Obtains the filename of the image to show from whichever subsystem is needed
2635 CStdString CGUIInfoManager::GetImage(int info, int contextWindow)
2637 if (info >= MULTI_INFO_START && info <= MULTI_INFO_END)
2639 return GetMultiInfoLabel(m_multiInfo[info - MULTI_INFO_START], contextWindow);
2641 else if (info == WEATHER_CONDITIONS)
2642 return g_weatherManager.GetInfo(WEATHER_IMAGE_CURRENT_ICON);
2643 else if (info == SYSTEM_PROFILETHUMB)
2645 CStdString thumb = g_settings.GetCurrentProfile().getThumb();
2646 if (thumb.IsEmpty())
2647 thumb = "unknown-user.png";
2650 else if (info == MUSICPLAYER_COVER)
2652 if (!g_application.IsPlayingAudio()) return "";
2653 return m_currentFile->HasThumbnail() ? m_currentFile->GetThumbnailImage() : "DefaultAlbumCover.png";
2655 else if (info == MUSICPLAYER_RATING)
2657 if (!g_application.IsPlayingAudio()) return "";
2658 return GetItemImage(m_currentFile, LISTITEM_RATING);
2660 else if (info == PLAYER_STAR_RATING)
2662 if (!g_application.IsPlaying()) return "";
2663 return GetItemImage(m_currentFile, LISTITEM_STAR_RATING);
2665 else if (info == VIDEOPLAYER_COVER)
2667 if (!g_application.IsPlayingVideo()) return "";
2668 if(m_currentMovieThumb.IsEmpty())
2669 return m_currentFile->HasThumbnail() ? m_currentFile->GetThumbnailImage() : "DefaultVideoCover.png";
2670 else return m_currentMovieThumb;
2672 else if (info == CONTAINER_FOLDERTHUMB)
2674 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2676 return GetItemImage(&const_cast<CFileItemList&>(((CGUIMediaWindow*)window)->CurrentDirectory()), LISTITEM_THUMB);
2678 else if (info == CONTAINER_TVSHOWTHUMB)
2680 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2682 return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("tvshowthumb");
2684 else if (info == CONTAINER_SEASONTHUMB)
2686 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
2688 return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("seasonthumb");
2690 else if (info == LISTITEM_THUMB || info == LISTITEM_ICON || info == LISTITEM_ACTUAL_ICON ||
2691 info == LISTITEM_OVERLAY || info == LISTITEM_RATING || info == LISTITEM_STAR_RATING)
2693 CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS);
2696 CFileItemPtr item = window->GetCurrentListItem();
2698 return GetItemImage(item.get(), info);
2701 return GetLabel(info, contextWindow);
2704 CStdString CGUIInfoManager::GetDate(bool bNumbersOnly)
2706 CDateTime time=CDateTime::GetCurrentDateTime();
2707 return time.GetAsLocalizedDate(!bNumbersOnly);
2710 CStdString CGUIInfoManager::GetTime(TIME_FORMAT format) const
2712 CDateTime time=CDateTime::GetCurrentDateTime();
2713 return LocalizeTime(time, format);
2716 CStdString CGUIInfoManager::GetLcdTime( int _eInfo ) const
2718 CDateTime time=CDateTime::GetCurrentDateTime();
2719 CStdString strLcdTime;
2725 CStdString strTimeMarker;
2733 nCharset = 1; // CUSTOM_CHARSET_SMALLCHAR;
2735 strTimeMarker = ".";
2738 nCharset = 1; // CUSTOM_CHARSET_SMALLCHAR;
2740 strTimeMarker = ".";
2744 nCharset = 2; // CUSTOM_CHARSET_MEDIUMCHAR;
2746 strTimeMarker = ".";
2749 nCharset = 2; // CUSTOM_CHARSET_MEDIUMCHAR;
2751 strTimeMarker = ".";
2755 nCharset = 3; // CUSTOM_CHARSET_BIGCHAR;
2757 strTimeMarker = " ";
2760 nCharset = 3; // CUSTOM_CHARSET_BIGCHAR;
2762 strTimeMarker = "o";
2765 nCharset = 3; // CUSTOM_CHARSET_BIGCHAR;
2767 strTimeMarker = "o";
2770 nCharset = 3; // CUSTOM_CHARSET_BIGCHAR;
2772 strTimeMarker = " ";
2776 strLcdTime += g_lcd->GetBigDigit( nCharset, time.GetHour() , nLine, 2, 2, true );
2777 strLcdTime += strTimeMarker;
2778 strLcdTime += g_lcd->GetBigDigit( nCharset, time.GetMinute(), nLine, 2, 2, false );
2779 strLcdTime += strTimeMarker;
2780 strLcdTime += g_lcd->GetBigDigit( nCharset, time.GetSecond(), nLine, 2, 2, false );
2787 CStdString CGUIInfoManager::LocalizeTime(const CDateTime &time, TIME_FORMAT format) const
2789 const CStdString timeFormat = g_langInfo.GetTimeFormat();
2790 bool use12hourclock = timeFormat.Find('h') != -1;
2793 case TIME_FORMAT_GUESS:
2794 return time.GetAsLocalizedTime("", false);
2795 case TIME_FORMAT_SS:
2796 return time.GetAsLocalizedTime("ss", true);
2797 case TIME_FORMAT_MM:
2798 return time.GetAsLocalizedTime("mm", true);
2799 case TIME_FORMAT_MM_SS:
2800 return time.GetAsLocalizedTime("mm:ss", true);
2801 case TIME_FORMAT_HH: // this forces it to a 12 hour clock
2802 return time.GetAsLocalizedTime(use12hourclock ? "h" : "HH", false);
2803 case TIME_FORMAT_HH_MM:
2804 return time.GetAsLocalizedTime(use12hourclock ? "h:mm" : "HH:mm", false);
2805 case TIME_FORMAT_HH_MM_XX:
2806 return time.GetAsLocalizedTime(use12hourclock ? "h:mm xx" : "HH:mm", false);
2807 case TIME_FORMAT_HH_MM_SS:
2808 return time.GetAsLocalizedTime("", true);
2812 return time.GetAsLocalizedTime("", false);
2815 CStdString CGUIInfoManager::GetDuration(TIME_FORMAT format) const
2817 if (g_application.IsPlayingAudio() && m_currentFile->HasMusicInfoTag())
2819 const CMusicInfoTag& tag = *m_currentFile->GetMusicInfoTag();
2820 if (tag.GetDuration() > 0)
2821 return StringUtils::SecondsToTimeString(tag.GetDuration(), format);
2823 if (g_application.IsPlayingVideo() && !m_currentMovieDuration.IsEmpty())
2824 return m_currentMovieDuration; // for tuxbox
2825 unsigned int iTotal = (unsigned int)g_application.GetTotalTime();
2827 return StringUtils::SecondsToTimeString(iTotal, format);
2831 CStdString CGUIInfoManager::GetMusicPartyModeLabel(int item)
2834 if (item >= MUSICPM_SONGSPLAYED && item <= MUSICPM_RANDOMSONGSPICKED)
2839 case MUSICPM_SONGSPLAYED:
2841 iSongs = g_partyModeManager.GetSongsPlayed();
2844 case MUSICPM_MATCHINGSONGS:
2846 iSongs = g_partyModeManager.GetMatchingSongs();
2849 case MUSICPM_MATCHINGSONGSPICKED:
2851 iSongs = g_partyModeManager.GetMatchingSongsPicked();
2854 case MUSICPM_MATCHINGSONGSLEFT:
2856 iSongs = g_partyModeManager.GetMatchingSongsLeft();
2859 case MUSICPM_RELAXEDSONGSPICKED:
2861 iSongs = g_partyModeManager.GetRelaxedSongs();
2864 case MUSICPM_RANDOMSONGSPICKED:
2866 iSongs = g_partyModeManager.GetRandomSongs();
2872 CStdString strLabel;
2873 strLabel.Format("%i", iSongs);
2879 const CStdString CGUIInfoManager::GetMusicPlaylistInfo(const GUIInfo& info) const
2881 PLAYLIST::CPlayList& playlist = g_playlistPlayer.GetPlaylist(PLAYLIST_MUSIC);
2882 if (playlist.size() < 1)
2884 int index = info.GetData2();
2885 if (info.GetData1() == 1)
2886 { // relative index (requires current playlist is PLAYLIST_MUSIC)
2887 if (g_playlistPlayer.GetCurrentPlaylist() != PLAYLIST_MUSIC)
2889 index = g_playlistPlayer.GetNextSong(index);
2891 if (index < 0 || index >= playlist.size())
2893 CFileItemPtr playlistItem = playlist[index];
2894 if (!playlistItem->GetMusicInfoTag()->Loaded())
2896 playlistItem->LoadMusicTag();
2897 playlistItem->GetMusicInfoTag()->SetLoaded();
2899 // try to set a thumbnail
2900 if (!playlistItem->HasThumbnail())
2902 playlistItem->SetMusicThumb();
2903 // still no thumb? then just the set the default cover
2904 if (!playlistItem->HasThumbnail())
2905 playlistItem->SetThumbnailImage("DefaultAlbumCover.png");
2907 if (info.m_info == MUSICPLAYER_PLAYLISTPOS)
2909 CStdString strPosition = "";
2910 strPosition.Format("%i", index + 1);
2913 else if (info.m_info == MUSICPLAYER_COVER)
2914 return playlistItem->GetThumbnailImage();
2915 return GetMusicTagLabel(info.m_info, playlistItem.get());
2918 CStdString CGUIInfoManager::GetPlaylistLabel(int item) const
2920 if (!g_application.IsPlaying()) return "";
2921 int iPlaylist = g_playlistPlayer.GetCurrentPlaylist();
2924 case PLAYLIST_LENGTH:
2926 CStdString strLength = "";
2927 strLength.Format("%i", g_playlistPlayer.GetPlaylist(iPlaylist).size());
2930 case PLAYLIST_POSITION:
2932 CStdString strPosition = "";
2933 strPosition.Format("%i", g_playlistPlayer.GetCurrentSong() + 1);
2936 case PLAYLIST_RANDOM:
2938 if (g_playlistPlayer.IsShuffled(iPlaylist))
2939 return g_localizeStrings.Get(590); // 590: Random
2941 return g_localizeStrings.Get(591); // 591: Off
2943 case PLAYLIST_REPEAT:
2945 PLAYLIST::REPEAT_STATE state = g_playlistPlayer.GetRepeat(iPlaylist);
2946 if (state == PLAYLIST::REPEAT_ONE)
2947 return g_localizeStrings.Get(592); // 592: One
2948 else if (state == PLAYLIST::REPEAT_ALL)
2949 return g_localizeStrings.Get(593); // 593: All
2951 return g_localizeStrings.Get(594); // 594: Off
2957 CStdString CGUIInfoManager::GetMusicLabel(int item)
2959 if (!g_application.IsPlayingAudio() || !m_currentFile->HasMusicInfoTag()) return "";
2962 case MUSICPLAYER_PLAYLISTLEN:
2964 if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
2965 return GetPlaylistLabel(PLAYLIST_LENGTH);
2968 case MUSICPLAYER_PLAYLISTPOS:
2970 if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
2971 return GetPlaylistLabel(PLAYLIST_POSITION);
2974 case MUSICPLAYER_BITRATE:
2976 float fTimeSpan = (float)(CTimeUtils::GetFrameTime() - m_lastMusicBitrateTime);
2977 if (fTimeSpan >= 500.0f)
2979 m_MusicBitrate = g_application.m_pPlayer->GetAudioBitrate();
2980 m_lastMusicBitrateTime = CTimeUtils::GetFrameTime();
2982 CStdString strBitrate = "";
2983 if (m_MusicBitrate > 0)
2984 strBitrate.Format("%i", MathUtils::round_int((double)m_MusicBitrate / 1000.0));
2988 case MUSICPLAYER_CHANNELS:
2990 CStdString strChannels = "";
2991 if (g_application.m_pPlayer->GetChannels() > 0)
2993 strChannels.Format("%i", g_application.m_pPlayer->GetChannels());
2998 case MUSICPLAYER_BITSPERSAMPLE:
3000 CStdString strBitsPerSample = "";
3001 if (g_application.m_pPlayer->GetBitsPerSample() > 0)
3003 strBitsPerSample.Format("%i", g_application.m_pPlayer->GetBitsPerSample());
3005 return strBitsPerSample;
3008 case MUSICPLAYER_SAMPLERATE:
3010 CStdString strSampleRate = "";
3011 if (g_application.m_pPlayer->GetSampleRate() > 0)
3013 strSampleRate.Format("%i",g_application.m_pPlayer->GetSampleRate());
3015 return strSampleRate;
3018 case MUSICPLAYER_CODEC:
3020 CStdString strCodec;
3021 strCodec.Format("%s", g_application.m_pPlayer->GetAudioCodecName().c_str());
3025 case MUSICPLAYER_LYRICS:
3026 return GetItemLabel(m_currentFile, AddListItemProp("lyrics"));
3028 return GetMusicTagLabel(item, m_currentFile);
3031 CStdString CGUIInfoManager::GetMusicTagLabel(int info, const CFileItem *item) const
3033 if (!item->HasMusicInfoTag()) return "";
3034 const CMusicInfoTag &tag = *item->GetMusicInfoTag();
3037 case MUSICPLAYER_TITLE:
3038 if (tag.GetTitle().size()) { return tag.GetTitle(); }
3040 case MUSICPLAYER_ALBUM:
3041 if (tag.GetAlbum().size()) { return tag.GetAlbum(); }
3043 case MUSICPLAYER_ARTIST:
3044 if (tag.GetArtist().size()) { return tag.GetArtist(); }
3046 case MUSICPLAYER_ALBUM_ARTIST:
3047 if (tag.GetAlbumArtist().size()) { return tag.GetAlbumArtist(); }
3049 case MUSICPLAYER_YEAR:
3050 if (tag.GetYear()) { return tag.GetYearString(); }
3052 case MUSICPLAYER_GENRE:
3053 if (tag.GetGenre().size()) { return tag.GetGenre(); }
3055 case MUSICPLAYER_LYRICS:
3056 if (tag.GetLyrics().size()) { return tag.GetLyrics(); }
3058 case MUSICPLAYER_TRACK_NUMBER:
3060 CStdString strTrack;
3061 if (tag.Loaded() && tag.GetTrackNumber() > 0)
3063 strTrack.Format("%02i", tag.GetTrackNumber());
3068 case MUSICPLAYER_DISC_NUMBER:
3071 if (tag.Loaded() && tag.GetDiscNumber() > 0)
3073 strDisc.Format("%02i", tag.GetDiscNumber());
3078 case MUSICPLAYER_RATING:
3079 return GetItemLabel(item, LISTITEM_RATING);
3080 case MUSICPLAYER_COMMENT:
3081 return GetItemLabel(item, LISTITEM_COMMENT);
3082 case MUSICPLAYER_DURATION:
3083 return GetItemLabel(item, LISTITEM_DURATION);
3084 case MUSICPLAYER_PLAYCOUNT:
3085 return GetItemLabel(item, LISTITEM_PLAYCOUNT);
3086 case MUSICPLAYER_LASTPLAYED:
3087 return GetItemLabel(item, LISTITEM_LASTPLAYED);
3092 CStdString CGUIInfoManager::GetVideoLabel(int item)
3094 if (!g_application.IsPlayingVideo())
3097 if (item == VIDEOPLAYER_TITLE)
3099 if (m_currentFile->HasVideoInfoTag() && !m_currentFile->GetVideoInfoTag()->m_strTitle.IsEmpty())
3100 return m_currentFile->GetVideoInfoTag()->m_strTitle;
3101 // don't have the title, so use dvdplayer, label, or drop down to title from path
3102 if (!g_application.m_pPlayer->GetPlayingTitle().IsEmpty())
3103 return g_application.m_pPlayer->GetPlayingTitle();
3104 if (!m_currentFile->GetLabel().IsEmpty())
3105 return m_currentFile->GetLabel();
3106 return CUtil::GetTitleFromPath(m_currentFile->m_strPath);
3108 else if (item == VIDEOPLAYER_PLAYLISTLEN)
3110 if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_VIDEO)
3111 return GetPlaylistLabel(PLAYLIST_LENGTH);
3113 else if (item == VIDEOPLAYER_PLAYLISTPOS)
3115 if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_VIDEO)
3116 return GetPlaylistLabel(PLAYLIST_POSITION);
3118 else if (m_currentFile->HasVideoInfoTag())
3122 case VIDEOPLAYER_ORIGINALTITLE:
3123 return m_currentFile->GetVideoInfoTag()->m_strOriginalTitle;
3125 case VIDEOPLAYER_GENRE:
3126 return m_currentFile->GetVideoInfoTag()->m_strGenre;
3128 case VIDEOPLAYER_DIRECTOR:
3129 return m_currentFile->GetVideoInfoTag()->m_strDirector;
3131 case VIDEOPLAYER_RATING:
3133 CStdString strRating;
3134 if (m_currentFile->GetVideoInfoTag()->m_fRating > 0.f)
3135 strRating.Format("%.1f", m_currentFile->GetVideoInfoTag()->m_fRating);
3139 case VIDEOPLAYER_RATING_AND_VOTES:
3141 CStdString strRatingAndVotes;
3142 if (m_currentFile->GetVideoInfoTag()->m_fRating > 0.f)
3144 if (m_currentFile->GetVideoInfoTag()->m_strVotes.IsEmpty())
3145 strRatingAndVotes.Format("%.1f", m_currentFile->GetVideoInfoTag()->m_fRating);
3147 strRatingAndVotes.Format("%.1f (%s %s)", m_currentFile->GetVideoInfoTag()->m_fRating, m_currentFile->GetVideoInfoTag()->m_strVotes, g_localizeStrings.Get(20350));
3149 return strRatingAndVotes;
3152 case VIDEOPLAYER_YEAR:
3155 if (m_currentFile->GetVideoInfoTag()->m_iYear > 0)
3156 strYear.Format("%i", m_currentFile->GetVideoInfoTag()->m_iYear);
3160 case VIDEOPLAYER_PREMIERED:
3162 if (!m_currentFile->GetVideoInfoTag()->m_strFirstAired.IsEmpty())
3163 return m_currentFile->GetVideoInfoTag()->m_strFirstAired;
3164 if (!m_currentFile->GetVideoInfoTag()->m_strPremiered.IsEmpty())
3165 return m_currentFile->GetVideoInfoTag()->m_strPremiered;
3168 case VIDEOPLAYER_PLOT:
3169 return m_currentFile->GetVideoInfoTag()->m_strPlot;
3170 case VIDEOPLAYER_TRAILER:
3171 return m_currentFile->GetVideoInfoTag()->m_strTrailer;
3172 case VIDEOPLAYER_PLOT_OUTLINE:
3173 return m_currentFile->GetVideoInfoTag()->m_strPlotOutline;
3174 case VIDEOPLAYER_EPISODE:
3177 if (m_currentFile->GetVideoInfoTag()->m_iSpecialSortEpisode > 0)
3178 strYear.Format("S%i", m_currentFile->GetVideoInfoTag()->m_iEpisode);
3179 else if(m_currentFile->GetVideoInfoTag()->m_iEpisode > 0)
3180 strYear.Format("%i", m_currentFile->GetVideoInfoTag()->m_iEpisode);
3184 case VIDEOPLAYER_SEASON:
3187 if (m_currentFile->GetVideoInfoTag()->m_iSpecialSortSeason > 0)
3188 strYear.Format("%i", m_currentFile->GetVideoInfoTag()->m_iSpecialSortSeason);
3189 else if(m_currentFile->GetVideoInfoTag()->m_iSeason > 0)
3190 strYear.Format("%i", m_currentFile->GetVideoInfoTag()->m_iSeason);
3194 case VIDEOPLAYER_TVSHOW:
3195 return m_currentFile->GetVideoInfoTag()->m_strShowTitle;
3197 case VIDEOPLAYER_STUDIO:
3198 return m_currentFile->GetVideoInfoTag()->m_strStudio;
3199 case VIDEOPLAYER_COUNTRY:
3200 return m_currentFile->GetVideoInfoTag()->m_strCountry;
3201 case VIDEOPLAYER_MPAA:
3202 return m_currentFile->GetVideoInfoTag()->m_strMPAARating;
3203 case VIDEOPLAYER_TOP250:
3205 CStdString strTop250;
3206 if (m_currentFile->GetVideoInfoTag()->m_iTop250 > 0)
3207 strTop250.Format("%i", m_currentFile->GetVideoInfoTag()->m_iTop250);
3211 case VIDEOPLAYER_CAST:
3212 return m_currentFile->GetVideoInfoTag()->GetCast();
3213 case VIDEOPLAYER_CAST_AND_ROLE:
3214 return m_currentFile->GetVideoInfoTag()->GetCast(true);
3215 case VIDEOPLAYER_ARTIST:
3216 return m_currentFile->GetVideoInfoTag()->m_strArtist;
3217 case VIDEOPLAYER_ALBUM:
3218 return m_currentFile->GetVideoInfoTag()->m_strAlbum;
3219 case VIDEOPLAYER_WRITER:
3220 return m_currentFile->GetVideoInfoTag()->m_strWritingCredits;
3221 case VIDEOPLAYER_TAGLINE:
3222 return m_currentFile->GetVideoInfoTag()->m_strTagLine;
3223 case VIDEOPLAYER_LASTPLAYED:
3224 return m_currentFile->GetVideoInfoTag()->m_lastPlayed;
3225 case VIDEOPLAYER_PLAYCOUNT:
3227 CStdString strPlayCount;
3228 if (m_currentFile->GetVideoInfoTag()->m_playCount > 0)
3229 strPlayCount.Format("%i", m_currentFile->GetVideoInfoTag()->m_playCount);
3230 return strPlayCount;
3237 __int64 CGUIInfoManager::GetPlayTime() const
3239 if (g_application.IsPlaying())
3241 __int64 lPTS = (__int64)(g_application.GetTime() * 1000);
3242 if (lPTS < 0) lPTS = 0;
3248 CStdString CGUIInfoManager::GetCurrentPlayTime(TIME_FORMAT format) const
3250 if (format == TIME_FORMAT_GUESS && GetTotalPlayTime() >= 3600)
3251 format = TIME_FORMAT_HH_MM_SS;
3252 if (g_application.IsPlayingAudio() || g_application.IsPlayingVideo())
3253 return StringUtils::SecondsToTimeString((int)(GetPlayTime()/1000), format);
3257 int CGUIInfoManager::GetTotalPlayTime() const
3259 int iTotalTime = (int)g_application.GetTotalTime();
3260 return iTotalTime > 0 ? iTotalTime : 0;
3263 int CGUIInfoManager::GetPlayTimeRemaining() const
3265 int iReverse = GetTotalPlayTime() - (int)g_application.GetTime();
3266 return iReverse > 0 ? iReverse : 0;
3269 CStdString CGUIInfoManager::GetCurrentPlayTimeRemaining(TIME_FORMAT format) const
3271 if (format == TIME_FORMAT_GUESS && GetTotalPlayTime() >= 3600)
3272 format = TIME_FORMAT_HH_MM_SS;
3273 int timeRemaining = GetPlayTimeRemaining();
3274 if (timeRemaining && (g_application.IsPlayingAudio() || g_application.IsPlayingVideo()))
3275 return StringUtils::SecondsToTimeString(timeRemaining, format);
3279 void CGUIInfoManager::ResetCurrentItem()
3281 m_currentFile->Reset();
3282 m_currentMovieThumb = "";
3283 m_currentMovieDuration = "";
3286 void CGUIInfoManager::SetCurrentItem(CFileItem &item)
3291 SetCurrentSong(item);
3293 SetCurrentMovie(item);
3296 void CGUIInfoManager::SetCurrentAlbumThumb(const CStdString thumbFileName)
3298 if (CFile::Exists(thumbFileName))
3299 m_currentFile->SetThumbnailImage(thumbFileName);
3302 m_currentFile->SetThumbnailImage("");
3303 m_currentFile->FillInDefaultIcon();
3307 void CGUIInfoManager::SetCurrentSong(CFileItem &item)
3309 CLog::Log(LOGDEBUG,"CGUIInfoManager::SetCurrentSong(%s)",item.m_strPath.c_str());
3310 *m_currentFile = item;
3312 m_currentFile->LoadMusicTag();
3313 if (m_currentFile->GetMusicInfoTag()->GetTitle().IsEmpty())
3315 // No title in tag, show filename only
3316 m_currentFile->GetMusicInfoTag()->SetTitle(CUtil::GetTitleFromPath(m_currentFile->m_strPath));
3318 m_currentFile->GetMusicInfoTag()->SetLoaded(true);
3320 // find a thumb for this file.
3321 if (m_currentFile->IsInternetStream())
3323 if (!g_application.m_strPlayListFile.IsEmpty())
3325 CLog::Log(LOGDEBUG,"Streaming media detected... using %s to find a thumb", g_application.m_strPlayListFile.c_str());
3326 CFileItem streamingItem(g_application.m_strPlayListFile,false);
3327 streamingItem.SetMusicThumb();
3328 CStdString strThumb = streamingItem.GetThumbnailImage();
3329 if (CFile::Exists(strThumb))
3330 m_currentFile->SetThumbnailImage(strThumb);
3334 m_currentFile->SetMusicThumb();
3335 m_currentFile->FillInDefaultIcon();
3337 CMusicInfoLoader::LoadAdditionalTagInfo(m_currentFile);
3340 void CGUIInfoManager::SetCurrentMovie(CFileItem &item)
3342 CLog::Log(LOGDEBUG,"CGUIInfoManager::SetCurrentMovie(%s)",item.m_strPath.c_str());
3343 *m_currentFile = item;
3347 if (dbs.HasMovieInfo(item.m_strPath))
3349 dbs.GetMovieInfo(item.m_strPath, *m_currentFile->GetVideoInfoTag());
3350 CLog::Log(LOGDEBUG,"%s, got movie info!", __FUNCTION__);
3351 CLog::Log(LOGDEBUG," Title = %s", m_currentFile->GetVideoInfoTag()->m_strTitle.c_str());
3353 else if (dbs.HasEpisodeInfo(item.m_strPath))
3355 dbs.GetEpisodeInfo(item.m_strPath, *m_currentFile->GetVideoInfoTag());
3356 CLog::Log(LOGDEBUG,"%s, got episode info!", __FUNCTION__);
3357 CLog::Log(LOGDEBUG," Title = %s", m_currentFile->GetVideoInfoTag()->m_strTitle.c_str());
3359 else if (dbs.HasMusicVideoInfo(item.m_strPath))
3361 dbs.GetMusicVideoInfo(item.m_strPath, *m_currentFile->GetVideoInfoTag());
3362 CLog::Log(LOGDEBUG,"%s, got music video info!", __FUNCTION__);
3363 CLog::Log(LOGDEBUG," Title = %s", m_currentFile->GetVideoInfoTag()->m_strTitle.c_str());
3367 // Find a thumb for this file.
3368 item.SetVideoThumb();
3369 if (!item.HasThumbnail())
3371 CStdString strPath, strFileName;
3372 URIUtils::Split(item.GetCachedVideoThumb(), strPath, strFileName);
3374 // create unique thumb for auto generated thumbs
3375 CStdString cachedThumb = strPath + "auto-" + strFileName;
3376 if (CFile::Exists(cachedThumb))
3377 item.SetThumbnailImage(cachedThumb);
3380 // find a thumb for this stream
3381 if (item.IsInternetStream())
3383 // case where .strm is used to start an audio stream
3384 if (g_application.IsPlayingAudio())
3386 SetCurrentSong(item);
3391 if (!g_application.m_strPlayListFile.IsEmpty())
3393 CLog::Log(LOGDEBUG,"Streaming media detected... using %s to find a thumb", g_application.m_strPlayListFile.c_str());
3394 CFileItem thumbItem(g_application.m_strPlayListFile,false);
3395 thumbItem.SetVideoThumb();
3396 if (thumbItem.HasThumbnail())
3397 item.SetThumbnailImage(thumbItem.GetThumbnailImage());
3401 item.FillInDefaultIcon();
3402 m_currentMovieThumb = item.GetThumbnailImage();
3405 string CGUIInfoManager::GetSystemHeatInfo(int info)
3407 if (CTimeUtils::GetFrameTime() - m_lastSysHeatInfoTime >= SYSHEATUPDATEINTERVAL)
3408 { // update our variables
3409 m_lastSysHeatInfoTime = CTimeUtils::GetFrameTime();
3411 m_cpuTemp = g_cpuInfo.getTemperature();
3412 m_gpuTemp = GetGPUTemperature();
3419 case LCD_CPU_TEMPERATURE:
3420 case SYSTEM_CPU_TEMPERATURE:
3421 return m_cpuTemp.IsValid() ? m_cpuTemp.ToString() : "?";
3423 case LCD_GPU_TEMPERATURE:
3424 case SYSTEM_GPU_TEMPERATURE:
3425 return m_gpuTemp.IsValid() ? m_gpuTemp.ToString() : "?";
3428 case SYSTEM_FAN_SPEED:
3429 text.Format("%i%%", m_fanSpeed * 2);
3431 case SYSTEM_CPU_USAGE:
3432 #if defined(__APPLE__) || defined(_WIN32)
3433 text.Format("%d%%", g_cpuInfo.getUsedPercentage());
3435 text.Format("%s", g_cpuInfo.GetCoresUsageString());
3442 CTemperature CGUIInfoManager::GetGPUTemperature()
3444 CStdString cmd = g_advancedSettings.m_gpuTempCmd;
3450 if (cmd.IsEmpty() || !(p = popen(cmd.c_str(), "r")))
3451 return CTemperature();
3453 ret = fscanf(p, "%d %c", &value, &scale);
3457 return CTemperature();
3459 if (scale == 'C' || scale == 'c')
3460 return CTemperature::CreateFromCelsius(value);
3461 if (scale == 'F' || scale == 'f')
3462 return CTemperature::CreateFromFahrenheit(value);
3463 return CTemperature();
3466 CStdString CGUIInfoManager::GetVersion()
3470 tmp.Format("%s Git:%s", VERSION_STRING, GIT_REV);
3472 tmp.Format("%s", VERSION_STRING);
3477 CStdString CGUIInfoManager::GetBuild()
3480 tmp.Format("%s", __DATE__);
3484 void CGUIInfoManager::SetDisplayAfterSeek(unsigned int timeOut, int seekOffset)
3488 m_AfterSeekTimeout = CTimeUtils::GetFrameTime() + timeOut;
3490 m_seekOffset = seekOffset;
3493 m_AfterSeekTimeout = 0;
3496 bool CGUIInfoManager::GetDisplayAfterSeek()
3498 if (CTimeUtils::GetFrameTime() < m_AfterSeekTimeout)
3504 CStdString CGUIInfoManager::GetAudioScrobblerLabel(int item)
3508 case AUDIOSCROBBLER_CONN_STATE:
3509 return CLastfmScrobbler::GetInstance()->GetConnectionState();
3511 case AUDIOSCROBBLER_SUBMIT_INT:
3512 return CLastfmScrobbler::GetInstance()->GetSubmitInterval();
3514 case AUDIOSCROBBLER_FILES_CACHED:
3515 return CLastfmScrobbler::GetInstance()->GetFilesCached();
3517 case AUDIOSCROBBLER_SUBMIT_STATE:
3518 return CLastfmScrobbler::GetInstance()->GetSubmitState();
3525 int CGUIInfoManager::GetOperator(const char ch)
3532 return OPERATOR_NOT;
3534 return OPERATOR_AND;
3541 bool CGUIInfoManager::EvaluateBooleanExpression(const CCombinedValue &expression, bool &result, int contextWindow, const CGUIListItem *item)
3543 // stack to save our bool state as we go
3546 for (list<int>::const_iterator it = expression.m_postfix.begin(); it != expression.m_postfix.end(); ++it)
3549 if (expr == -OPERATOR_NOT)
3550 { // NOT the top item on the stack
3551 if (save.size() < 1) return false;
3552 bool expr = save.top();
3556 else if (expr == -OPERATOR_AND)
3557 { // AND the top two items on the stack
3558 if (save.size() < 2) return false;
3559 bool right = save.top(); save.pop();
3560 bool left = save.top(); save.pop();
3561 save.push(left && right);
3563 else if (expr == -OPERATOR_OR)
3564 { // OR the top two items on the stack
3565 if (save.size() < 2) return false;
3566 bool right = save.top(); save.pop();
3567 bool left = save.top(); save.pop();
3568 save.push(left || right);
3571 save.push(GetBool(expr, contextWindow, item));
3573 if (save.size() != 1) return false;
3574 result = save.top();
3578 int CGUIInfoManager::TranslateBooleanExpression(const CStdString &expression)
3580 CCombinedValue comb;
3581 comb.m_info = expression;
3582 comb.m_id = COMBINED_VALUES_START + m_CombinedValues.size();
3589 for (unsigned int i = 0; i < expression.size(); i++)
3591 if (GetOperator(expression[i]))
3593 // cleanup any operand, translate and put into our expression list
3594 if (!operand.IsEmpty())
3596 int iOp = TranslateSingleString(operand);
3598 comb.m_postfix.push_back(iOp);
3601 // handle closing parenthesis
3602 if (expression[i] == ']')
3606 char oper = save.top();
3612 comb.m_postfix.push_back(-GetOperator(oper));
3617 // all other operators we pop off the stack any operator
3618 // that has a higher priority than the one we have.
3619 while (!save.empty() && GetOperator(save.top()) > GetOperator(expression[i]))
3621 // only handle parenthesis once they're closed.
3622 if (save.top() == '[' && expression[i] != ']')
3625 comb.m_postfix.push_back(-GetOperator(save.top())); // negative denotes operator
3628 save.push(expression[i]);
3633 operand += expression[i];
3637 if (!operand.empty())
3639 int op = TranslateSingleString(operand);
3641 comb.m_postfix.push_back(op);
3644 // finish up by adding any operators
3645 while (!save.empty())
3647 comb.m_postfix.push_back(-GetOperator(save.top()));
3653 if (!EvaluateBooleanExpression(comb, test, WINDOW_INVALID))
3654 CLog::Log(LOGERROR, "Error evaluating boolean expression %s", expression.c_str());
3655 // success - add to our combined values
3656 m_CombinedValues.push_back(comb);
3660 void CGUIInfoManager::Clear()
3662 m_CombinedValues.clear();
3665 void CGUIInfoManager::UpdateFPS()
3668 unsigned int curTime = CTimeUtils::GetFrameTime();
3670 float fTimeSpan = (float)(curTime - m_lastFPSTime);
3671 if (fTimeSpan >= 1000.0f)
3673 fTimeSpan /= 1000.0f;
3674 m_fps = m_frameCounter / fTimeSpan;
3675 m_lastFPSTime = curTime;
3680 int CGUIInfoManager::AddListItemProp(const CStdString &str, int offset)
3682 for (int i=0; i < (int)m_listitemProperties.size(); i++)
3683 if (m_listitemProperties[i] == str)
3684 return (LISTITEM_PROPERTY_START+offset + i);
3686 if (m_listitemProperties.size() < LISTITEM_PROPERTY_END - LISTITEM_PROPERTY_START)
3688 m_listitemProperties.push_back(str);
3689 return LISTITEM_PROPERTY_START + offset + m_listitemProperties.size() - 1;
3692 CLog::Log(LOGERROR,"%s - not enough listitem property space!", __FUNCTION__);
3696 int CGUIInfoManager::AddMultiInfo(const GUIInfo &info)
3698 // check to see if we have this info already
3699 for (unsigned int i = 0; i < m_multiInfo.size(); i++)
3700 if (m_multiInfo[i] == info)
3701 return (int)i + MULTI_INFO_START;
3702 // return the new offset
3703 m_multiInfo.push_back(info);
3704 int id = (int)m_multiInfo.size() + MULTI_INFO_START - 1;
3705 if (id > MULTI_INFO_END)
3706 CLog::Log(LOGERROR, "%s - too many multiinfo bool/labels in this skin", __FUNCTION__);
3710 int CGUIInfoManager::ConditionalStringParameter(const CStdString ¶meter)
3712 // check to see if we have this parameter already
3713 for (unsigned int i = 0; i < m_stringParameters.size(); i++)
3714 if (parameter.Equals(m_stringParameters[i]))
3716 // return the new offset
3717 m_stringParameters.push_back(parameter);
3718 return (int)m_stringParameters.size() - 1;
3721 CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info) const
3723 if (!item) return "";
3725 if (info >= LISTITEM_PROPERTY_START && info - LISTITEM_PROPERTY_START < (int)m_listitemProperties.size())
3726 { // grab the property
3727 CStdString property = m_listitemProperties[info - LISTITEM_PROPERTY_START];
3728 return item->GetProperty(property);
3733 case LISTITEM_LABEL:
3734 return item->GetLabel();
3735 case LISTITEM_LABEL2:
3736 return item->GetLabel2();
3737 case LISTITEM_TITLE:
3738 if (item->HasVideoInfoTag())
3739 return item->GetVideoInfoTag()->m_strTitle;
3740 if (item->HasMusicInfoTag())
3741 return item->GetMusicInfoTag()->GetTitle();
3743 case LISTITEM_ORIGINALTITLE:
3744 if (item->HasVideoInfoTag())
3745 return item->GetVideoInfoTag()->m_strOriginalTitle;
3747 case LISTITEM_PLAYCOUNT:
3749 CStdString strPlayCount;
3750 if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_playCount > 0)
3751 strPlayCount.Format("%i", item->GetVideoInfoTag()->m_playCount);
3752 if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetPlayCount() > 0)
3753 strPlayCount.Format("%i", item->GetMusicInfoTag()->GetPlayCount());
3754 return strPlayCount;
3756 case LISTITEM_LASTPLAYED:
3758 CStdString strLastPlayed;
3759 if (item->HasVideoInfoTag())
3760 return item->GetVideoInfoTag()->m_lastPlayed;
3761 if (item->HasMusicInfoTag())
3762 return item->GetMusicInfoTag()->GetLastPlayed();
3765 case LISTITEM_TRACKNUMBER:
3768 if (item->HasMusicInfoTag())
3769 track.Format("%i", item->GetMusicInfoTag()->GetTrackNumber());
3773 case LISTITEM_ARTIST:
3774 if (item->HasVideoInfoTag())
3775 return item->GetVideoInfoTag()->m_strArtist;
3776 if (item->HasMusicInfoTag())
3777 return item->GetMusicInfoTag()->GetArtist();
3779 case LISTITEM_ALBUM_ARTIST:
3780 if (item->HasMusicInfoTag())
3781 return item->GetMusicInfoTag()->GetAlbumArtist();
3783 case LISTITEM_DIRECTOR:
3784 if (item->HasVideoInfoTag())
3785 return item->GetVideoInfoTag()->m_strDirector;
3786 case LISTITEM_ALBUM:
3787 if (item->HasVideoInfoTag())
3788 return item->GetVideoInfoTag()->m_strAlbum;
3789 if (item->HasMusicInfoTag())
3790 return item->GetMusicInfoTag()->GetAlbum();
3793 if (item->HasVideoInfoTag())
3795 CStdString strResult;
3796 if (item->GetVideoInfoTag()->m_iYear > 0)
3797 strResult.Format("%i",item->GetVideoInfoTag()->m_iYear);
3800 if (item->HasMusicInfoTag())
3801 return item->GetMusicInfoTag()->GetYearString();
3803 case LISTITEM_PREMIERED:
3804 if (item->HasVideoInfoTag())
3806 if (!item->GetVideoInfoTag()->m_strFirstAired.IsEmpty())
3807 return item->GetVideoInfoTag()->m_strFirstAired;
3808 if (!item->GetVideoInfoTag()->m_strPremiered.IsEmpty())
3809 return item->GetVideoInfoTag()->m_strPremiered;
3812 case LISTITEM_GENRE:
3813 if (item->HasVideoInfoTag())
3814 return item->GetVideoInfoTag()->m_strGenre;
3815 if (item->HasMusicInfoTag())
3816 return item->GetMusicInfoTag()->GetGenre();
3818 case LISTITEM_FILENAME:
3819 if (item->IsMusicDb() && item->HasMusicInfoTag())
3820 return URIUtils::GetFileName(item->GetMusicInfoTag()->GetURL());
3821 if (item->IsVideoDb() && item->HasVideoInfoTag())
3822 return URIUtils::GetFileName(item->GetVideoInfoTag()->m_strFileNameAndPath);
3823 return URIUtils::GetFileName(item->m_strPath);
3825 if (item->m_dateTime.IsValid())
3826 return item->m_dateTime.GetAsLocalizedDate();
3829 if (!item->m_bIsFolder || item->m_dwSize)
3830 return StringUtils::SizeToString(item->m_dwSize);
3832 case LISTITEM_RATING:
3835 if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_fRating > 0.f) // movie rating
3836 rating.Format("%.1f", item->GetVideoInfoTag()->m_fRating);
3837 else if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetRating() > '0')
3838 { // song rating. Images will probably be better than numbers for this in the long run
3839 rating = item->GetMusicInfoTag()->GetRating();
3843 case LISTITEM_RATING_AND_VOTES:
3845 if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_fRating > 0.f) // movie rating
3847 CStdString strRatingAndVotes;
3848 if (item->GetVideoInfoTag()->m_strVotes.IsEmpty())
3849 strRatingAndVotes.Format("%.1f", item->GetVideoInfoTag()->m_fRating);
3851 strRatingAndVotes.Format("%.1f (%s %s)", item->GetVideoInfoTag()->m_fRating, item->GetVideoInfoTag()->m_strVotes, g_localizeStrings.Get(20350));
3852 return strRatingAndVotes;
3856 case LISTITEM_PROGRAM_COUNT:
3859 count.Format("%i", item->m_iprogramCount);
3862 case LISTITEM_DURATION:
3864 CStdString duration;
3865 if (item->HasVideoInfoTag())
3867 if (item->GetVideoInfoTag()->m_streamDetails.GetVideoDuration() > 0)
3868 duration.Format("%i", item->GetVideoInfoTag()->m_streamDetails.GetVideoDuration() / 60);
3869 else if (!item->GetVideoInfoTag()->m_strRuntime.IsEmpty())
3870 duration = item->GetVideoInfoTag()->m_strRuntime;
3872 if (item->HasMusicInfoTag())
3874 if (item->GetMusicInfoTag()->GetDuration() > 0)
3875 duration = StringUtils::SecondsToTimeString(item->GetMusicInfoTag()->GetDuration());
3880 if (item->HasVideoInfoTag())
3882 if (!(!item->GetVideoInfoTag()->m_strShowTitle.IsEmpty() && item->GetVideoInfoTag()->m_iSeason == -1)) // dont apply to tvshows
3883 if (item->GetVideoInfoTag()->m_playCount == 0 && !g_guiSettings.GetBool("videolibrary.showunwatchedplots"))
3884 return g_localizeStrings.Get(20370);
3886 return item->GetVideoInfoTag()->m_strPlot;
3889 case LISTITEM_PLOT_OUTLINE:
3890 if (item->HasVideoInfoTag())
3891 return item->GetVideoInfoTag()->m_strPlotOutline;
3893 case LISTITEM_EPISODE:
3894 if (item->HasVideoInfoTag())
3896 CStdString strResult;
3897 if (item->GetVideoInfoTag()->m_iSpecialSortEpisode > 0)
3898 strResult.Format("S%d",item->GetVideoInfoTag()->m_iEpisode);
3899 else if (item->GetVideoInfoTag()->m_iEpisode > 0) // if m_iEpisode = -1 there's no episode detail
3900 strResult.Format("%d",item->GetVideoInfoTag()->m_iEpisode);
3904 case LISTITEM_SEASON:
3905 if (item->HasVideoInfoTag())
3907 CStdString strResult;
3908 if (item->GetVideoInfoTag()->m_iSpecialSortSeason > 0)
3909 strResult.Format("%d",item->GetVideoInfoTag()->m_iSpecialSortSeason);
3910 else if (item->GetVideoInfoTag()->m_iSeason > 0) // if m_iSeason = -1 there's no season detail
3911 strResult.Format("%d",item->GetVideoInfoTag()->m_iSeason);
3915 case LISTITEM_TVSHOW:
3916 if (item->HasVideoInfoTag())
3917 return item->GetVideoInfoTag()->m_strShowTitle;
3919 case LISTITEM_COMMENT:
3920 if (item->HasMusicInfoTag())
3921 return item->GetMusicInfoTag()->GetComment();
3923 case LISTITEM_ACTUAL_ICON:
3924 return item->GetIconImage();
3927 CStdString strThumb = item->GetThumbnailImage();
3928 if(!strThumb.IsEmpty() && !g_TextureManager.CanLoad(strThumb))
3931 if(strThumb.IsEmpty() && !item->GetIconImage().IsEmpty())
3932 strThumb = item->GetIconImage();
3935 case LISTITEM_OVERLAY:
3936 return item->GetOverlayImage();
3937 case LISTITEM_THUMB:
3938 return item->GetThumbnailImage();
3939 case LISTITEM_FOLDERPATH:
3940 return CURL(item->m_strPath).GetWithoutUserDetails();
3941 case LISTITEM_FOLDERNAME:
3945 if (item->IsMusicDb() && item->HasMusicInfoTag())
3946 URIUtils::GetDirectory(item->GetMusicInfoTag()->GetURL(), path);
3947 else if (item->IsVideoDb() && item->HasVideoInfoTag())
3949 if( item->m_bIsFolder )
3950 path = item->GetVideoInfoTag()->m_strPath;
3952 URIUtils::GetParentPath(item->GetVideoInfoTag()->m_strFileNameAndPath, path);
3955 URIUtils::GetParentPath(item->m_strPath, path);
3956 path = CURL(path).GetWithoutUserDetails();
3957 if (info==CONTAINER_FOLDERNAME)
3959 URIUtils::RemoveSlashAtEnd(path);
3960 path=URIUtils::GetFileName(path);
3965 case LISTITEM_FILENAME_AND_PATH:
3968 if (item->IsMusicDb() && item->HasMusicInfoTag())
3969 path = item->GetMusicInfoTag()->GetURL();
3970 else if (item->IsVideoDb() && item->HasVideoInfoTag())
3971 path = item->GetVideoInfoTag()->m_strFileNameAndPath;
3973 path = item->m_strPath;
3974 path = CURL(path).GetWithoutUserDetails();
3978 case LISTITEM_PICTURE_PATH:
3979 if (item->IsPicture() && (!item->IsZIP() || item->IsRAR() || item->IsCBZ() || item->IsCBR()))
3980 return item->m_strPath;
3982 case LISTITEM_PICTURE_DATETIME:
3983 if (item->HasPictureInfoTag())
3984 return item->GetPictureInfoTag()->GetInfo(SLIDE_EXIF_DATE_TIME);
3986 case LISTITEM_PICTURE_RESOLUTION:
3987 if (item->HasPictureInfoTag())
3988 return item->GetPictureInfoTag()->GetInfo(SLIDE_RESOLUTION);
3990 case LISTITEM_STUDIO:
3991 if (item->HasVideoInfoTag())
3992 return item->GetVideoInfoTag()->m_strStudio;
3994 case LISTITEM_COUNTRY:
3995 if (item->HasVideoInfoTag())
3996 return item->GetVideoInfoTag()->m_strCountry;
3999 if (item->HasVideoInfoTag())
4000 return item->GetVideoInfoTag()->m_strMPAARating;
4003 if (item->HasVideoInfoTag())
4004 return item->GetVideoInfoTag()->GetCast();
4006 case LISTITEM_CAST_AND_ROLE:
4007 if (item->HasVideoInfoTag())
4008 return item->GetVideoInfoTag()->GetCast(true);
4010 case LISTITEM_WRITER:
4011 if (item->HasVideoInfoTag())
4012 return item->GetVideoInfoTag()->m_strWritingCredits;;
4014 case LISTITEM_TAGLINE:
4015 if (item->HasVideoInfoTag())
4016 return item->GetVideoInfoTag()->m_strTagLine;
4018 case LISTITEM_TRAILER:
4019 if (item->HasVideoInfoTag())
4020 return item->GetVideoInfoTag()->m_strTrailer;
4022 case LISTITEM_TOP250:
4023 if (item->HasVideoInfoTag())
4025 CStdString strResult;
4026 if (item->GetVideoInfoTag()->m_iTop250 > 0)
4027 strResult.Format("%i",item->GetVideoInfoTag()->m_iTop250);
4031 case LISTITEM_SORT_LETTER:
4034 g_charsetConverter.wToUTF8(item->GetSortLabel().Left(1).ToUpper(), letter);
4038 case LISTITEM_VIDEO_CODEC:
4039 if (item->HasVideoInfoTag())
4040 return item->GetVideoInfoTag()->m_streamDetails.GetVideoCodec();
4042 case LISTITEM_VIDEO_RESOLUTION:
4043 if (item->HasVideoInfoTag())
4044 return CStreamDetails::VideoDimsToResolutionDescription(item->GetVideoInfoTag()->m_streamDetails.GetVideoWidth(), item->GetVideoInfoTag()->m_streamDetails.GetVideoHeight());
4046 case LISTITEM_VIDEO_ASPECT:
4047 if (item->HasVideoInfoTag())
4048 return CStreamDetails::VideoAspectToAspectDescription(item->GetVideoInfoTag()->m_streamDetails.GetVideoAspect());
4050 case LISTITEM_AUDIO_CODEC:
4051 if (item->HasVideoInfoTag())
4053 return item->GetVideoInfoTag()->m_streamDetails.GetAudioCodec();
4056 case LISTITEM_AUDIO_CHANNELS:
4057 if (item->HasVideoInfoTag())
4059 CStdString strResult;
4060 int iChannels = item->GetVideoInfoTag()->m_streamDetails.GetAudioChannels();
4062 strResult.Format("%i", iChannels);
4066 case LISTITEM_AUDIO_LANGUAGE:
4067 if (item->HasVideoInfoTag())
4068 return item->GetVideoInfoTag()->m_streamDetails.GetAudioLanguage();
4070 case LISTITEM_SUBTITLE_LANGUAGE:
4071 if (item->HasVideoInfoTag())
4072 return item->GetVideoInfoTag()->m_streamDetails.GetSubtitleLanguage();
4078 CStdString CGUIInfoManager::GetItemImage(const CFileItem *item, int info) const
4082 case LISTITEM_RATING: // old song rating format
4085 if (item->HasMusicInfoTag())
4087 rating.Format("songrating%c.png", item->GetMusicInfoTag()->GetRating());
4092 case LISTITEM_STAR_RATING:
4095 if (item->HasVideoInfoTag())
4096 { // rating for videos is assumed 0..10, so convert to 0..5
4097 rating.Format("rating%d.png", (long)((item->GetVideoInfoTag()->m_fRating * 0.5f) + 0.5f));
4099 else if (item->HasMusicInfoTag())
4101 rating.Format("rating%c.png", item->GetMusicInfoTag()->GetRating());
4106 } /* switch (info) */
4108 return GetItemLabel(item, info);
4111 bool CGUIInfoManager::GetItemBool(const CGUIListItem *item, int condition) const
4113 if (!item) return false;
4114 if (condition >= LISTITEM_PROPERTY_START && condition - LISTITEM_PROPERTY_START < (int)m_listitemProperties.size())
4115 { // grab the property
4116 CStdString property = m_listitemProperties[condition - LISTITEM_PROPERTY_START];
4117 CStdString val = item->GetProperty(property);
4118 return (val == "1" || val.CompareNoCase("true") == 0);
4120 else if (condition == LISTITEM_ISPLAYING)
4122 if (item->IsFileItem() && !m_currentFile->m_strPath.IsEmpty())
4124 if (!g_application.m_strPlayListFile.IsEmpty())
4126 //playlist file that is currently playing or the playlistitem that is currently playing.
4127 return g_application.m_strPlayListFile.Equals(((const CFileItem *)item)->m_strPath) || m_currentFile->IsSamePath((const CFileItem *)item);
4129 return m_currentFile->IsSamePath((const CFileItem *)item);
4132 else if (condition == LISTITEM_ISSELECTED)
4133 return item->IsSelected();
4134 else if (condition == LISTITEM_IS_FOLDER)
4135 return item->m_bIsFolder;
4139 void CGUIInfoManager::ResetCache()
4141 CSingleLock lock(m_critInfo);
4142 m_boolCache.clear();
4143 // reset any animation triggers as well
4144 m_containerMoves.clear();
4147 void CGUIInfoManager::ResetPersistentCache()
4149 CSingleLock lock(m_critInfo);
4150 m_persistentBoolCache.clear();
4153 inline void CGUIInfoManager::CacheBool(int condition, int contextWindow, bool result, bool persistent)
4155 // windows have id's up to 13100 or thereabouts (ie 2^14 needed)
4156 // conditionals have id's up to 100000 or thereabouts (ie 2^18 needed)
4157 CSingleLock lock(m_critInfo);
4158 int hash = ((contextWindow & 0x3fff) << 18) | (condition & 0x3ffff);
4160 m_persistentBoolCache.insert(pair<int, bool>(hash, result));
4162 m_boolCache.insert(pair<int, bool>(hash, result));
4165 bool CGUIInfoManager::IsCached(int condition, int contextWindow, bool &result) const
4167 // windows have id's up to 13100 or thereabouts (ie 2^14 needed)
4168 // conditionals have id's up to 100000 or thereabouts (ie 2^18 needed)
4170 CSingleLock lock(m_critInfo);
4171 int hash = ((contextWindow & 0x3fff) << 18) | (condition & 0x3ffff);
4172 map<int, bool>::const_iterator it = m_boolCache.find(hash);
4173 if (it != m_boolCache.end())
4175 result = (*it).second;
4178 it = m_persistentBoolCache.find(hash);
4179 if (it != m_persistentBoolCache.end())
4181 result = (*it).second;
4188 // Called from tuxbox service thread to update current status
4189 void CGUIInfoManager::UpdateFromTuxBox()
4191 if(g_tuxbox.vVideoSubChannel.mode)
4192 m_currentFile->GetVideoInfoTag()->m_strTitle = g_tuxbox.vVideoSubChannel.current_name;
4194 // Set m_currentMovieDuration
4195 if(!g_tuxbox.sCurSrvData.current_event_duration.IsEmpty() &&
4196 !g_tuxbox.sCurSrvData.next_event_description.IsEmpty() &&
4197 !g_tuxbox.sCurSrvData.current_event_duration.Equals("-") &&
4198 !g_tuxbox.sCurSrvData.next_event_description.Equals("-"))
4200 g_tuxbox.sCurSrvData.current_event_duration.Replace("(","");
4201 g_tuxbox.sCurSrvData.current_event_duration.Replace(")","");
4203 m_currentMovieDuration.Format("%s: %s %s (%s - %s)",
4204 g_localizeStrings.Get(180),
4205 g_tuxbox.sCurSrvData.current_event_duration,
4206 g_localizeStrings.Get(12391),
4207 g_tuxbox.sCurSrvData.current_event_time,
4208 g_tuxbox.sCurSrvData.next_event_time);
4212 if (!g_tuxbox.sCurSrvData.current_event_description.IsEmpty() &&
4213 !g_tuxbox.sCurSrvData.next_event_description.IsEmpty() &&
4214 !g_tuxbox.sCurSrvData.current_event_description.Equals("-") &&
4215 !g_tuxbox.sCurSrvData.next_event_description.Equals("-"))
4217 m_currentFile->GetVideoInfoTag()->m_strGenre.Format("%s %s - (%s: %s)",
4218 g_localizeStrings.Get(143),
4219 g_tuxbox.sCurSrvData.current_event_description,
4220 g_localizeStrings.Get(209),
4221 g_tuxbox.sCurSrvData.next_event_description);
4224 //Set m_currentMovie.m_strDirector
4225 if (!g_tuxbox.sCurSrvData.current_event_details.Equals("-") &&
4226 !g_tuxbox.sCurSrvData.current_event_details.IsEmpty())
4228 m_currentFile->GetVideoInfoTag()->m_strDirector = g_tuxbox.sCurSrvData.current_event_details;
4232 CStdString CGUIInfoManager::GetPictureLabel(int info) const
4234 if (info == SLIDE_FILE_NAME)
4235 return GetItemLabel(m_currentSlide, LISTITEM_FILENAME);
4236 else if (info == SLIDE_FILE_PATH)
4239 URIUtils::GetDirectory(m_currentSlide->m_strPath, path);
4240 return CURL(path).GetWithoutUserDetails();
4242 else if (info == SLIDE_FILE_SIZE)
4243 return GetItemLabel(m_currentSlide, LISTITEM_SIZE);
4244 else if (info == SLIDE_FILE_DATE)
4245 return GetItemLabel(m_currentSlide, LISTITEM_DATE);
4246 else if (info == SLIDE_INDEX)
4248 CGUIWindowSlideShow *slideshow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
4249 if (slideshow && slideshow->NumSlides())
4252 index.Format("%d/%d", slideshow->CurrentSlide(), slideshow->NumSlides());
4256 if (m_currentSlide->HasPictureInfoTag())
4257 return m_currentSlide->GetPictureInfoTag()->GetInfo(info);
4261 void CGUIInfoManager::SetCurrentSlide(CFileItem &item)
4263 if (m_currentSlide->m_strPath != item.m_strPath)
4265 if (!item.HasPictureInfoTag() && !item.GetPictureInfoTag()->Loaded())
4266 item.GetPictureInfoTag()->Load(item.m_strPath);
4267 *m_currentSlide = item;
4271 void CGUIInfoManager::ResetCurrentSlide()
4273 m_currentSlide->Reset();
4276 bool CGUIInfoManager::CheckWindowCondition(CGUIWindow *window, int condition) const
4278 // check if it satisfies our condition
4279 if (!window) return false;
4280 if ((condition & WINDOW_CONDITION_HAS_LIST_ITEMS) && !window->HasListItems())
4282 if ((condition & WINDOW_CONDITION_IS_MEDIA_WINDOW) && !window->IsMediaWindow())
4287 CGUIWindow *CGUIInfoManager::GetWindowWithCondition(int contextWindow, int condition) const
4289 CGUIWindow *window = g_windowManager.GetWindow(contextWindow);
4290 if (CheckWindowCondition(window, condition))
4293 // try topmost dialog
4294 window = g_windowManager.GetWindow(g_windowManager.GetTopMostModalDialogID());
4295 if (CheckWindowCondition(window, condition))
4298 // try active window
4299 window = g_windowManager.GetWindow(g_windowManager.GetActiveWindow());
4300 if (CheckWindowCondition(window, condition))
4306 void CGUIInfoManager::SetCurrentVideoTag(const CVideoInfoTag &tag)
4308 *m_currentFile->GetVideoInfoTag() = tag;
4309 m_currentFile->m_lStartOffset = 0;
4312 void CGUIInfoManager::SetCurrentSongTag(const MUSIC_INFO::CMusicInfoTag &tag)
4314 //CLog::Log(LOGDEBUG, "Asked to SetCurrentTag");
4315 *m_currentFile->GetMusicInfoTag() = tag;
4316 m_currentFile->m_lStartOffset = 0;
4319 const CFileItem& CGUIInfoManager::GetCurrentSlide() const
4321 return *m_currentSlide;
4324 const MUSIC_INFO::CMusicInfoTag* CGUIInfoManager::GetCurrentSongTag() const
4326 if (m_currentFile->HasMusicInfoTag())
4327 return m_currentFile->GetMusicInfoTag();
4332 const CVideoInfoTag* CGUIInfoManager::GetCurrentMovieTag() const
4334 if (m_currentFile->HasVideoInfoTag())
4335 return m_currentFile->GetVideoInfoTag();
4340 void GUIInfo::SetInfoFlag(uint32_t flag)
4342 assert(flag >= (1 << 24));
4346 uint32_t GUIInfo::GetInfoFlag() const
4348 // we strip out the bottom 24 bits, where we keep data
4349 // and return the flag only
4350 return m_data1 & 0xff000000;
4353 uint32_t GUIInfo::GetData1() const
4355 // we strip out the top 8 bits, where we keep flags
4356 // and return the unflagged data
4357 return m_data1 & ((1 << 24) -1);
4360 int GUIInfo::GetData2() const
4365 void CGUIInfoManager::SetLibraryBool(int condition, bool value)
4369 case LIBRARY_HAS_MUSIC:
4370 m_libraryHasMusic = value ? 1 : 0;
4372 case LIBRARY_HAS_MOVIES:
4373 m_libraryHasMovies = value ? 1 : 0;
4375 case LIBRARY_HAS_TVSHOWS:
4376 m_libraryHasTVShows = value ? 1 : 0;
4378 case LIBRARY_HAS_MUSICVIDEOS:
4379 m_libraryHasMusicVideos = value ? 1 : 0;
4386 void CGUIInfoManager::ResetLibraryBools()
4388 m_libraryHasMusic = -1;
4389 m_libraryHasMovies = -1;
4390 m_libraryHasTVShows = -1;
4391 m_libraryHasMusicVideos = -1;
4394 bool CGUIInfoManager::GetLibraryBool(int condition)
4396 if (condition == LIBRARY_HAS_MUSIC)
4398 if (m_libraryHasMusic < 0)
4403 m_libraryHasMusic = (db.GetSongsCount() > 0) ? 1 : 0;
4407 return m_libraryHasMusic > 0;
4409 else if (condition == LIBRARY_HAS_MOVIES)
4411 if (m_libraryHasMovies < 0)
4416 m_libraryHasMovies = db.HasContent(VIDEODB_CONTENT_MOVIES) ? 1 : 0;
4420 return m_libraryHasMovies > 0;
4422 else if (condition == LIBRARY_HAS_TVSHOWS)
4424 if (m_libraryHasTVShows < 0)
4429 m_libraryHasTVShows = db.HasContent(VIDEODB_CONTENT_TVSHOWS) ? 1 : 0;
4433 return m_libraryHasTVShows > 0;
4435 else if (condition == LIBRARY_HAS_MUSICVIDEOS)
4437 if (m_libraryHasMusicVideos < 0)
4442 m_libraryHasMusicVideos = db.HasContent(VIDEODB_CONTENT_MUSICVIDEOS) ? 1 : 0;
4446 return m_libraryHasMusicVideos > 0;
4448 else if (condition == LIBRARY_HAS_VIDEO)
4450 return (GetLibraryBool(LIBRARY_HAS_MOVIES) ||
4451 GetLibraryBool(LIBRARY_HAS_TVSHOWS) ||
4452 GetLibraryBool(LIBRARY_HAS_MUSICVIDEOS));