forked from xbmc/xbmc
/
GUIInfoManager.cpp
4457 lines (4275 loc) · 166 KB
/
GUIInfoManager.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (C) 2005-2008 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "system.h"
#include "dialogs/GUIDialogSeekBar.h"
#include "windows/GUIMediaWindow.h"
#include "dialogs/GUIDialogFileBrowser.h"
#include "settings/GUIDialogContentSettings.h"
#include "dialogs/GUIDialogProgress.h"
#include "Application.h"
#include "Util.h"
#include "network/libscrobbler/lastfmscrobbler.h"
#include "utils/URIUtils.h"
#include "utils/Weather.h"
#include "PartyModeManager.h"
#include "addons/Visualisation.h"
#include "input/ButtonTranslator.h"
#include "utils/AlarmClock.h"
#ifdef HAS_LCD
#include "utils/LCD.h"
#endif
#include "GUIPassword.h"
#include "LangInfo.h"
#include "utils/SystemInfo.h"
#include "guilib/GUIButtonScroller.h"
#include "guilib/GUITextBox.h"
#include "GUIInfoManager.h"
#include "pictures/GUIWindowSlideShow.h"
#include "music/LastFmManager.h"
#include "pictures/PictureInfoTag.h"
#include "music/tags/MusicInfoTag.h"
#include "music/dialogs/GUIDialogMusicScan.h"
#include "video/dialogs/GUIDialogVideoScan.h"
#include "guilib/GUIWindowManager.h"
#include "filesystem/File.h"
#include "playlists/PlayList.h"
#include "utils/TuxBoxUtil.h"
#include "windowing/WindowingFactory.h"
#include "powermanagement/PowerManager.h"
#include "settings/AdvancedSettings.h"
#include "settings/Settings.h"
#include "guilib/LocalizeStrings.h"
#include "utils/CPUInfo.h"
#include "utils/StringUtils.h"
#include "utils/MathUtils.h"
// stuff for current song
#include "music/tags/MusicInfoTagLoaderFactory.h"
#include "music/MusicInfoLoader.h"
#include "utils/LabelFormatter.h"
#include "GUIUserMessages.h"
#include "video/dialogs/GUIDialogVideoInfo.h"
#include "music/dialogs/GUIDialogMusicInfo.h"
#include "storage/MediaManager.h"
#include "utils/TimeUtils.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
#include "addons/AddonManager.h"
#define SYSHEATUPDATEINTERVAL 60000
using namespace std;
using namespace XFILE;
using namespace MUSIC_INFO;
using namespace ADDON;
CGUIInfoManager::CCombinedValue& CGUIInfoManager::CCombinedValue::operator =(const CGUIInfoManager::CCombinedValue& mSrc)
{
this->m_info = mSrc.m_info;
this->m_id = mSrc.m_id;
this->m_postfix = mSrc.m_postfix;
return *this;
}
CGUIInfoManager::CGUIInfoManager(void)
{
m_lastSysHeatInfoTime = -SYSHEATUPDATEINTERVAL; // make sure we grab CPU temp on the first pass
m_lastMusicBitrateTime = 0;
m_fanSpeed = 0;
m_AfterSeekTimeout = 0;
m_seekOffset = 0;
m_playerSeeking = false;
m_performingSeek = false;
m_nextWindowID = WINDOW_INVALID;
m_prevWindowID = WINDOW_INVALID;
m_stringParameters.push_back("__ZZZZ__"); // to offset the string parameters by 1 to assure that all entries are non-zero
m_currentFile = new CFileItem;
m_currentSlide = new CFileItem;
m_frameCounter = 0;
m_lastFPSTime = 0;
ResetLibraryBools();
}
CGUIInfoManager::~CGUIInfoManager(void)
{
delete m_currentFile;
delete m_currentSlide;
}
bool CGUIInfoManager::OnMessage(CGUIMessage &message)
{
if (message.GetMessage() == GUI_MSG_NOTIFY_ALL)
{
if (message.GetParam1() == GUI_MSG_UPDATE_ITEM && message.GetItem())
{
CFileItemPtr item = boost::static_pointer_cast<CFileItem>(message.GetItem());
if (item && m_currentFile->m_strPath.Equals(item->m_strPath))
*m_currentFile = *item;
return true;
}
}
return false;
}
/// \brief Translates a string as given by the skin into an int that we use for more
/// efficient retrieval of data. Can handle combined strings on the form
/// Player.Caching + VideoPlayer.IsFullscreen (Logical and)
/// Player.HasVideo | Player.HasAudio (Logical or)
int CGUIInfoManager::TranslateString(const CStdString &condition)
{
// translate $LOCALIZE as required
CStdString strCondition(CGUIInfoLabel::ReplaceLocalize(condition));
if (strCondition.find_first_of("|") != strCondition.npos ||
strCondition.find_first_of("+") != strCondition.npos ||
strCondition.find_first_of("[") != strCondition.npos ||
strCondition.find_first_of("]") != strCondition.npos)
{
// Have a boolean expression
// Check if this was added before
vector<CCombinedValue>::iterator it;
for(it = m_CombinedValues.begin(); it != m_CombinedValues.end(); it++)
{
if(strCondition.CompareNoCase(it->m_info) == 0)
return it->m_id;
}
return TranslateBooleanExpression(strCondition);
}
//Just single command.
return TranslateSingleString(strCondition);
}
/// \brief Translates a string as given by the skin into an int that we use for more
/// efficient retrieval of data.
int CGUIInfoManager::TranslateSingleString(const CStdString &strCondition)
{
// trim whitespace, and convert to lowercase
CStdString strTest = strCondition;
strTest.TrimLeft(" \t\r\n");
strTest.TrimRight(" \t\r\n");
if (strTest.IsEmpty()) return 0;
bool bNegate = strTest[0] == '!';
int ret = 0;
if(bNegate)
strTest.Delete(0, 1);
CStdString original(strTest);
strTest.ToLower();
CStdString strCategory = strTest.Left(strTest.Find("."));
// translate conditions...
if (strTest.Equals("false") || strTest.Equals("no") || strTest.Equals("off")) ret = SYSTEM_ALWAYS_FALSE;
else if (strTest.Equals("true") || strTest.Equals("yes") || strTest.Equals("on")) ret = SYSTEM_ALWAYS_TRUE;
if (strCategory.Equals("player"))
{
if (strTest.Equals("player.hasmedia")) ret = PLAYER_HAS_MEDIA;
else if (strTest.Equals("player.hasaudio")) ret = PLAYER_HAS_AUDIO;
else if (strTest.Equals("player.hasvideo")) ret = PLAYER_HAS_VIDEO;
else if (strTest.Equals("player.playing")) ret = PLAYER_PLAYING;
else if (strTest.Equals("player.paused")) ret = PLAYER_PAUSED;
else if (strTest.Equals("player.rewinding")) ret = PLAYER_REWINDING;
else if (strTest.Equals("player.forwarding")) ret = PLAYER_FORWARDING;
else if (strTest.Equals("player.rewinding2x")) ret = PLAYER_REWINDING_2x;
else if (strTest.Equals("player.rewinding4x")) ret = PLAYER_REWINDING_4x;
else if (strTest.Equals("player.rewinding8x")) ret = PLAYER_REWINDING_8x;
else if (strTest.Equals("player.rewinding16x")) ret = PLAYER_REWINDING_16x;
else if (strTest.Equals("player.rewinding32x")) ret = PLAYER_REWINDING_32x;
else if (strTest.Equals("player.forwarding2x")) ret = PLAYER_FORWARDING_2x;
else if (strTest.Equals("player.forwarding4x")) ret = PLAYER_FORWARDING_4x;
else if (strTest.Equals("player.forwarding8x")) ret = PLAYER_FORWARDING_8x;
else if (strTest.Equals("player.forwarding16x")) ret = PLAYER_FORWARDING_16x;
else if (strTest.Equals("player.forwarding32x")) ret = PLAYER_FORWARDING_32x;
else if (strTest.Equals("player.canrecord")) ret = PLAYER_CAN_RECORD;
else if (strTest.Equals("player.recording")) ret = PLAYER_RECORDING;
else if (strTest.Equals("player.displayafterseek")) ret = PLAYER_DISPLAY_AFTER_SEEK;
else if (strTest.Equals("player.caching")) ret = PLAYER_CACHING;
else if (strTest.Equals("player.cachelevel")) ret = PLAYER_CACHELEVEL;
else if (strTest.Equals("player.seekbar")) ret = PLAYER_SEEKBAR;
else if (strTest.Equals("player.progress")) ret = PLAYER_PROGRESS;
else if (strTest.Equals("player.progresscache")) ret = PLAYER_PROGRESS_CACHE;
else if (strTest.Equals("player.seeking")) ret = PLAYER_SEEKING;
else if (strTest.Equals("player.showtime")) ret = PLAYER_SHOWTIME;
else if (strTest.Equals("player.showcodec")) ret = PLAYER_SHOWCODEC;
else if (strTest.Equals("player.showinfo")) ret = PLAYER_SHOWINFO;
else if (strTest.Left(15).Equals("player.seektime")) return AddMultiInfo(GUIInfo(PLAYER_SEEKTIME, TranslateTimeFormat(strTest.Mid(15))));
else if (strTest.Left(17).Equals("player.seekoffset")) return AddMultiInfo(GUIInfo(PLAYER_SEEKOFFSET, TranslateTimeFormat(strTest.Mid(17))));
else if (strTest.Left(20).Equals("player.timeremaining")) return AddMultiInfo(GUIInfo(PLAYER_TIME_REMAINING, TranslateTimeFormat(strTest.Mid(20))));
else if (strTest.Left(16).Equals("player.timespeed")) return AddMultiInfo(GUIInfo(PLAYER_TIME_SPEED, TranslateTimeFormat(strTest.Mid(16))));
else if (strTest.Left(11).Equals("player.time")) return AddMultiInfo(GUIInfo(PLAYER_TIME, TranslateTimeFormat(strTest.Mid(11))));
else if (strTest.Left(15).Equals("player.duration")) return AddMultiInfo(GUIInfo(PLAYER_DURATION, TranslateTimeFormat(strTest.Mid(15))));
else if (strTest.Left(17).Equals("player.finishtime")) return AddMultiInfo(GUIInfo(PLAYER_FINISH_TIME, TranslateTimeFormat(strTest.Mid(17))));
else if (strTest.Equals("player.volume")) ret = PLAYER_VOLUME;
else if (strTest.Equals("player.subtitledelay")) ret = PLAYER_SUBTITLE_DELAY;
else if (strTest.Equals("player.audiodelay")) ret = PLAYER_AUDIO_DELAY;
else if (strTest.Equals("player.muted")) ret = PLAYER_MUTED;
else if (strTest.Equals("player.hasduration")) ret = PLAYER_HASDURATION;
else if (strTest.Equals("player.chapter")) ret = PLAYER_CHAPTER;
else if (strTest.Equals("player.chaptercount")) ret = PLAYER_CHAPTERCOUNT;
else if (strTest.Equals("player.chaptername")) ret = PLAYER_CHAPTERNAME;
else if (strTest.Equals("player.starrating")) ret = PLAYER_STAR_RATING;
else if (strTest.Equals("player.passthrough")) ret = PLAYER_PASSTHROUGH;
else if (strTest.Equals("player.folderpath")) ret = PLAYER_PATH;
else if (strTest.Equals("player.filenameandpath")) ret = PLAYER_FILEPATH;
}
else if (strCategory.Equals("weather"))
{
if (strTest.Equals("weather.conditions")) ret = WEATHER_CONDITIONS;
else if (strTest.Equals("weather.temperature")) ret = WEATHER_TEMPERATURE;
else if (strTest.Equals("weather.location")) ret = WEATHER_LOCATION;
else if (strTest.Equals("weather.isfetched")) ret = WEATHER_IS_FETCHED;
else if (strTest.Equals("weather.fanartcode")) ret = WEATHER_FANART_CODE;
else if (strTest.Equals("weather.plugin")) ret = WEATHER_PLUGIN;
}
else if (strCategory.Equals("bar"))
{
if (strTest.Equals("bar.gputemperature")) ret = SYSTEM_GPU_TEMPERATURE;
else if (strTest.Equals("bar.cputemperature")) ret = SYSTEM_CPU_TEMPERATURE;
else if (strTest.Equals("bar.cpuusage")) ret = SYSTEM_CPU_USAGE;
else if (strTest.Equals("bar.freememory")) ret = SYSTEM_FREE_MEMORY;
else if (strTest.Equals("bar.usedmemory")) ret = SYSTEM_USED_MEMORY;
else if (strTest.Equals("bar.fanspeed")) ret = SYSTEM_FAN_SPEED;
else if (strTest.Equals("bar.usedspace")) ret = SYSTEM_USED_SPACE;
else if (strTest.Equals("bar.freespace")) ret = SYSTEM_FREE_SPACE;
else if (strTest.Equals("bar.usedspace(c)")) ret = SYSTEM_USED_SPACE_C;
else if (strTest.Equals("bar.freespace(c)")) ret = SYSTEM_FREE_SPACE_C;
else if (strTest.Equals("bar.usedspace(e)")) ret = SYSTEM_USED_SPACE_E;
else if (strTest.Equals("bar.freespace(e)")) ret = SYSTEM_FREE_SPACE_E;
else if (strTest.Equals("bar.usedspace(f)")) ret = SYSTEM_USED_SPACE_F;
else if (strTest.Equals("bar.freespace(f)")) ret = SYSTEM_FREE_SPACE_F;
else if (strTest.Equals("bar.usedspace(g)")) ret = SYSTEM_USED_SPACE_G;
else if (strTest.Equals("bar.freespace(g)")) ret = SYSTEM_FREE_SPACE_G;
else if (strTest.Equals("bar.usedspace(x)")) ret = SYSTEM_USED_SPACE_X;
else if (strTest.Equals("bar.freespace(x)")) ret = SYSTEM_FREE_SPACE_X;
else if (strTest.Equals("bar.usedspace(y)")) ret = SYSTEM_USED_SPACE_Y;
else if (strTest.Equals("bar.freespace(y)")) ret = SYSTEM_FREE_SPACE_Y;
else if (strTest.Equals("bar.usedspace(z)")) ret = SYSTEM_USED_SPACE_Z;
else if (strTest.Equals("bar.freespace(z)")) ret = SYSTEM_FREE_SPACE_Z;
else if (strTest.Equals("bar.hddtemperature")) ret = SYSTEM_HDD_TEMPERATURE;
}
else if (strCategory.Equals("system"))
{
if (strTest.Equals("system.date")) ret = SYSTEM_DATE;
else if (strTest.Left(12).Equals("system.date("))
{
// the skin must submit the date in the format MM-DD
// This InfoBool is designed for generic range checking, so year is NOT used. Only Month-Day.
CStdString param = strTest.Mid(12, strTest.length() - 13);
CStdStringArray params;
StringUtils::SplitString(param, ",", params);
if (params.size() == 2)
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_DATE : SYSTEM_DATE, StringUtils::DateStringToYYYYMMDD(params[0]) % 10000, StringUtils::DateStringToYYYYMMDD(params[1]) % 10000));
else if (params.size() == 1)
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_DATE : SYSTEM_DATE, StringUtils::DateStringToYYYYMMDD(params[0]) % 10000));
}
else if (strTest.Left(11).Equals("system.time"))
{
// 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
// essentially if it isn't a valid TIME_FORMAT then its considered to be the latter.
CStdString param = strTest.Mid(11);
TIME_FORMAT timeFormat = TranslateTimeFormat(param);
if ((timeFormat == TIME_FORMAT_GUESS) && (!param.IsEmpty()))
{
param = strTest.Mid(12, strTest.length() - 13);
CStdStringArray params;
StringUtils::SplitString(param, ",", params);
if (params.size() == 2)
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_TIME : SYSTEM_TIME, StringUtils::TimeStringToSeconds(params[0]), StringUtils::TimeStringToSeconds(params[1])));
else if (params.size() == 1)
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_TIME : SYSTEM_TIME, StringUtils::TimeStringToSeconds(params[0])));
}
else
return AddMultiInfo(GUIInfo(SYSTEM_TIME, timeFormat));
}
else if (strTest.Equals("system.cputemperature")) ret = SYSTEM_CPU_TEMPERATURE;
else if (strTest.Equals("system.cpuusage")) ret = SYSTEM_CPU_USAGE;
else if (strTest.Equals("system.gputemperature")) ret = SYSTEM_GPU_TEMPERATURE;
else if (strTest.Equals("system.fanspeed")) ret = SYSTEM_FAN_SPEED;
else if (strTest.Equals("system.freespace")) ret = SYSTEM_FREE_SPACE;
else if (strTest.Equals("system.usedspace")) ret = SYSTEM_USED_SPACE;
else if (strTest.Equals("system.totalspace")) ret = SYSTEM_TOTAL_SPACE;
else if (strTest.Equals("system.usedspacepercent")) ret = SYSTEM_USED_SPACE_PERCENT;
else if (strTest.Equals("system.freespacepercent")) ret = SYSTEM_FREE_SPACE_PERCENT;
else if (strTest.Equals("system.freespace(c)")) ret = SYSTEM_FREE_SPACE_C;
else if (strTest.Equals("system.usedspace(c)")) ret = SYSTEM_USED_SPACE_C;
else if (strTest.Equals("system.totalspace(c)")) ret = SYSTEM_TOTAL_SPACE_C;
else if (strTest.Equals("system.usedspacepercent(c)")) ret = SYSTEM_USED_SPACE_PERCENT_C;
else if (strTest.Equals("system.freespacepercent(c)")) ret = SYSTEM_FREE_SPACE_PERCENT_C;
else if (strTest.Equals("system.freespace(e)")) ret = SYSTEM_FREE_SPACE_E;
else if (strTest.Equals("system.usedspace(e)")) ret = SYSTEM_USED_SPACE_E;
else if (strTest.Equals("system.totalspace(e)")) ret = SYSTEM_TOTAL_SPACE_E;
else if (strTest.Equals("system.usedspacepercent(e)")) ret = SYSTEM_USED_SPACE_PERCENT_E;
else if (strTest.Equals("system.freespacepercent(e)")) ret = SYSTEM_FREE_SPACE_PERCENT_E;
else if (strTest.Equals("system.freespace(f)")) ret = SYSTEM_FREE_SPACE_F;
else if (strTest.Equals("system.usedspace(f)")) ret = SYSTEM_USED_SPACE_F;
else if (strTest.Equals("system.totalspace(f)")) ret = SYSTEM_TOTAL_SPACE_F;
else if (strTest.Equals("system.usedspacepercent(f)")) ret = SYSTEM_USED_SPACE_PERCENT_F;
else if (strTest.Equals("system.freespacepercent(f)")) ret = SYSTEM_FREE_SPACE_PERCENT_F;
else if (strTest.Equals("system.freespace(g)")) ret = SYSTEM_FREE_SPACE_G;
else if (strTest.Equals("system.usedspace(g)")) ret = SYSTEM_USED_SPACE_G;
else if (strTest.Equals("system.totalspace(g)")) ret = SYSTEM_TOTAL_SPACE_G;
else if (strTest.Equals("system.usedspacepercent(g)")) ret = SYSTEM_USED_SPACE_PERCENT_G;
else if (strTest.Equals("system.freespacepercent(g)")) ret = SYSTEM_FREE_SPACE_PERCENT_G;
else if (strTest.Equals("system.usedspace(x)")) ret = SYSTEM_USED_SPACE_X;
else if (strTest.Equals("system.freespace(x)")) ret = SYSTEM_FREE_SPACE_X;
else if (strTest.Equals("system.totalspace(x)")) ret = SYSTEM_TOTAL_SPACE_X;
else if (strTest.Equals("system.usedspace(y)")) ret = SYSTEM_USED_SPACE_Y;
else if (strTest.Equals("system.freespace(y)")) ret = SYSTEM_FREE_SPACE_Y;
else if (strTest.Equals("system.totalspace(y)")) ret = SYSTEM_TOTAL_SPACE_Y;
else if (strTest.Equals("system.usedspace(z)")) ret = SYSTEM_USED_SPACE_Z;
else if (strTest.Equals("system.freespace(z)")) ret = SYSTEM_FREE_SPACE_Z;
else if (strTest.Equals("system.totalspace(z)")) ret = SYSTEM_TOTAL_SPACE_Z;
else if (strTest.Equals("system.buildversion")) ret = SYSTEM_BUILD_VERSION;
else if (strTest.Equals("system.builddate")) ret = SYSTEM_BUILD_DATE;
else if (strTest.Equals("system.hasnetwork")) ret = SYSTEM_ETHERNET_LINK_ACTIVE;
else if (strTest.Equals("system.fps")) ret = SYSTEM_FPS;
else if (strTest.Equals("system.hasmediadvd")) ret = SYSTEM_MEDIA_DVD;
else if (strTest.Equals("system.dvdready")) ret = SYSTEM_DVDREADY;
else if (strTest.Equals("system.trayopen")) ret = SYSTEM_TRAYOPEN;
else if (strTest.Equals("system.dvdtraystate")) ret = SYSTEM_DVD_TRAY_STATE;
else if (strTest.Equals("system.memory(free)") || strTest.Equals("system.freememory")) ret = SYSTEM_FREE_MEMORY;
else if (strTest.Equals("system.memory(free.percent)")) ret = SYSTEM_FREE_MEMORY_PERCENT;
else if (strTest.Equals("system.memory(used)")) ret = SYSTEM_USED_MEMORY;
else if (strTest.Equals("system.memory(used.percent)")) ret = SYSTEM_USED_MEMORY_PERCENT;
else if (strTest.Equals("system.memory(total)")) ret = SYSTEM_TOTAL_MEMORY;
else if (strTest.Equals("system.language")) ret = SYSTEM_LANGUAGE;
else if (strTest.Equals("system.temperatureunits")) ret = SYSTEM_TEMPERATURE_UNITS;
else if (strTest.Equals("system.screenmode")) ret = SYSTEM_SCREEN_MODE;
else if (strTest.Equals("system.screenwidth")) ret = SYSTEM_SCREEN_WIDTH;
else if (strTest.Equals("system.screenheight")) ret = SYSTEM_SCREEN_HEIGHT;
else if (strTest.Equals("system.currentwindow")) ret = SYSTEM_CURRENT_WINDOW;
else if (strTest.Equals("system.currentcontrol")) ret = SYSTEM_CURRENT_CONTROL;
else if (strTest.Equals("system.dvdlabel")) ret = SYSTEM_DVD_LABEL;
else if (strTest.Equals("system.haslocks")) ret = SYSTEM_HASLOCKS;
else if (strTest.Equals("system.hasloginscreen")) ret = SYSTEM_HAS_LOGINSCREEN;
else if (strTest.Equals("system.ismaster")) ret = SYSTEM_ISMASTER;
else if (strTest.Equals("system.internetstate")) ret = SYSTEM_INTERNET_STATE;
else if (strTest.Equals("system.loggedon")) ret = SYSTEM_LOGGEDON;
else if (strTest.Equals("system.showexitbutton")) ret = SYSTEM_SHOW_EXIT_BUTTON;
else if (strTest.Equals("system.hasdrivef")) ret = SYSTEM_HAS_DRIVE_F;
else if (strTest.Equals("system.hasdriveg")) ret = SYSTEM_HAS_DRIVE_G;
else if (strTest.Equals("system.kernelversion")) ret = SYSTEM_KERNEL_VERSION;
else if (strTest.Equals("system.uptime")) ret = SYSTEM_UPTIME;
else if (strTest.Equals("system.totaluptime")) ret = SYSTEM_TOTALUPTIME;
else if (strTest.Equals("system.cpufrequency")) ret = SYSTEM_CPUFREQUENCY;
else if (strTest.Equals("system.screenresolution")) ret = SYSTEM_SCREEN_RESOLUTION;
else if (strTest.Equals("system.videoencoderinfo")) ret = SYSTEM_VIDEO_ENCODER_INFO;
else if (strTest.Left(16).Equals("system.idletime("))
{
int time = atoi((strTest.Mid(16, strTest.GetLength() - 17).c_str()));
if (time > SYSTEM_IDLE_TIME_FINISH - SYSTEM_IDLE_TIME_START)
time = SYSTEM_IDLE_TIME_FINISH - SYSTEM_IDLE_TIME_START;
if (time > 0)
ret = SYSTEM_IDLE_TIME_START + time;
}
else if (strTest.Left(16).Equals("system.hasalarm("))
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_HAS_ALARM : SYSTEM_HAS_ALARM, ConditionalStringParameter(strTest.Mid(16,strTest.size()-17)), 0));
else if (strTest.Equals("system.alarmpos")) ret = SYSTEM_ALARM_POS;
else if (strTest.Left(24).Equals("system.alarmlessorequal("))
{
int pos = strTest.Find(",");
int skinOffset = ConditionalStringParameter(strTest.Mid(24, pos-24));
int compareString = ConditionalStringParameter(strTest.Mid(pos + 1, strTest.GetLength() - (pos + 2)));
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_ALARM_LESS_OR_EQUAL: SYSTEM_ALARM_LESS_OR_EQUAL, skinOffset, compareString));
}
else if (strTest.Equals("system.profilename")) ret = SYSTEM_PROFILENAME;
else if (strTest.Equals("system.profilethumb")) ret = SYSTEM_PROFILETHUMB;
else if (strTest.Equals("system.profilecount")) ret = SYSTEM_PROFILECOUNT;
else if (strTest.Equals("system.progressbar")) ret = SYSTEM_PROGRESS_BAR;
else if (strTest.Equals("system.platform.linux")) ret = SYSTEM_PLATFORM_LINUX;
else if (strTest.Equals("system.platform.windows")) ret = SYSTEM_PLATFORM_WINDOWS;
else if (strTest.Equals("system.platform.osx")) ret = SYSTEM_PLATFORM_OSX;
else if (strTest.Left(15).Equals("system.getbool("))
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_GET_BOOL : SYSTEM_GET_BOOL, ConditionalStringParameter(strTest.Mid(15,strTest.size()-16)), 0));
else if (strTest.Left(17).Equals("system.coreusage("))
return AddMultiInfo(GUIInfo(SYSTEM_GET_CORE_USAGE, atoi(strTest.Mid(17,strTest.size()-18)), 0));
else if (strTest.Left(17).Equals("system.hascoreid("))
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_HAS_CORE_ID : SYSTEM_HAS_CORE_ID, ConditionalStringParameter(strTest.Mid(17,strTest.size()-18)), 0));
else if (strTest.Left(15).Equals("system.setting("))
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_SETTING : SYSTEM_SETTING, ConditionalStringParameter(strTest.Mid(15,strTest.size()-16)), 0));
else if (strTest.Equals("system.canpowerdown")) ret = SYSTEM_CAN_POWERDOWN;
else if (strTest.Equals("system.cansuspend")) ret = SYSTEM_CAN_SUSPEND;
else if (strTest.Equals("system.canhibernate")) ret = SYSTEM_CAN_HIBERNATE;
else if (strTest.Equals("system.canreboot")) ret = SYSTEM_CAN_REBOOT;
else if (strTest.Left(16).Equals("system.hasaddon("))
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_HAS_ADDON: SYSTEM_HAS_ADDON, ConditionalStringParameter(strTest.Mid(16,strTest.size()-17)), 0));
else if (strTest.Left(18).Equals("system.addontitle("))
{
CStdString param = strTest.Mid(18,strTest.size()-19);
int info = TranslateString(param);
if (info > 0)
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_ADDON_TITLE: SYSTEM_ADDON_TITLE, info, 0));
// pipe our original string through the localize parsing then make it lowercase (picks up $LBRACKET etc.)
CStdString label = CGUIInfoLabel::GetLabel(param).ToLower();
int compareString = ConditionalStringParameter(label);
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_ADDON_TITLE: SYSTEM_ADDON_TITLE, compareString, 1));
}
else if (strTest.Left(17).Equals("system.addonicon("))
{
CStdString param = strTest.Mid(17,strTest.size()-18);
int info = TranslateString(param);
if (info > 0)
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_ADDON_ICON: SYSTEM_ADDON_ICON, info, 0));
// pipe our original string through the localize parsing then make it lowercase (picks up $LBRACKET etc.)
CStdString label = CGUIInfoLabel::GetLabel(param).ToLower();
int compareString = ConditionalStringParameter(label);
return AddMultiInfo(GUIInfo(bNegate ? -SYSTEM_ADDON_ICON : SYSTEM_ADDON_ICON, compareString, 1));
}
else if (strTest.Equals("system.batterylevel")) ret = SYSTEM_BATTERY_LEVEL;
}
// library test conditions
else if (strTest.Left(7).Equals("library"))
{
if (strTest.Equals("library.hascontent(music)")) ret = LIBRARY_HAS_MUSIC;
else if (strTest.Equals("library.hascontent(video)")) ret = LIBRARY_HAS_VIDEO;
else if (strTest.Equals("library.hascontent(movies)")) ret = LIBRARY_HAS_MOVIES;
else if (strTest.Equals("library.hascontent(tvshows)")) ret = LIBRARY_HAS_TVSHOWS;
else if (strTest.Equals("library.hascontent(musicvideos)")) ret = LIBRARY_HAS_MUSICVIDEOS;
else if (strTest.Equals("library.isscanning")) ret = LIBRARY_IS_SCANNING;
}
else if (strTest.Left(8).Equals("isempty("))
{
CStdString str = strTest.Mid(8, strTest.GetLength() - 9);
return AddMultiInfo(GUIInfo(bNegate ? -STRING_IS_EMPTY : STRING_IS_EMPTY, TranslateSingleString(str)));
}
else if (strTest.Left(14).Equals("stringcompare("))
{
int pos = strTest.Find(",");
int info = TranslateString(strTest.Mid(14, pos-14));
int info2 = TranslateString(strTest.Mid(pos + 1, strTest.GetLength() - (pos + 2)));
if (info2 > 0)
return AddMultiInfo(GUIInfo(bNegate ? -STRING_COMPARE: STRING_COMPARE, info, -info2));
// pipe our original string through the localize parsing then make it lowercase (picks up $LBRACKET etc.)
CStdString label = CGUIInfoLabel::GetLabel(original.Mid(pos + 1, original.GetLength() - (pos + 2))).ToLower();
int compareString = ConditionalStringParameter(label);
return AddMultiInfo(GUIInfo(bNegate ? -STRING_COMPARE: STRING_COMPARE, info, compareString));
}
else if (strTest.Left(19).Equals("integergreaterthan("))
{
int pos = strTest.Find(",");
int info = TranslateString(strTest.Mid(19, pos-19));
int compareInt = atoi(strTest.Mid(pos + 1, strTest.GetLength() - (pos + 2)).c_str());
return AddMultiInfo(GUIInfo(bNegate ? -INTEGER_GREATER_THAN: INTEGER_GREATER_THAN, info, compareInt));
}
else if (strTest.Left(10).Equals("substring("))
{
int pos = strTest.Find(",");
int info = TranslateString(strTest.Mid(10, pos-10));
// pipe our original string through the localize parsing then make it lowercase (picks up $LBRACKET etc.)
CStdString label = CGUIInfoLabel::GetLabel(original.Mid(pos + 1, original.GetLength() - (pos + 2))).ToLower();
int compareString = ConditionalStringParameter(label);
return AddMultiInfo(GUIInfo(bNegate ? -STRING_STR: STRING_STR, info, compareString));
}
else if (strCategory.Equals("lcd"))
{
if (strTest.Equals("lcd.playicon")) ret = LCD_PLAY_ICON;
else if (strTest.Equals("lcd.progressbar")) ret = LCD_PROGRESS_BAR;
else if (strTest.Equals("lcd.cputemperature")) ret = LCD_CPU_TEMPERATURE;
else if (strTest.Equals("lcd.gputemperature")) ret = LCD_GPU_TEMPERATURE;
else if (strTest.Equals("lcd.hddtemperature")) ret = LCD_HDD_TEMPERATURE;
else if (strTest.Equals("lcd.fanspeed")) ret = LCD_FAN_SPEED;
else if (strTest.Equals("lcd.date")) ret = LCD_DATE;
else if (strTest.Equals("lcd.freespace(c)")) ret = LCD_FREE_SPACE_C;
else if (strTest.Equals("lcd.freespace(e)")) ret = LCD_FREE_SPACE_E;
else if (strTest.Equals("lcd.freespace(f)")) ret = LCD_FREE_SPACE_F;
else if (strTest.Equals("lcd.freespace(g)")) ret = LCD_FREE_SPACE_G;
else if (strTest.Equals("lcd.Time21")) ret = LCD_TIME_21; // Small LCD numbers
else if (strTest.Equals("lcd.Time22")) ret = LCD_TIME_22;
else if (strTest.Equals("lcd.TimeWide21")) ret = LCD_TIME_W21; // Medium LCD numbers
else if (strTest.Equals("lcd.TimeWide22")) ret = LCD_TIME_W22;
else if (strTest.Equals("lcd.Time41")) ret = LCD_TIME_41; // Big LCD numbers
else if (strTest.Equals("lcd.Time42")) ret = LCD_TIME_42;
else if (strTest.Equals("lcd.Time43")) ret = LCD_TIME_43;
else if (strTest.Equals("lcd.Time44")) ret = LCD_TIME_44;
}
else if (strCategory.Equals("network"))
{
if (strTest.Equals("network.ipaddress")) ret = NETWORK_IP_ADDRESS;
if (strTest.Equals("network.isdhcp")) ret = NETWORK_IS_DHCP;
if (strTest.Equals("network.linkstate")) ret = NETWORK_LINK_STATE;
if (strTest.Equals("network.macaddress")) ret = NETWORK_MAC_ADDRESS;
if (strTest.Equals("network.subnetaddress")) ret = NETWORK_SUBNET_ADDRESS;
if (strTest.Equals("network.gatewayaddress")) ret = NETWORK_GATEWAY_ADDRESS;
if (strTest.Equals("network.dns1address")) ret = NETWORK_DNS1_ADDRESS;
if (strTest.Equals("network.dns2address")) ret = NETWORK_DNS2_ADDRESS;
if (strTest.Equals("network.dhcpaddress")) ret = NETWORK_DHCP_ADDRESS;
}
else if (strCategory.Equals("musicplayer"))
{
CStdString info = strTest.Mid(strCategory.GetLength() + 1);
if (info.Left(9).Equals("position("))
{
int position = atoi(info.Mid(9));
int value = TranslateMusicPlayerString(info.Mid(info.Find(".")+1));
ret = AddMultiInfo(GUIInfo(value, 0, position));
}
else if (info.Left(7).Equals("offset("))
{
int position = atoi(info.Mid(7));
int value = TranslateMusicPlayerString(info.Mid(info.Find(".")+1));
ret = AddMultiInfo(GUIInfo(value, 1, position));
}
else if (info.Left(13).Equals("timeremaining")) return AddMultiInfo(GUIInfo(PLAYER_TIME_REMAINING, TranslateTimeFormat(info.Mid(13))));
else if (info.Left(9).Equals("timespeed")) return AddMultiInfo(GUIInfo(PLAYER_TIME_SPEED, TranslateTimeFormat(info.Mid(9))));
else if (info.Left(4).Equals("time")) return AddMultiInfo(GUIInfo(PLAYER_TIME, TranslateTimeFormat(info.Mid(4))));
else if (info.Left(8).Equals("duration")) return AddMultiInfo(GUIInfo(PLAYER_DURATION, TranslateTimeFormat(info.Mid(8))));
else if (info.Left(9).Equals("property("))
return AddListItemProp(info.Mid(9, info.GetLength() - 10), MUSICPLAYER_PROPERTY_OFFSET);
else
ret = TranslateMusicPlayerString(strTest.Mid(12));
}
else if (strCategory.Equals("videoplayer"))
{
if (strTest.Equals("videoplayer.title")) ret = VIDEOPLAYER_TITLE;
else if (strTest.Equals("videoplayer.genre")) ret = VIDEOPLAYER_GENRE;
else if (strTest.Equals("videoplayer.country")) ret = VIDEOPLAYER_COUNTRY;
else if (strTest.Equals("videoplayer.originaltitle")) ret = VIDEOPLAYER_ORIGINALTITLE;
else if (strTest.Equals("videoplayer.director")) ret = VIDEOPLAYER_DIRECTOR;
else if (strTest.Equals("videoplayer.year")) ret = VIDEOPLAYER_YEAR;
else if (strTest.Left(25).Equals("videoplayer.timeremaining")) ret = AddMultiInfo(GUIInfo(PLAYER_TIME_REMAINING, TranslateTimeFormat(strTest.Mid(25))));
else if (strTest.Left(21).Equals("videoplayer.timespeed")) ret = AddMultiInfo(GUIInfo(PLAYER_TIME_SPEED, TranslateTimeFormat(strTest.Mid(21))));
else if (strTest.Left(16).Equals("videoplayer.time")) ret = AddMultiInfo(GUIInfo(PLAYER_TIME, TranslateTimeFormat(strTest.Mid(16))));
else if (strTest.Left(20).Equals("videoplayer.duration")) ret = AddMultiInfo(GUIInfo(PLAYER_DURATION, TranslateTimeFormat(strTest.Mid(20))));
else if (strTest.Equals("videoplayer.cover")) ret = VIDEOPLAYER_COVER;
else if (strTest.Equals("videoplayer.usingoverlays")) ret = VIDEOPLAYER_USING_OVERLAYS;
else if (strTest.Equals("videoplayer.isfullscreen")) ret = VIDEOPLAYER_ISFULLSCREEN;
else if (strTest.Equals("videoplayer.hasmenu")) ret = VIDEOPLAYER_HASMENU;
else if (strTest.Equals("videoplayer.playlistlength")) ret = VIDEOPLAYER_PLAYLISTLEN;
else if (strTest.Equals("videoplayer.playlistposition")) ret = VIDEOPLAYER_PLAYLISTPOS;
else if (strTest.Equals("videoplayer.plot")) ret = VIDEOPLAYER_PLOT;
else if (strTest.Equals("videoplayer.plotoutline")) ret = VIDEOPLAYER_PLOT_OUTLINE;
else if (strTest.Equals("videoplayer.episode")) ret = VIDEOPLAYER_EPISODE;
else if (strTest.Equals("videoplayer.season")) ret = VIDEOPLAYER_SEASON;
else if (strTest.Equals("videoplayer.rating")) ret = VIDEOPLAYER_RATING;
else if (strTest.Equals("videoplayer.ratingandvotes")) ret = VIDEOPLAYER_RATING_AND_VOTES;
else if (strTest.Equals("videoplayer.tvshowtitle")) ret = VIDEOPLAYER_TVSHOW;
else if (strTest.Equals("videoplayer.premiered")) ret = VIDEOPLAYER_PREMIERED;
else if (strTest.Left(19).Equals("videoplayer.content")) return AddMultiInfo(GUIInfo(bNegate ? -VIDEOPLAYER_CONTENT : VIDEOPLAYER_CONTENT, ConditionalStringParameter(strTest.Mid(20,strTest.size()-21)), 0));
else if (strTest.Equals("videoplayer.studio")) ret = VIDEOPLAYER_STUDIO;
else if (strTest.Equals("videoplayer.mpaa")) return VIDEOPLAYER_MPAA;
else if (strTest.Equals("videoplayer.top250")) return VIDEOPLAYER_TOP250;
else if (strTest.Equals("videoplayer.cast")) return VIDEOPLAYER_CAST;
else if (strTest.Equals("videoplayer.castandrole")) return VIDEOPLAYER_CAST_AND_ROLE;
else if (strTest.Equals("videoplayer.artist")) return VIDEOPLAYER_ARTIST;
else if (strTest.Equals("videoplayer.album")) return VIDEOPLAYER_ALBUM;
else if (strTest.Equals("videoplayer.writer")) return VIDEOPLAYER_WRITER;
else if (strTest.Equals("videoplayer.tagline")) return VIDEOPLAYER_TAGLINE;
else if (strTest.Equals("videoplayer.hasinfo")) return VIDEOPLAYER_HAS_INFO;
else if (strTest.Equals("videoplayer.trailer")) return VIDEOPLAYER_TRAILER;
else if (strTest.Equals("videoplayer.videocodec")) return VIDEOPLAYER_VIDEO_CODEC;
else if (strTest.Equals("videoplayer.videoresolution")) return VIDEOPLAYER_VIDEO_RESOLUTION;
else if (strTest.Equals("videoplayer.videoaspect")) return VIDEOPLAYER_VIDEO_ASPECT;
else if (strTest.Equals("videoplayer.audiocodec")) return VIDEOPLAYER_AUDIO_CODEC;
else if (strTest.Equals("videoplayer.audiochannels")) return VIDEOPLAYER_AUDIO_CHANNELS;
else if (strTest.Equals("videoplayer.hasteletext")) return VIDEOPLAYER_HASTELETEXT;
else if (strTest.Equals("videoplayer.lastplayed")) return VIDEOPLAYER_LASTPLAYED;
else if (strTest.Equals("videoplayer.playcount")) return VIDEOPLAYER_PLAYCOUNT;
}
else if (strCategory.Equals("playlist"))
{
if (strTest.Equals("playlist.length")) ret = PLAYLIST_LENGTH;
else if (strTest.Equals("playlist.position")) ret = PLAYLIST_POSITION;
else if (strTest.Equals("playlist.random")) ret = PLAYLIST_RANDOM;
else if (strTest.Equals("playlist.repeat")) ret = PLAYLIST_REPEAT;
else if (strTest.Equals("playlist.israndom")) ret = PLAYLIST_ISRANDOM;
else if (strTest.Equals("playlist.isrepeat")) ret = PLAYLIST_ISREPEAT;
else if (strTest.Equals("playlist.isrepeatone")) ret = PLAYLIST_ISREPEATONE;
}
else if (strCategory.Equals("musicpartymode"))
{
if (strTest.Equals("musicpartymode.enabled")) ret = MUSICPM_ENABLED;
else if (strTest.Equals("musicpartymode.songsplayed")) ret = MUSICPM_SONGSPLAYED;
else if (strTest.Equals("musicpartymode.matchingsongs")) ret = MUSICPM_MATCHINGSONGS;
else if (strTest.Equals("musicpartymode.matchingsongspicked")) ret = MUSICPM_MATCHINGSONGSPICKED;
else if (strTest.Equals("musicpartymode.matchingsongsleft")) ret = MUSICPM_MATCHINGSONGSLEFT;
else if (strTest.Equals("musicpartymode.relaxedsongspicked")) ret = MUSICPM_RELAXEDSONGSPICKED;
else if (strTest.Equals("musicpartymode.randomsongspicked")) ret = MUSICPM_RANDOMSONGSPICKED;
}
else if (strCategory.Equals("audioscrobbler"))
{
if (strTest.Equals("audioscrobbler.enabled")) ret = AUDIOSCROBBLER_ENABLED;
else if (strTest.Equals("audioscrobbler.connectstate")) ret = AUDIOSCROBBLER_CONN_STATE;
else if (strTest.Equals("audioscrobbler.submitinterval")) ret = AUDIOSCROBBLER_SUBMIT_INT;
else if (strTest.Equals("audioscrobbler.filescached")) ret = AUDIOSCROBBLER_FILES_CACHED;
else if (strTest.Equals("audioscrobbler.submitstate")) ret = AUDIOSCROBBLER_SUBMIT_STATE;
}
else if (strCategory.Equals("lastfm"))
{
if (strTest.Equals("lastfm.radioplaying")) ret = LASTFM_RADIOPLAYING;
else if (strTest.Equals("lastfm.canlove")) ret = LASTFM_CANLOVE;
else if (strTest.Equals("lastfm.canban")) ret = LASTFM_CANBAN;
}
else if (strCategory.Equals("slideshow"))
ret = CPictureInfoTag::TranslateString(strTest.Mid(strCategory.GetLength() + 1));
else if (strCategory.Left(9).Equals("container"))
{
int id = atoi(strCategory.Mid(10, strCategory.GetLength() - 11));
CStdString info = strTest.Mid(strCategory.GetLength() + 1);
if (info.Left(14).Equals("listitemnowrap"))
{
int offset = atoi(info.Mid(15, info.GetLength() - 16));
ret = TranslateListItem(info.Mid(info.Find(".")+1));
if (offset || id)
return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, id, offset));
}
else if (info.Left(16).Equals("listitemposition"))
{
int offset = atoi(info.Mid(17, info.GetLength() - 18));
ret = TranslateListItem(info.Mid(info.Find(".")+1));
if (offset || id)
return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, id, offset, INFOFLAG_LISTITEM_POSITION));
}
else if (info.Left(8).Equals("listitem"))
{
int offset = atoi(info.Mid(9, info.GetLength() - 10));
ret = TranslateListItem(info.Mid(info.Find(".")+1));
if (offset || id)
return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, id, offset, INFOFLAG_LISTITEM_WRAP));
}
else if (info.Equals("hasfiles")) ret = CONTAINER_HASFILES;
else if (info.Equals("hasfolders")) ret = CONTAINER_HASFOLDERS;
else if (info.Equals("isstacked")) ret = CONTAINER_STACKED;
else if (info.Equals("folderthumb")) ret = CONTAINER_FOLDERTHUMB;
else if (info.Equals("tvshowthumb")) ret = CONTAINER_TVSHOWTHUMB;
else if (info.Equals("seasonthumb")) ret = CONTAINER_SEASONTHUMB;
else if (info.Equals("folderpath")) ret = CONTAINER_FOLDERPATH;
else if (info.Equals("foldername")) ret = CONTAINER_FOLDERNAME;
else if (info.Equals("pluginname")) ret = CONTAINER_PLUGINNAME;
else if (info.Equals("viewmode")) ret = CONTAINER_VIEWMODE;
else if (info.Equals("onnext")) ret = CONTAINER_MOVE_NEXT;
else if (info.Equals("onprevious")) ret = CONTAINER_MOVE_PREVIOUS;
else if (info.Equals("onscrollnext")) ret = CONTAINER_SCROLL_NEXT;
else if (info.Equals("onscrollprevious")) ret = CONTAINER_SCROLL_PREVIOUS;
else if (info.Equals("totaltime")) ret = CONTAINER_TOTALTIME;
else if (info.Equals("scrolling"))
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_SCROLLING : CONTAINER_SCROLLING, id, 0));
else if (info.Equals("hasnext"))
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_HAS_NEXT : CONTAINER_HAS_NEXT, id, 0));
else if (info.Equals("hasprevious"))
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_HAS_PREVIOUS : CONTAINER_HAS_PREVIOUS, id, 0));
else if (info.Left(8).Equals("content("))
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_CONTENT : CONTAINER_CONTENT, ConditionalStringParameter(info.Mid(8,info.GetLength()-9)), 0));
else if (info.Left(4).Equals("row("))
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_ROW : CONTAINER_ROW, id, atoi(info.Mid(4, info.GetLength() - 5))));
else if (info.Left(7).Equals("column("))
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_COLUMN : CONTAINER_COLUMN, id, atoi(info.Mid(7, info.GetLength() - 8))));
else if (info.Left(8).Equals("position"))
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_POSITION : CONTAINER_POSITION, id, atoi(info.Mid(9, info.GetLength() - 10))));
else if (info.Left(8).Equals("subitem("))
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_SUBITEM : CONTAINER_SUBITEM, id, atoi(info.Mid(8, info.GetLength() - 9))));
else if (info.Equals("hasthumb")) ret = CONTAINER_HAS_THUMB;
else if (info.Equals("numpages")) ret = CONTAINER_NUM_PAGES;
else if (info.Equals("numitems")) ret = CONTAINER_NUM_ITEMS;
else if (info.Equals("currentpage")) ret = CONTAINER_CURRENT_PAGE;
else if (info.Equals("sortmethod")) ret = CONTAINER_SORT_METHOD;
else if (info.Left(13).Equals("sortdirection"))
{
CStdString direction = info.Mid(14, info.GetLength() - 15);
SORT_ORDER order = SORT_ORDER_NONE;
if (direction == "ascending")
order = SORT_ORDER_ASC;
else if (direction == "descending")
order = SORT_ORDER_DESC;
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_SORT_DIRECTION : CONTAINER_SORT_DIRECTION, order));
}
else if (info.Left(5).Equals("sort("))
{
SORT_METHOD sort = SORT_METHOD_NONE;
CStdString method(info.Mid(5, info.GetLength() - 6));
if (method.Equals("songrating")) sort = SORT_METHOD_SONG_RATING;
if (sort != SORT_METHOD_NONE)
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_SORT_METHOD : CONTAINER_SORT_METHOD, sort));
}
else if (id && info.Left(9).Equals("hasfocus("))
{
int itemID = atoi(info.Mid(9, info.GetLength() - 10));
return AddMultiInfo(GUIInfo(bNegate ? -CONTAINER_HAS_FOCUS : CONTAINER_HAS_FOCUS, id, itemID));
}
else if (info.Left(9).Equals("property("))
{
int compareString = ConditionalStringParameter(info.Mid(9, info.GetLength() - 10));
return AddMultiInfo(GUIInfo(CONTAINER_PROPERTY, id, compareString));
}
else if (info.Equals("showplot")) ret = CONTAINER_SHOWPLOT;
if (id && ((ret >= CONTAINER_SCROLL_PREVIOUS && ret <= CONTAINER_SCROLL_NEXT) || ret == CONTAINER_NUM_PAGES ||
ret == CONTAINER_NUM_ITEMS || ret == CONTAINER_CURRENT_PAGE))
return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, id));
}
else if (strCategory.Left(8).Equals("listitem"))
{
int offset = atoi(strCategory.Mid(9, strCategory.GetLength() - 10));
ret = TranslateListItem(strTest.Mid(strCategory.GetLength() + 1));
if (offset || ret == LISTITEM_ISSELECTED || ret == LISTITEM_ISPLAYING || ret == LISTITEM_IS_FOLDER)
return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, 0, offset, INFOFLAG_LISTITEM_WRAP));
}
else if (strCategory.Left(16).Equals("listitemposition"))
{
int offset = atoi(strCategory.Mid(17, strCategory.GetLength() - 18));
ret = TranslateListItem(strCategory.Mid(strCategory.GetLength()+1));
if (offset || ret == LISTITEM_ISSELECTED || ret == LISTITEM_ISPLAYING || ret == LISTITEM_IS_FOLDER)
return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, 0, offset, INFOFLAG_LISTITEM_POSITION));
}
else if (strCategory.Left(14).Equals("listitemnowrap"))
{
int offset = atoi(strCategory.Mid(15, strCategory.GetLength() - 16));
ret = TranslateListItem(strTest.Mid(strCategory.GetLength() + 1));
if (offset || ret == LISTITEM_ISSELECTED || ret == LISTITEM_ISPLAYING || ret == LISTITEM_IS_FOLDER)
return AddMultiInfo(GUIInfo(bNegate ? -ret : ret, 0, offset));
}
else if (strCategory.Equals("visualisation"))
{
if (strTest.Equals("visualisation.locked")) ret = VISUALISATION_LOCKED;
else if (strTest.Equals("visualisation.preset")) ret = VISUALISATION_PRESET;
else if (strTest.Equals("visualisation.name")) ret = VISUALISATION_NAME;
else if (strTest.Equals("visualisation.enabled")) ret = VISUALISATION_ENABLED;
}
else if (strCategory.Equals("fanart"))
{
if (strTest.Equals("fanart.color1")) ret = FANART_COLOR1;
else if (strTest.Equals("fanart.color2")) ret = FANART_COLOR2;
else if (strTest.Equals("fanart.color3")) ret = FANART_COLOR3;
else if (strTest.Equals("fanart.image")) ret = FANART_IMAGE;
}
else if (strCategory.Equals("skin"))
{
if (strTest.Equals("skin.currenttheme"))
ret = SKIN_THEME;
else if (strTest.Equals("skin.currentcolourtheme"))
ret = SKIN_COLOUR_THEME;
else if (strTest.Left(12).Equals("skin.string("))
{
int pos = strTest.Find(",");
if (pos >= 0)
{
int skinOffset = g_settings.TranslateSkinString(strTest.Mid(12, pos - 12));
int compareString = ConditionalStringParameter(strTest.Mid(pos + 1, strTest.GetLength() - (pos + 2)));
return AddMultiInfo(GUIInfo(bNegate ? -SKIN_STRING : SKIN_STRING, skinOffset, compareString));
}
int skinOffset = g_settings.TranslateSkinString(strTest.Mid(12, strTest.GetLength() - 13));
return AddMultiInfo(GUIInfo(bNegate ? -SKIN_STRING : SKIN_STRING, skinOffset));
}
else if (strTest.Left(16).Equals("skin.hassetting("))
{
int skinOffset = g_settings.TranslateSkinBool(strTest.Mid(16, strTest.GetLength() - 17));
return AddMultiInfo(GUIInfo(bNegate ? -SKIN_BOOL : SKIN_BOOL, skinOffset));
}
else if (strTest.Left(14).Equals("skin.hastheme("))
ret = SKIN_HAS_THEME_START + ConditionalStringParameter(strTest.Mid(14, strTest.GetLength() - 15));
}
else if (strCategory.Left(6).Equals("window"))
{
CStdString info = strTest.Mid(strCategory.GetLength() + 1);
// special case for window.xml parameter, fails above
if (info.Left(5).Equals("xml)."))
info = info.Mid(5, info.GetLength() + 1);
if (info.Left(9).Equals("property("))
{
int winID = 0;
if (strTest.Left(7).Equals("window("))
{
CStdString window(strTest.Mid(7, strTest.Find(")", 7) - 7).ToLower());
winID = CButtonTranslator::TranslateWindow(window);
}
if (winID != WINDOW_INVALID)
{
int compareString = ConditionalStringParameter(info.Mid(9, info.GetLength() - 10));
return AddMultiInfo(GUIInfo(WINDOW_PROPERTY, winID, compareString));
}
}
else if (info.Left(9).Equals("isactive("))
{
CStdString window(strTest.Mid(16, strTest.GetLength() - 17).ToLower());
if (window.Find("xml") >= 0)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_ACTIVE : WINDOW_IS_ACTIVE, 0, ConditionalStringParameter(window)));
int winID = CButtonTranslator::TranslateWindow(window);
if (winID != WINDOW_INVALID)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_ACTIVE : WINDOW_IS_ACTIVE, winID, 0));
}
else if (info.Left(7).Equals("ismedia")) return WINDOW_IS_MEDIA;
else if (info.Left(10).Equals("istopmost("))
{
CStdString window(strTest.Mid(17, strTest.GetLength() - 18).ToLower());
if (window.Find("xml") >= 0)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_TOPMOST : WINDOW_IS_TOPMOST, 0, ConditionalStringParameter(window)));
int winID = CButtonTranslator::TranslateWindow(window);
if (winID != WINDOW_INVALID)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_TOPMOST : WINDOW_IS_TOPMOST, winID, 0));
}
else if (info.Left(10).Equals("isvisible("))
{
CStdString window(strTest.Mid(17, strTest.GetLength() - 18).ToLower());
if (window.Find("xml") >= 0)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_VISIBLE : WINDOW_IS_VISIBLE, 0, ConditionalStringParameter(window)));
int winID = CButtonTranslator::TranslateWindow(window);
if (winID != WINDOW_INVALID)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_IS_VISIBLE : WINDOW_IS_VISIBLE, winID, 0));
}
else if (info.Left(9).Equals("previous("))
{
CStdString window(strTest.Mid(16, strTest.GetLength() - 17).ToLower());
if (window.Find("xml") >= 0)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_PREVIOUS : WINDOW_PREVIOUS, 0, ConditionalStringParameter(window)));
int winID = CButtonTranslator::TranslateWindow(window);
if (winID != WINDOW_INVALID)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_PREVIOUS : WINDOW_PREVIOUS, winID, 0));
}
else if (info.Left(5).Equals("next("))
{
CStdString window(strTest.Mid(12, strTest.GetLength() - 13).ToLower());
if (window.Find("xml") >= 0)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_NEXT : WINDOW_NEXT, 0, ConditionalStringParameter(window)));
int winID = CButtonTranslator::TranslateWindow(window);
if (winID != WINDOW_INVALID)
return AddMultiInfo(GUIInfo(bNegate ? -WINDOW_NEXT : WINDOW_NEXT, winID, 0));
}
}
else if (strTest.Left(17).Equals("control.hasfocus("))
{
int controlID = atoi(strTest.Mid(17, strTest.GetLength() - 18).c_str());
if (controlID)
return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_HAS_FOCUS : CONTROL_HAS_FOCUS, controlID, 0));
}
else if (strTest.Left(18).Equals("control.isvisible("))
{
int controlID = atoi(strTest.Mid(18, strTest.GetLength() - 19).c_str());
if (controlID)
return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_IS_VISIBLE : CONTROL_IS_VISIBLE, controlID, 0));
}
else if (strTest.Left(18).Equals("control.isenabled("))
{
int controlID = atoi(strTest.Mid(18, strTest.GetLength() - 19).c_str());
if (controlID)
return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_IS_ENABLED : CONTROL_IS_ENABLED, controlID, 0));
}
else if (strTest.Left(17).Equals("control.getlabel("))
{
int controlID = atoi(strTest.Mid(17, strTest.GetLength() - 18).c_str());
if (controlID)
return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_GET_LABEL : CONTROL_GET_LABEL, controlID, 0));
}
else if (strTest.Left(13).Equals("controlgroup("))
{
int groupID = atoi(strTest.Mid(13).c_str());
int controlID = 0;
int controlPos = strTest.Find(".hasfocus(");
if (controlPos > 0)
controlID = atoi(strTest.Mid(controlPos + 10).c_str());
if (groupID)
{
return AddMultiInfo(GUIInfo(bNegate ? -CONTROL_GROUP_HAS_FOCUS : CONTROL_GROUP_HAS_FOCUS, groupID, controlID));
}
}
else if (strTest.Left(24).Equals("buttonscroller.hasfocus("))
{
int controlID = atoi(strTest.Mid(24, strTest.GetLength() - 24).c_str());
if (controlID)
return AddMultiInfo(GUIInfo(bNegate ? -BUTTON_SCROLLER_HAS_ICON : BUTTON_SCROLLER_HAS_ICON, controlID, 0));
}
return bNegate ? -ret : ret;
}
int CGUIInfoManager::TranslateListItem(const CStdString &info)
{
if (info.Equals("thumb")) return LISTITEM_THUMB;
else if (info.Equals("icon")) return LISTITEM_ICON;
else if (info.Equals("actualicon")) return LISTITEM_ACTUAL_ICON;
else if (info.Equals("overlay")) return LISTITEM_OVERLAY;
else if (info.Equals("label")) return LISTITEM_LABEL;
else if (info.Equals("label2")) return LISTITEM_LABEL2;
else if (info.Equals("title")) return LISTITEM_TITLE;
else if (info.Equals("tracknumber")) return LISTITEM_TRACKNUMBER;
else if (info.Equals("artist")) return LISTITEM_ARTIST;
else if (info.Equals("album")) return LISTITEM_ALBUM;
else if (info.Equals("albumartist")) return LISTITEM_ALBUM_ARTIST;
else if (info.Equals("year")) return LISTITEM_YEAR;
else if (info.Equals("genre")) return LISTITEM_GENRE;
else if (info.Equals("director")) return LISTITEM_DIRECTOR;
else if (info.Equals("filename")) return LISTITEM_FILENAME;
else if (info.Equals("filenameandpath")) return LISTITEM_FILENAME_AND_PATH;
else if (info.Equals("date")) return LISTITEM_DATE;
else if (info.Equals("size")) return LISTITEM_SIZE;
else if (info.Equals("rating")) return LISTITEM_RATING;
else if (info.Equals("ratingandvotes")) return LISTITEM_RATING_AND_VOTES;
else if (info.Equals("programcount")) return LISTITEM_PROGRAM_COUNT;
else if (info.Equals("duration")) return LISTITEM_DURATION;
else if (info.Equals("isselected")) return LISTITEM_ISSELECTED;
else if (info.Equals("isplaying")) return LISTITEM_ISPLAYING;
else if (info.Equals("plot")) return LISTITEM_PLOT;
else if (info.Equals("plotoutline")) return LISTITEM_PLOT_OUTLINE;
else if (info.Equals("episode")) return LISTITEM_EPISODE;
else if (info.Equals("season")) return LISTITEM_SEASON;
else if (info.Equals("tvshowtitle")) return LISTITEM_TVSHOW;
else if (info.Equals("premiered")) return LISTITEM_PREMIERED;
else if (info.Equals("comment")) return LISTITEM_COMMENT;
else if (info.Equals("path")) return LISTITEM_PATH;
else if (info.Equals("foldername")) return LISTITEM_FOLDERNAME;
else if (info.Equals("folderpath")) return LISTITEM_FOLDERPATH;
else if (info.Equals("picturepath")) return LISTITEM_PICTURE_PATH;
else if (info.Equals("pictureresolution")) return LISTITEM_PICTURE_RESOLUTION;
else if (info.Equals("picturedatetime")) return LISTITEM_PICTURE_DATETIME;
else if (info.Equals("studio")) return LISTITEM_STUDIO;
else if (info.Equals("country")) return LISTITEM_COUNTRY;
else if (info.Equals("mpaa")) return LISTITEM_MPAA;
else if (info.Equals("cast")) return LISTITEM_CAST;
else if (info.Equals("castandrole")) return LISTITEM_CAST_AND_ROLE;
else if (info.Equals("writer")) return LISTITEM_WRITER;
else if (info.Equals("tagline")) return LISTITEM_TAGLINE;
else if (info.Equals("top250")) return LISTITEM_TOP250;
else if (info.Equals("trailer")) return LISTITEM_TRAILER;
else if (info.Equals("starrating")) return LISTITEM_STAR_RATING;
else if (info.Equals("sortletter")) return LISTITEM_SORT_LETTER;
else if (info.Equals("videocodec")) return LISTITEM_VIDEO_CODEC;
else if (info.Equals("videoresolution")) return LISTITEM_VIDEO_RESOLUTION;
else if (info.Equals("videoaspect")) return LISTITEM_VIDEO_ASPECT;
else if (info.Equals("audiocodec")) return LISTITEM_AUDIO_CODEC;
else if (info.Equals("audiochannels")) return LISTITEM_AUDIO_CHANNELS;
else if (info.Equals("audiolanguage")) return LISTITEM_AUDIO_LANGUAGE;
else if (info.Equals("subtitlelanguage")) return LISTITEM_SUBTITLE_LANGUAGE;
else if (info.Equals("isfolder")) return LISTITEM_IS_FOLDER;
else if (info.Equals("originaltitle")) return LISTITEM_ORIGINALTITLE;
else if (info.Equals("lastplayed")) return LISTITEM_LASTPLAYED;
else if (info.Equals("playcount")) return LISTITEM_PLAYCOUNT;
else if (info.Equals("discnumber")) return LISTITEM_DISC_NUMBER;
else if (info.Left(9).Equals("property(")) return AddListItemProp(info.Mid(9, info.GetLength() - 10));
return 0;
}
int CGUIInfoManager::TranslateMusicPlayerString(const CStdString &info) const
{
if (info.Equals("title")) return MUSICPLAYER_TITLE;
else if (info.Equals("album")) return MUSICPLAYER_ALBUM;
else if (info.Equals("artist")) return MUSICPLAYER_ARTIST;
else if (info.Equals("albumartist")) return MUSICPLAYER_ALBUM_ARTIST;
else if (info.Equals("year")) return MUSICPLAYER_YEAR;
else if (info.Equals("genre")) return MUSICPLAYER_GENRE;
else if (info.Equals("duration")) return MUSICPLAYER_DURATION;
else if (info.Equals("tracknumber")) return MUSICPLAYER_TRACK_NUMBER;
else if (info.Equals("cover")) return MUSICPLAYER_COVER;
else if (info.Equals("bitrate")) return MUSICPLAYER_BITRATE;
else if (info.Equals("playlistlength")) return MUSICPLAYER_PLAYLISTLEN;
else if (info.Equals("playlistposition")) return MUSICPLAYER_PLAYLISTPOS;
else if (info.Equals("channels")) return MUSICPLAYER_CHANNELS;
else if (info.Equals("bitspersample")) return MUSICPLAYER_BITSPERSAMPLE;
else if (info.Equals("samplerate")) return MUSICPLAYER_SAMPLERATE;
else if (info.Equals("codec")) return MUSICPLAYER_CODEC;
else if (info.Equals("discnumber")) return MUSICPLAYER_DISC_NUMBER;
else if (info.Equals("rating")) return MUSICPLAYER_RATING;
else if (info.Equals("comment")) return MUSICPLAYER_COMMENT;
else if (info.Equals("lyrics")) return MUSICPLAYER_LYRICS;
else if (info.Equals("playlistplaying")) return MUSICPLAYER_PLAYLISTPLAYING;
else if (info.Equals("exists")) return MUSICPLAYER_EXISTS;
else if (info.Equals("hasprevious")) return MUSICPLAYER_HASPREVIOUS;
else if (info.Equals("hasnext")) return MUSICPLAYER_HASNEXT;
else if (info.Equals("playcount")) return MUSICPLAYER_PLAYCOUNT;
else if (info.Equals("lastplayed")) return MUSICPLAYER_LASTPLAYED;
return 0;
}
TIME_FORMAT CGUIInfoManager::TranslateTimeFormat(const CStdString &format)
{
if (format.IsEmpty()) return TIME_FORMAT_GUESS;
else if (format.Equals("(hh)")) return TIME_FORMAT_HH;
else if (format.Equals("(mm)")) return TIME_FORMAT_MM;
else if (format.Equals("(ss)")) return TIME_FORMAT_SS;
else if (format.Equals("(hh:mm)")) return TIME_FORMAT_HH_MM;
else if (format.Equals("(mm:ss)")) return TIME_FORMAT_MM_SS;