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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
|
/*
* Copyright (C) 2005-2013 Team XBMC
* http://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, see
* <http://www.gnu.org/licenses/>.
*
*/
#include "network/Network.h"
#include "system.h"
#include "CompileInfo.h"
#include "GUIInfoManager.h"
#include "windows/GUIMediaWindow.h"
#include "dialogs/GUIDialogProgress.h"
#include "Application.h"
#include "Util.h"
#include "utils/URIUtils.h"
#include "utils/Weather.h"
#include "PartyModeManager.h"
#include "addons/Visualisation.h"
#include "input/ButtonTranslator.h"
#include "utils/AlarmClock.h"
#include "LangInfo.h"
#include "utils/SystemInfo.h"
#include "guilib/GUITextBox.h"
#include "pictures/GUIWindowSlideShow.h"
#include "pictures/PictureInfoTag.h"
#include "music/tags/MusicInfoTag.h"
#include "guilib/IGUIContainer.h"
#include "guilib/GUIWindowManager.h"
#include "playlists/PlayList.h"
#include "profiles/ProfilesManager.h"
#include "utils/TuxBoxUtil.h"
#include "windowing/WindowingFactory.h"
#include "powermanagement/PowerManager.h"
#include "settings/AdvancedSettings.h"
#include "settings/DisplaySettings.h"
#include "settings/MediaSettings.h"
#include "settings/Settings.h"
#include "settings/SkinSettings.h"
#include "guilib/LocalizeStrings.h"
#include "guilib/StereoscopicsManager.h"
#include "utils/CharsetConverter.h"
#include "utils/CPUInfo.h"
#include "utils/StringUtils.h"
#include "utils/MathUtils.h"
#include "utils/SeekHandler.h"
#include "URL.h"
#include "addons/Skin.h"
#include "boost/make_shared.hpp"
#include "cores/DataCacheCore.h"
// stuff for current song
#include "music/MusicInfoLoader.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 "pvr/PVRManager.h"
#include "pvr/channels/PVRChannelGroupsContainer.h"
#include "epg/EpgInfoTag.h"
#include "pvr/timers/PVRTimers.h"
#include "pvr/recordings/PVRRecording.h"
#include "addons/AddonManager.h"
#include "interfaces/info/InfoBool.h"
#include "video/VideoThumbLoader.h"
#include "music/MusicThumbLoader.h"
#include "video/VideoDatabase.h"
#include "cores/IPlayer.h"
#include "cores/AudioEngine/Utils/AEUtil.h"
#include "cores/VideoRenderers/BaseRenderer.h"
#include "interfaces/info/InfoExpression.h"
#if defined(TARGET_DARWIN_OSX)
#include "osx/smc.h"
#include "linux/LinuxResourceCounter.h"
static CLinuxResourceCounter m_resourceCounter;
#endif
#define SYSHEATUPDATEINTERVAL 60000
using namespace std;
using namespace XFILE;
using namespace MUSIC_INFO;
using namespace ADDON;
using namespace PVR;
using namespace INFO;
using namespace EPG;
CGUIInfoManager::CGUIInfoManager(void) :
Observable()
{
m_lastSysHeatInfoTime = -SYSHEATUPDATEINTERVAL; // make sure we grab CPU temp on the first pass
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;
m_playerShowTime = false;
m_playerShowCodec = false;
m_playerShowInfo = false;
m_fps = 0.0f;
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 (m_currentFile->IsSamePath(item.get()))
{
m_currentFile->UpdateInfo(*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));
return TranslateSingleString(strCondition);
}
typedef struct
{
const char *str;
int val;
} infomap;
const infomap player_labels[] = {{ "hasmedia", PLAYER_HAS_MEDIA }, // bools from here
{ "hasaudio", PLAYER_HAS_AUDIO },
{ "hasvideo", PLAYER_HAS_VIDEO },
{ "playing", PLAYER_PLAYING },
{ "paused", PLAYER_PAUSED },
{ "rewinding", PLAYER_REWINDING },
{ "forwarding", PLAYER_FORWARDING },
{ "rewinding2x", PLAYER_REWINDING_2x },
{ "rewinding4x", PLAYER_REWINDING_4x },
{ "rewinding8x", PLAYER_REWINDING_8x },
{ "rewinding16x", PLAYER_REWINDING_16x },
{ "rewinding32x", PLAYER_REWINDING_32x },
{ "forwarding2x", PLAYER_FORWARDING_2x },
{ "forwarding4x", PLAYER_FORWARDING_4x },
{ "forwarding8x", PLAYER_FORWARDING_8x },
{ "forwarding16x", PLAYER_FORWARDING_16x },
{ "forwarding32x", PLAYER_FORWARDING_32x },
{ "canrecord", PLAYER_CAN_RECORD },
{ "recording", PLAYER_RECORDING },
{ "displayafterseek", PLAYER_DISPLAY_AFTER_SEEK },
{ "caching", PLAYER_CACHING },
{ "seekbar", PLAYER_SEEKBAR },
{ "seeking", PLAYER_SEEKING },
{ "showtime", PLAYER_SHOWTIME },
{ "showcodec", PLAYER_SHOWCODEC },
{ "showinfo", PLAYER_SHOWINFO },
{ "title", PLAYER_TITLE },
{ "muted", PLAYER_MUTED },
{ "hasduration", PLAYER_HASDURATION },
{ "passthrough", PLAYER_PASSTHROUGH },
{ "cachelevel", PLAYER_CACHELEVEL }, // labels from here
{ "progress", PLAYER_PROGRESS },
{ "progresscache", PLAYER_PROGRESS_CACHE },
{ "volume", PLAYER_VOLUME },
{ "subtitledelay", PLAYER_SUBTITLE_DELAY },
{ "audiodelay", PLAYER_AUDIO_DELAY },
{ "chapter", PLAYER_CHAPTER },
{ "chaptercount", PLAYER_CHAPTERCOUNT },
{ "chaptername", PLAYER_CHAPTERNAME },
{ "starrating", PLAYER_STAR_RATING },
{ "folderpath", PLAYER_PATH },
{ "filenameandpath", PLAYER_FILEPATH },
{ "filename", PLAYER_FILENAME },
{ "isinternetstream", PLAYER_ISINTERNETSTREAM },
{ "pauseenabled", PLAYER_CAN_PAUSE },
{ "seekenabled", PLAYER_CAN_SEEK }};
const infomap player_param[] = {{ "art", PLAYER_ITEM_ART }};
const infomap player_times[] = {{ "seektime", PLAYER_SEEKTIME },
{ "seekoffset", PLAYER_SEEKOFFSET },
{ "timeremaining", PLAYER_TIME_REMAINING },
{ "timespeed", PLAYER_TIME_SPEED },
{ "time", PLAYER_TIME },
{ "duration", PLAYER_DURATION },
{ "finishtime", PLAYER_FINISH_TIME },
{ "starttime", PLAYER_START_TIME}};
const infomap weather[] = {{ "isfetched", WEATHER_IS_FETCHED },
{ "conditions", WEATHER_CONDITIONS }, // labels from here
{ "temperature", WEATHER_TEMPERATURE },
{ "location", WEATHER_LOCATION },
{ "fanartcode", WEATHER_FANART_CODE },
{ "plugin", WEATHER_PLUGIN }};
const infomap system_labels[] = {{ "hasnetwork", SYSTEM_ETHERNET_LINK_ACTIVE },
{ "hasmediadvd", SYSTEM_MEDIA_DVD },
{ "dvdready", SYSTEM_DVDREADY },
{ "trayopen", SYSTEM_TRAYOPEN },
{ "haslocks", SYSTEM_HASLOCKS },
{ "hasloginscreen", SYSTEM_HAS_LOGINSCREEN },
{ "ismaster", SYSTEM_ISMASTER },
{ "isfullscreen", SYSTEM_ISFULLSCREEN },
{ "isstandalone", SYSTEM_ISSTANDALONE },
{ "loggedon", SYSTEM_LOGGEDON },
{ "showexitbutton", SYSTEM_SHOW_EXIT_BUTTON },
{ "canpowerdown", SYSTEM_CAN_POWERDOWN },
{ "cansuspend", SYSTEM_CAN_SUSPEND },
{ "canhibernate", SYSTEM_CAN_HIBERNATE },
{ "canreboot", SYSTEM_CAN_REBOOT },
{ "screensaveractive",SYSTEM_SCREENSAVER_ACTIVE },
{ "dpmsactive", SYSTEM_DPMS_ACTIVE },
{ "cputemperature", SYSTEM_CPU_TEMPERATURE }, // labels from here
{ "cpuusage", SYSTEM_CPU_USAGE },
{ "gputemperature", SYSTEM_GPU_TEMPERATURE },
{ "fanspeed", SYSTEM_FAN_SPEED },
{ "freespace", SYSTEM_FREE_SPACE },
{ "usedspace", SYSTEM_USED_SPACE },
{ "totalspace", SYSTEM_TOTAL_SPACE },
{ "usedspacepercent", SYSTEM_USED_SPACE_PERCENT },
{ "freespacepercent", SYSTEM_FREE_SPACE_PERCENT },
{ "buildversion", SYSTEM_BUILD_VERSION },
{ "buildversionshort",SYSTEM_BUILD_VERSION_SHORT },
{ "builddate", SYSTEM_BUILD_DATE },
{ "fps", SYSTEM_FPS },
{ "dvdtraystate", SYSTEM_DVD_TRAY_STATE },
{ "freememory", SYSTEM_FREE_MEMORY },
{ "language", SYSTEM_LANGUAGE },
{ "temperatureunits", SYSTEM_TEMPERATURE_UNITS },
{ "screenmode", SYSTEM_SCREEN_MODE },
{ "screenwidth", SYSTEM_SCREEN_WIDTH },
{ "screenheight", SYSTEM_SCREEN_HEIGHT },
{ "currentwindow", SYSTEM_CURRENT_WINDOW },
{ "currentcontrol", SYSTEM_CURRENT_CONTROL },
{ "dvdlabel", SYSTEM_DVD_LABEL },
{ "internetstate", SYSTEM_INTERNET_STATE },
{ "osversioninfo", SYSTEM_OS_VERSION_INFO },
{ "kernelversion", SYSTEM_OS_VERSION_INFO }, // old, not correct name
{ "uptime", SYSTEM_UPTIME },
{ "totaluptime", SYSTEM_TOTALUPTIME },
{ "cpufrequency", SYSTEM_CPUFREQUENCY },
{ "screenresolution", SYSTEM_SCREEN_RESOLUTION },
{ "videoencoderinfo", SYSTEM_VIDEO_ENCODER_INFO },
{ "profilename", SYSTEM_PROFILENAME },
{ "profilethumb", SYSTEM_PROFILETHUMB },
{ "profilecount", SYSTEM_PROFILECOUNT },
{ "profileautologin", SYSTEM_PROFILEAUTOLOGIN },
{ "progressbar", SYSTEM_PROGRESS_BAR },
{ "batterylevel", SYSTEM_BATTERY_LEVEL },
{ "friendlyname", SYSTEM_FRIENDLY_NAME },
{ "alarmpos", SYSTEM_ALARM_POS },
{ "isinhibit", SYSTEM_ISINHIBIT },
{ "hasshutdown", SYSTEM_HAS_SHUTDOWN },
{ "haspvr", SYSTEM_HAS_PVR },
{ "startupwindow", SYSTEM_STARTUP_WINDOW },
{ "stereoscopicmode", SYSTEM_STEREOSCOPIC_MODE } };
const infomap system_param[] = {{ "hasalarm", SYSTEM_HAS_ALARM },
{ "hascoreid", SYSTEM_HAS_CORE_ID },
{ "setting", SYSTEM_SETTING },
{ "hasaddon", SYSTEM_HAS_ADDON },
{ "coreusage", SYSTEM_GET_CORE_USAGE }};
const infomap network_labels[] = {{ "isdhcp", NETWORK_IS_DHCP },
{ "ipaddress", NETWORK_IP_ADDRESS }, //labels from here
{ "linkstate", NETWORK_LINK_STATE },
{ "macaddress", NETWORK_MAC_ADDRESS },
{ "subnetmask", NETWORK_SUBNET_MASK },
{ "gatewayaddress", NETWORK_GATEWAY_ADDRESS },
{ "dns1address", NETWORK_DNS1_ADDRESS },
{ "dns2address", NETWORK_DNS2_ADDRESS },
{ "dhcpaddress", NETWORK_DHCP_ADDRESS }};
const infomap musicpartymode[] = {{ "enabled", MUSICPM_ENABLED },
{ "songsplayed", MUSICPM_SONGSPLAYED },
{ "matchingsongs", MUSICPM_MATCHINGSONGS },
{ "matchingsongspicked", MUSICPM_MATCHINGSONGSPICKED },
{ "matchingsongsleft", MUSICPM_MATCHINGSONGSLEFT },
{ "relaxedsongspicked",MUSICPM_RELAXEDSONGSPICKED },
{ "randomsongspicked", MUSICPM_RANDOMSONGSPICKED }};
const infomap musicplayer[] = {{ "title", MUSICPLAYER_TITLE },
{ "album", MUSICPLAYER_ALBUM },
{ "artist", MUSICPLAYER_ARTIST },
{ "albumartist", MUSICPLAYER_ALBUM_ARTIST },
{ "year", MUSICPLAYER_YEAR },
{ "genre", MUSICPLAYER_GENRE },
{ "duration", MUSICPLAYER_DURATION },
{ "tracknumber", MUSICPLAYER_TRACK_NUMBER },
{ "cover", MUSICPLAYER_COVER },
{ "bitrate", MUSICPLAYER_BITRATE },
{ "playlistlength", MUSICPLAYER_PLAYLISTLEN },
{ "playlistposition", MUSICPLAYER_PLAYLISTPOS },
{ "channels", MUSICPLAYER_CHANNELS },
{ "bitspersample", MUSICPLAYER_BITSPERSAMPLE },
{ "samplerate", MUSICPLAYER_SAMPLERATE },
{ "codec", MUSICPLAYER_CODEC },
{ "discnumber", MUSICPLAYER_DISC_NUMBER },
{ "rating", MUSICPLAYER_RATING },
{ "comment", MUSICPLAYER_COMMENT },
{ "lyrics", MUSICPLAYER_LYRICS },
{ "playlistplaying", MUSICPLAYER_PLAYLISTPLAYING },
{ "exists", MUSICPLAYER_EXISTS },
{ "hasprevious", MUSICPLAYER_HASPREVIOUS },
{ "hasnext", MUSICPLAYER_HASNEXT },
{ "playcount", MUSICPLAYER_PLAYCOUNT },
{ "lastplayed", MUSICPLAYER_LASTPLAYED },
{ "channelname", MUSICPLAYER_CHANNEL_NAME },
{ "channelnumber", MUSICPLAYER_CHANNEL_NUMBER },
{ "subchannelnumber", MUSICPLAYER_SUB_CHANNEL_NUMBER },
{ "channelnumberlabel", MUSICPLAYER_CHANNEL_NUMBER_LBL },
{ "channelgroup", MUSICPLAYER_CHANNEL_GROUP }
};
const infomap videoplayer[] = {{ "title", VIDEOPLAYER_TITLE },
{ "genre", VIDEOPLAYER_GENRE },
{ "country", VIDEOPLAYER_COUNTRY },
{ "originaltitle", VIDEOPLAYER_ORIGINALTITLE },
{ "director", VIDEOPLAYER_DIRECTOR },
{ "year", VIDEOPLAYER_YEAR },
{ "cover", VIDEOPLAYER_COVER },
{ "usingoverlays", VIDEOPLAYER_USING_OVERLAYS },
{ "isfullscreen", VIDEOPLAYER_ISFULLSCREEN },
{ "hasmenu", VIDEOPLAYER_HASMENU },
{ "playlistlength", VIDEOPLAYER_PLAYLISTLEN },
{ "playlistposition", VIDEOPLAYER_PLAYLISTPOS },
{ "plot", VIDEOPLAYER_PLOT },
{ "plotoutline", VIDEOPLAYER_PLOT_OUTLINE },
{ "episode", VIDEOPLAYER_EPISODE },
{ "season", VIDEOPLAYER_SEASON },
{ "rating", VIDEOPLAYER_RATING },
{ "ratingandvotes", VIDEOPLAYER_RATING_AND_VOTES },
{ "votes", VIDEOPLAYER_VOTES },
{ "tvshowtitle", VIDEOPLAYER_TVSHOW },
{ "premiered", VIDEOPLAYER_PREMIERED },
{ "studio", VIDEOPLAYER_STUDIO },
{ "mpaa", VIDEOPLAYER_MPAA },
{ "top250", VIDEOPLAYER_TOP250 },
{ "cast", VIDEOPLAYER_CAST },
{ "castandrole", VIDEOPLAYER_CAST_AND_ROLE },
{ "artist", VIDEOPLAYER_ARTIST },
{ "album", VIDEOPLAYER_ALBUM },
{ "writer", VIDEOPLAYER_WRITER },
{ "tagline", VIDEOPLAYER_TAGLINE },
{ "hasinfo", VIDEOPLAYER_HAS_INFO },
{ "trailer", VIDEOPLAYER_TRAILER },
{ "videocodec", VIDEOPLAYER_VIDEO_CODEC },
{ "videoresolution", VIDEOPLAYER_VIDEO_RESOLUTION },
{ "videoaspect", VIDEOPLAYER_VIDEO_ASPECT },
{ "audiocodec", VIDEOPLAYER_AUDIO_CODEC },
{ "audiochannels", VIDEOPLAYER_AUDIO_CHANNELS },
{ "audiolanguage", VIDEOPLAYER_AUDIO_LANG },
{ "hasteletext", VIDEOPLAYER_HASTELETEXT },
{ "lastplayed", VIDEOPLAYER_LASTPLAYED },
{ "playcount", VIDEOPLAYER_PLAYCOUNT },
{ "hassubtitles", VIDEOPLAYER_HASSUBTITLES },
{ "subtitlesenabled", VIDEOPLAYER_SUBTITLESENABLED },
{ "subtitleslanguage",VIDEOPLAYER_SUBTITLES_LANG },
{ "endtime", VIDEOPLAYER_ENDTIME },
{ "nexttitle", VIDEOPLAYER_NEXT_TITLE },
{ "nextgenre", VIDEOPLAYER_NEXT_GENRE },
{ "nextplot", VIDEOPLAYER_NEXT_PLOT },
{ "nextplotoutline", VIDEOPLAYER_NEXT_PLOT_OUTLINE },
{ "nextstarttime", VIDEOPLAYER_NEXT_STARTTIME },
{ "nextendtime", VIDEOPLAYER_NEXT_ENDTIME },
{ "nextduration", VIDEOPLAYER_NEXT_DURATION },
{ "channelname", VIDEOPLAYER_CHANNEL_NAME },
{ "channelnumber", VIDEOPLAYER_CHANNEL_NUMBER },
{ "subchannelnumber", VIDEOPLAYER_SUB_CHANNEL_NUMBER },
{ "channelnumberlabel", VIDEOPLAYER_CHANNEL_NUMBER_LBL },
{ "channelgroup", VIDEOPLAYER_CHANNEL_GROUP },
{ "hasepg", VIDEOPLAYER_HAS_EPG },
{ "parentalrating", VIDEOPLAYER_PARENTAL_RATING },
{ "isstereoscopic", VIDEOPLAYER_IS_STEREOSCOPIC },
{ "stereoscopicmode", VIDEOPLAYER_STEREOSCOPIC_MODE }
};
const infomap mediacontainer[] = {{ "hasfiles", CONTAINER_HASFILES },
{ "hasfolders", CONTAINER_HASFOLDERS },
{ "isstacked", CONTAINER_STACKED },
{ "folderthumb", CONTAINER_FOLDERTHUMB },
{ "tvshowthumb", CONTAINER_TVSHOWTHUMB },
{ "seasonthumb", CONTAINER_SEASONTHUMB },
{ "folderpath", CONTAINER_FOLDERPATH },
{ "foldername", CONTAINER_FOLDERNAME },
{ "pluginname", CONTAINER_PLUGINNAME },
{ "viewmode", CONTAINER_VIEWMODE },
{ "totaltime", CONTAINER_TOTALTIME },
{ "hasthumb", CONTAINER_HAS_THUMB },
{ "sortmethod", CONTAINER_SORT_METHOD },
{ "showplot", CONTAINER_SHOWPLOT }};
const infomap container_bools[] ={{ "onnext", CONTAINER_MOVE_NEXT },
{ "onprevious", CONTAINER_MOVE_PREVIOUS },
{ "onscrollnext", CONTAINER_SCROLL_NEXT },
{ "onscrollprevious", CONTAINER_SCROLL_PREVIOUS },
{ "numpages", CONTAINER_NUM_PAGES },
{ "numitems", CONTAINER_NUM_ITEMS },
{ "currentpage", CONTAINER_CURRENT_PAGE },
{ "scrolling", CONTAINER_SCROLLING },
{ "hasnext", CONTAINER_HAS_NEXT },
{ "hasprevious", CONTAINER_HAS_PREVIOUS },
{ "canfilter", CONTAINER_CAN_FILTER },
{ "canfilteradvanced",CONTAINER_CAN_FILTERADVANCED },
{ "filtered", CONTAINER_FILTERED },
{ "isupdating", CONTAINER_ISUPDATING }};
const infomap container_ints[] = {{ "row", CONTAINER_ROW },
{ "column", CONTAINER_COLUMN },
{ "position", CONTAINER_POSITION },
{ "subitem", CONTAINER_SUBITEM },
{ "hasfocus", CONTAINER_HAS_FOCUS }};
const infomap container_str[] = {{ "property", CONTAINER_PROPERTY },
{ "content", CONTAINER_CONTENT }};
const infomap listitem_labels[]= {{ "thumb", LISTITEM_THUMB },
{ "icon", LISTITEM_ICON },
{ "actualicon", LISTITEM_ACTUAL_ICON },
{ "overlay", LISTITEM_OVERLAY },
{ "label", LISTITEM_LABEL },
{ "label2", LISTITEM_LABEL2 },
{ "title", LISTITEM_TITLE },
{ "tracknumber", LISTITEM_TRACKNUMBER },
{ "artist", LISTITEM_ARTIST },
{ "album", LISTITEM_ALBUM },
{ "albumartist", LISTITEM_ALBUM_ARTIST },
{ "year", LISTITEM_YEAR },
{ "genre", LISTITEM_GENRE },
{ "director", LISTITEM_DIRECTOR },
{ "filename", LISTITEM_FILENAME },
{ "filenameandpath", LISTITEM_FILENAME_AND_PATH },
{ "fileextension", LISTITEM_FILE_EXTENSION },
{ "date", LISTITEM_DATE },
{ "size", LISTITEM_SIZE },
{ "rating", LISTITEM_RATING },
{ "ratingandvotes", LISTITEM_RATING_AND_VOTES },
{ "votes", LISTITEM_VOTES },
{ "programcount", LISTITEM_PROGRAM_COUNT },
{ "duration", LISTITEM_DURATION },
{ "isselected", LISTITEM_ISSELECTED },
{ "isplaying", LISTITEM_ISPLAYING },
{ "plot", LISTITEM_PLOT },
{ "plotoutline", LISTITEM_PLOT_OUTLINE },
{ "episode", LISTITEM_EPISODE },
{ "season", LISTITEM_SEASON },
{ "tvshowtitle", LISTITEM_TVSHOW },
{ "premiered", LISTITEM_PREMIERED },
{ "comment", LISTITEM_COMMENT },
{ "path", LISTITEM_PATH },
{ "foldername", LISTITEM_FOLDERNAME },
{ "folderpath", LISTITEM_FOLDERPATH },
{ "picturepath", LISTITEM_PICTURE_PATH },
{ "pictureresolution",LISTITEM_PICTURE_RESOLUTION },
{ "picturedatetime", LISTITEM_PICTURE_DATETIME },
{ "picturedate", LISTITEM_PICTURE_DATE },
{ "picturelongdatetime",LISTITEM_PICTURE_LONGDATETIME },
{ "picturelongdate", LISTITEM_PICTURE_LONGDATE },
{ "picturecomment", LISTITEM_PICTURE_COMMENT },
{ "picturecaption", LISTITEM_PICTURE_CAPTION },
{ "picturedesc", LISTITEM_PICTURE_DESC },
{ "picturekeywords", LISTITEM_PICTURE_KEYWORDS },
{ "picturecammake", LISTITEM_PICTURE_CAM_MAKE },
{ "picturecammodel", LISTITEM_PICTURE_CAM_MODEL },
{ "pictureaperture", LISTITEM_PICTURE_APERTURE },
{ "picturefocallen", LISTITEM_PICTURE_FOCAL_LEN },
{ "picturefocusdist", LISTITEM_PICTURE_FOCUS_DIST },
{ "pictureexpmode", LISTITEM_PICTURE_EXP_MODE },
{ "pictureexptime", LISTITEM_PICTURE_EXP_TIME },
{ "pictureiso", LISTITEM_PICTURE_ISO },
{ "pictureauthor", LISTITEM_PICTURE_AUTHOR },
{ "picturebyline", LISTITEM_PICTURE_BYLINE },
{ "picturebylinetitle", LISTITEM_PICTURE_BYLINE_TITLE },
{ "picturecategory", LISTITEM_PICTURE_CATEGORY },
{ "pictureccdwidth", LISTITEM_PICTURE_CCD_WIDTH },
{ "picturecity", LISTITEM_PICTURE_CITY },
{ "pictureurgency", LISTITEM_PICTURE_URGENCY },
{ "picturecopyrightnotice", LISTITEM_PICTURE_COPYRIGHT_NOTICE },
{ "picturecountry", LISTITEM_PICTURE_COUNTRY },
{ "picturecountrycode", LISTITEM_PICTURE_COUNTRY_CODE },
{ "picturecredit", LISTITEM_PICTURE_CREDIT },
{ "pictureiptcdate", LISTITEM_PICTURE_IPTCDATE },
{ "picturedigitalzoom", LISTITEM_PICTURE_DIGITAL_ZOOM },
{ "pictureexposure", LISTITEM_PICTURE_EXPOSURE },
{ "pictureexposurebias", LISTITEM_PICTURE_EXPOSURE_BIAS },
{ "pictureflashused", LISTITEM_PICTURE_FLASH_USED },
{ "pictureheadline", LISTITEM_PICTURE_HEADLINE },
{ "picturecolour", LISTITEM_PICTURE_COLOUR },
{ "picturelightsource", LISTITEM_PICTURE_LIGHT_SOURCE },
{ "picturemeteringmode", LISTITEM_PICTURE_METERING_MODE },
{ "pictureobjectname", LISTITEM_PICTURE_OBJECT_NAME },
{ "pictureorientation", LISTITEM_PICTURE_ORIENTATION },
{ "pictureprocess", LISTITEM_PICTURE_PROCESS },
{ "picturereferenceservice", LISTITEM_PICTURE_REF_SERVICE },
{ "picturesource", LISTITEM_PICTURE_SOURCE },
{ "picturespecialinstructions", LISTITEM_PICTURE_SPEC_INSTR },
{ "picturestate", LISTITEM_PICTURE_STATE },
{ "picturesupplementalcategories", LISTITEM_PICTURE_SUP_CATEGORIES },
{ "picturetransmissionreference", LISTITEM_PICTURE_TX_REFERENCE },
{ "picturewhitebalance", LISTITEM_PICTURE_WHITE_BALANCE },
{ "pictureimagetype", LISTITEM_PICTURE_IMAGETYPE },
{ "picturesublocation", LISTITEM_PICTURE_SUBLOCATION },
{ "pictureiptctime", LISTITEM_PICTURE_TIMECREATED },
{ "picturegpslat", LISTITEM_PICTURE_GPS_LAT },
{ "picturegpslon", LISTITEM_PICTURE_GPS_LON },
{ "picturegpsalt", LISTITEM_PICTURE_GPS_ALT },
{ "studio", LISTITEM_STUDIO },
{ "country", LISTITEM_COUNTRY },
{ "mpaa", LISTITEM_MPAA },
{ "cast", LISTITEM_CAST },
{ "castandrole", LISTITEM_CAST_AND_ROLE },
{ "writer", LISTITEM_WRITER },
{ "tagline", LISTITEM_TAGLINE },
{ "top250", LISTITEM_TOP250 },
{ "trailer", LISTITEM_TRAILER },
{ "starrating", LISTITEM_STAR_RATING },
{ "sortletter", LISTITEM_SORT_LETTER },
{ "videocodec", LISTITEM_VIDEO_CODEC },
{ "videoresolution", LISTITEM_VIDEO_RESOLUTION },
{ "videoaspect", LISTITEM_VIDEO_ASPECT },
{ "audiocodec", LISTITEM_AUDIO_CODEC },
{ "audiochannels", LISTITEM_AUDIO_CHANNELS },
{ "audiolanguage", LISTITEM_AUDIO_LANGUAGE },
{ "subtitlelanguage", LISTITEM_SUBTITLE_LANGUAGE },
{ "isresumable", LISTITEM_IS_RESUMABLE},
{ "percentplayed", LISTITEM_PERCENT_PLAYED},
{ "isfolder", LISTITEM_IS_FOLDER },
{ "originaltitle", LISTITEM_ORIGINALTITLE },
{ "lastplayed", LISTITEM_LASTPLAYED },
{ "playcount", LISTITEM_PLAYCOUNT },
{ "discnumber", LISTITEM_DISC_NUMBER },
{ "starttime", LISTITEM_STARTTIME },
{ "endtime", LISTITEM_ENDTIME },
{ "startdate", LISTITEM_STARTDATE },
{ "enddate", LISTITEM_ENDDATE },
{ "nexttitle", LISTITEM_NEXT_TITLE },
{ "nextgenre", LISTITEM_NEXT_GENRE },
{ "nextplot", LISTITEM_NEXT_PLOT },
{ "nextplotoutline", LISTITEM_NEXT_PLOT_OUTLINE },
{ "nextstarttime", LISTITEM_NEXT_STARTTIME },
{ "nextendtime", LISTITEM_NEXT_ENDTIME },
{ "nextstartdate", LISTITEM_NEXT_STARTDATE },
{ "nextenddate", LISTITEM_NEXT_ENDDATE },
{ "channelname", LISTITEM_CHANNEL_NAME },
{ "channelnumber", LISTITEM_CHANNEL_NUMBER },
{ "subchannelnumber", LISTITEM_SUB_CHANNEL_NUMBER },
{ "channelnumberlabel", LISTITEM_CHANNEL_NUMBER_LBL },
{ "channelgroup", LISTITEM_CHANNEL_GROUP },
{ "hasepg", LISTITEM_HAS_EPG },
{ "hastimer", LISTITEM_HASTIMER },
{ "hasrecording", LISTITEM_HASRECORDING },
{ "isrecording", LISTITEM_ISRECORDING },
{ "inprogress", LISTITEM_INPROGRESS },
{ "isencrypted", LISTITEM_ISENCRYPTED },
{ "progress", LISTITEM_PROGRESS },
{ "dateadded", LISTITEM_DATE_ADDED },
{ "dbtype", LISTITEM_DBTYPE },
{ "dbid", LISTITEM_DBID },
{ "stereoscopicmode", LISTITEM_STEREOSCOPIC_MODE },
{ "isstereoscopic", LISTITEM_IS_STEREOSCOPIC }};
const infomap visualisation[] = {{ "locked", VISUALISATION_LOCKED },
{ "preset", VISUALISATION_PRESET },
{ "name", VISUALISATION_NAME },
{ "enabled", VISUALISATION_ENABLED }};
const infomap fanart_labels[] = {{ "color1", FANART_COLOR1 },
{ "color2", FANART_COLOR2 },
{ "color3", FANART_COLOR3 },
{ "image", FANART_IMAGE }};
const infomap skin_labels[] = {{ "currenttheme", SKIN_THEME },
{ "currentcolourtheme",SKIN_COLOUR_THEME },
{"hasvideooverlay", SKIN_HAS_VIDEO_OVERLAY},
{"hasmusicoverlay", SKIN_HAS_MUSIC_OVERLAY},
{"aspectratio", SKIN_ASPECT_RATIO}};
const infomap window_bools[] = {{ "ismedia", WINDOW_IS_MEDIA },
{ "isactive", WINDOW_IS_ACTIVE },
{ "istopmost", WINDOW_IS_TOPMOST },
{ "isvisible", WINDOW_IS_VISIBLE },
{ "previous", WINDOW_PREVIOUS },
{ "next", WINDOW_NEXT }};
const infomap control_labels[] = {{ "hasfocus", CONTROL_HAS_FOCUS },
{ "isvisible", CONTROL_IS_VISIBLE },
{ "isenabled", CONTROL_IS_ENABLED },
{ "getlabel", CONTROL_GET_LABEL }};
const infomap playlist[] = {{ "length", PLAYLIST_LENGTH },
{ "position", PLAYLIST_POSITION },
{ "random", PLAYLIST_RANDOM },
{ "repeat", PLAYLIST_REPEAT },
{ "israndom", PLAYLIST_ISRANDOM },
{ "isrepeat", PLAYLIST_ISREPEAT },
{ "isrepeatone", PLAYLIST_ISREPEATONE }};
const infomap pvr[] = {{ "isrecording", PVR_IS_RECORDING },
{ "hastimer", PVR_HAS_TIMER },
{ "hastvchannels", PVR_HAS_TV_CHANNELS },
{ "hasradiochannels", PVR_HAS_RADIO_CHANNELS },
{ "hasnonrecordingtimer", PVR_HAS_NONRECORDING_TIMER },
{ "nowrecordingtitle", PVR_NOW_RECORDING_TITLE },
{ "nowrecordingdatetime", PVR_NOW_RECORDING_DATETIME },
{ "nowrecordingchannel", PVR_NOW_RECORDING_CHANNEL },
{ "nowrecordingchannelicon", PVR_NOW_RECORDING_CHAN_ICO },
{ "nextrecordingtitle", PVR_NEXT_RECORDING_TITLE },
{ "nextrecordingdatetime", PVR_NEXT_RECORDING_DATETIME },
{ "nextrecordingchannel", PVR_NEXT_RECORDING_CHANNEL },
{ "nextrecordingchannelicon", PVR_NEXT_RECORDING_CHAN_ICO },
{ "backendname", PVR_BACKEND_NAME },
{ "backendversion", PVR_BACKEND_VERSION },
{ "backendhost", PVR_BACKEND_HOST },
{ "backenddiskspace", PVR_BACKEND_DISKSPACE },
{ "backenddiskspaceprogr", PVR_BACKEND_DISKSPACE_PROGR },
{ "backendchannels", PVR_BACKEND_CHANNELS },
{ "backendtimers", PVR_BACKEND_TIMERS },
{ "backendrecordings", PVR_BACKEND_RECORDINGS },
{ "backendnumber", PVR_BACKEND_NUMBER },
{ "hasepg", PVR_HAS_EPG },
{ "hastxt", PVR_HAS_TXT },
{ "hasdirector", PVR_HAS_DIRECTOR },
{ "totaldiscspace", PVR_TOTAL_DISKSPACE },
{ "nexttimer", PVR_NEXT_TIMER },
{ "isplayingtv", PVR_IS_PLAYING_TV },
{ "isplayingradio", PVR_IS_PLAYING_RADIO },
{ "isplayingrecording", PVR_IS_PLAYING_RECORDING },
{ "duration", PVR_PLAYING_DURATION },
{ "time", PVR_PLAYING_TIME },
{ "progress", PVR_PLAYING_PROGRESS },
{ "actstreamclient", PVR_ACTUAL_STREAM_CLIENT },
{ "actstreamdevice", PVR_ACTUAL_STREAM_DEVICE },
{ "actstreamstatus", PVR_ACTUAL_STREAM_STATUS },
{ "actstreamsignal", PVR_ACTUAL_STREAM_SIG },
{ "actstreamsnr", PVR_ACTUAL_STREAM_SNR },
{ "actstreamber", PVR_ACTUAL_STREAM_BER },
{ "actstreamunc", PVR_ACTUAL_STREAM_UNC },
{ "actstreamvideobitrate", PVR_ACTUAL_STREAM_VIDEO_BR },
{ "actstreamaudiobitrate", PVR_ACTUAL_STREAM_AUDIO_BR },
{ "actstreamdolbybitrate", PVR_ACTUAL_STREAM_DOLBY_BR },
{ "actstreamprogrsignal", PVR_ACTUAL_STREAM_SIG_PROGR },
{ "actstreamprogrsnr", PVR_ACTUAL_STREAM_SNR_PROGR },
{ "actstreamisencrypted", PVR_ACTUAL_STREAM_ENCRYPTED },
{ "actstreamencryptionname", PVR_ACTUAL_STREAM_CRYPTION },
{ "actstreamservicename", PVR_ACTUAL_STREAM_SERVICE },
{ "actstreammux", PVR_ACTUAL_STREAM_MUX },
{ "actstreamprovidername", PVR_ACTUAL_STREAM_PROVIDER }};
const infomap slideshow[] = {{ "ispaused", SLIDESHOW_ISPAUSED },
{ "isactive", SLIDESHOW_ISACTIVE },
{ "isvideo", SLIDESHOW_ISVIDEO },
{ "israndom", SLIDESHOW_ISRANDOM }};
const int picture_slide_map[] = {/* LISTITEM_PICTURE_RESOLUTION => */ SLIDE_RESOLUTION,
/* LISTITEM_PICTURE_LONGDATE => */ SLIDE_EXIF_LONG_DATE,
/* LISTITEM_PICTURE_LONGDATETIME => */ SLIDE_EXIF_LONG_DATE_TIME,
/* LISTITEM_PICTURE_DATE => */ SLIDE_EXIF_DATE,
/* LISTITEM_PICTURE_DATETIME => */ SLIDE_EXIF_DATE_TIME,
/* LISTITEM_PICTURE_COMMENT => */ SLIDE_COMMENT,
/* LISTITEM_PICTURE_CAPTION => */ SLIDE_IPTC_CAPTION,
/* LISTITEM_PICTURE_DESC => */ SLIDE_EXIF_DESCRIPTION,
/* LISTITEM_PICTURE_KEYWORDS => */ SLIDE_IPTC_KEYWORDS,
/* LISTITEM_PICTURE_CAM_MAKE => */ SLIDE_EXIF_CAMERA_MAKE,
/* LISTITEM_PICTURE_CAM_MODEL => */ SLIDE_EXIF_CAMERA_MODEL,
/* LISTITEM_PICTURE_APERTURE => */ SLIDE_EXIF_APERTURE,
/* LISTITEM_PICTURE_FOCAL_LEN => */ SLIDE_EXIF_FOCAL_LENGTH,
/* LISTITEM_PICTURE_FOCUS_DIST => */ SLIDE_EXIF_FOCUS_DIST,
/* LISTITEM_PICTURE_EXP_MODE => */ SLIDE_EXIF_EXPOSURE_MODE,
/* LISTITEM_PICTURE_EXP_TIME => */ SLIDE_EXIF_EXPOSURE_TIME,
/* LISTITEM_PICTURE_ISO => */ SLIDE_EXIF_ISO_EQUIV,
/* LISTITEM_PICTURE_AUTHOR => */ SLIDE_IPTC_AUTHOR,
/* LISTITEM_PICTURE_BYLINE => */ SLIDE_IPTC_BYLINE,
/* LISTITEM_PICTURE_BYLINE_TITLE => */ SLIDE_IPTC_BYLINE_TITLE,
/* LISTITEM_PICTURE_CATEGORY => */ SLIDE_IPTC_CATEGORY,
/* LISTITEM_PICTURE_CCD_WIDTH => */ SLIDE_EXIF_CCD_WIDTH,
/* LISTITEM_PICTURE_CITY => */ SLIDE_IPTC_CITY,
/* LISTITEM_PICTURE_URGENCY => */ SLIDE_IPTC_URGENCY,
/* LISTITEM_PICTURE_COPYRIGHT_NOTICE => */ SLIDE_IPTC_COPYRIGHT_NOTICE,
/* LISTITEM_PICTURE_COUNTRY => */ SLIDE_IPTC_COUNTRY,
/* LISTITEM_PICTURE_COUNTRY_CODE => */ SLIDE_IPTC_COUNTRY_CODE,
/* LISTITEM_PICTURE_CREDIT => */ SLIDE_IPTC_CREDIT,
/* LISTITEM_PICTURE_IPTCDATE => */ SLIDE_IPTC_DATE,
/* LISTITEM_PICTURE_DIGITAL_ZOOM => */ SLIDE_EXIF_DIGITAL_ZOOM,
/* LISTITEM_PICTURE_EXPOSURE => */ SLIDE_EXIF_EXPOSURE,
/* LISTITEM_PICTURE_EXPOSURE_BIAS => */ SLIDE_EXIF_EXPOSURE_BIAS,
/* LISTITEM_PICTURE_FLASH_USED => */ SLIDE_EXIF_FLASH_USED,
/* LISTITEM_PICTURE_HEADLINE => */ SLIDE_IPTC_HEADLINE,
/* LISTITEM_PICTURE_COLOUR => */ SLIDE_COLOUR,
/* LISTITEM_PICTURE_LIGHT_SOURCE => */ SLIDE_EXIF_LIGHT_SOURCE,
/* LISTITEM_PICTURE_METERING_MODE => */ SLIDE_EXIF_METERING_MODE,
/* LISTITEM_PICTURE_OBJECT_NAME => */ SLIDE_IPTC_OBJECT_NAME,
/* LISTITEM_PICTURE_ORIENTATION => */ SLIDE_EXIF_ORIENTATION,
/* LISTITEM_PICTURE_PROCESS => */ SLIDE_PROCESS,
/* LISTITEM_PICTURE_REF_SERVICE => */ SLIDE_IPTC_REF_SERVICE,
/* LISTITEM_PICTURE_SOURCE => */ SLIDE_IPTC_SOURCE,
/* LISTITEM_PICTURE_SPEC_INSTR => */ SLIDE_IPTC_SPEC_INSTR,
/* LISTITEM_PICTURE_STATE => */ SLIDE_IPTC_STATE,
/* LISTITEM_PICTURE_SUP_CATEGORIES => */ SLIDE_IPTC_SUP_CATEGORIES,
/* LISTITEM_PICTURE_TX_REFERENCE => */ SLIDE_IPTC_TX_REFERENCE,
/* LISTITEM_PICTURE_WHITE_BALANCE => */ SLIDE_EXIF_WHITE_BALANCE,
/* LISTITEM_PICTURE_IMAGETYPE => */ SLIDE_IPTC_IMAGETYPE,
/* LISTITEM_PICTURE_SUBLOCATION => */ SLIDE_IPTC_SUBLOCATION,
/* LISTITEM_PICTURE_TIMECREATED => */ SLIDE_IPTC_TIMECREATED,
/* LISTITEM_PICTURE_GPS_LAT => */ SLIDE_EXIF_GPS_LATITUDE,
/* LISTITEM_PICTURE_GPS_LON => */ SLIDE_EXIF_GPS_LONGITUDE,
/* LISTITEM_PICTURE_GPS_ALT => */ SLIDE_EXIF_GPS_ALTITUDE };
CGUIInfoManager::Property::Property(const CStdString &property, const CStdString ¶meters)
: name(property)
{
CUtil::SplitParams(parameters, params);
}
const std::string &CGUIInfoManager::Property::param(unsigned int n /* = 0 */) const
{
if (n < params.size())
return params[n];
return StringUtils::Empty;
}
unsigned int CGUIInfoManager::Property::num_params() const
{
return params.size();
}
void CGUIInfoManager::SplitInfoString(const CStdString &infoString, vector<Property> &info)
{
// our string is of the form:
// category[(params)][.info(params).info2(params)] ...
// so we need to split on . while taking into account of () pairs
unsigned int parentheses = 0;
CStdString property;
CStdString param;
for (size_t i = 0; i < infoString.size(); ++i)
{
if (infoString[i] == '(')
{
if (!parentheses++)
continue;
}
else if (infoString[i] == ')')
{
if (!parentheses)
CLog::Log(LOGERROR, "unmatched parentheses in %s", infoString.c_str());
else if (!--parentheses)
continue;
}
else if (infoString[i] == '.' && !parentheses)
{
if (!property.empty()) // add our property and parameters
{
StringUtils::ToLower(property);
info.push_back(Property(property, param));
}
property.clear();
param.clear();
continue;
}
if (parentheses)
param += infoString[i];
else
property += infoString[i];
}
if (parentheses)
CLog::Log(LOGERROR, "unmatched parentheses in %s", infoString.c_str());
if (!property.empty())
{
StringUtils::ToLower(property);
info.push_back(Property(property, param));
}
}
/// \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)
{
bool listItemDependent;
return TranslateSingleString(strCondition, listItemDependent);
}
int CGUIInfoManager::TranslateSingleString(const CStdString &strCondition, bool &listItemDependent)
{
/* We need to disable caching in INFO::InfoBool::Get if either of the following are true:
* 1. if condition is between LISTITEM_START and LISTITEM_END
* 2. if condition is STRING_IS_EMPTY, STRING_COMPARE, STRING_STR, INTEGER_GREATER_THAN and the
* corresponding label is between LISTITEM_START and LISTITEM_END
* This is achieved by setting the bool pointed at by listItemDependent, either here or in a recursive call
*/
// trim whitespaces
CStdString strTest = strCondition;
StringUtils::Trim(strTest);
vector< Property> info;
SplitInfoString(strTest, info);
if (info.empty())
return 0;
const Property &cat = info[0];
if (info.size() == 1)
{ // single category
if (cat.name == "false" || cat.name == "no" || cat.name == "off")
return SYSTEM_ALWAYS_FALSE;
else if (cat.name == "true" || cat.name == "yes" || cat.name == "on")
return SYSTEM_ALWAYS_TRUE;
if (cat.name == "isempty" && cat.num_params() == 1)
return AddMultiInfo(GUIInfo(STRING_IS_EMPTY, TranslateSingleString(cat.param(), listItemDependent)));
else if (cat.name == "stringcompare" && cat.num_params() == 2)
{
int info = TranslateSingleString(cat.param(0), listItemDependent);
int info2 = TranslateSingleString(cat.param(1), listItemDependent);
if (info2 > 0)
return AddMultiInfo(GUIInfo(STRING_COMPARE, info, -info2));
// pipe our original string through the localize parsing then make it lowercase (picks up $LBRACKET etc.)
CStdString label = CGUIInfoLabel::GetLabel(cat.param(1));
StringUtils::ToLower(label);
int compareString = ConditionalStringParameter(label);
return AddMultiInfo(GUIInfo(STRING_COMPARE, info, compareString));
}
else if (cat.name == "integergreaterthan" && cat.num_params() == 2)
{
int info = TranslateSingleString(cat.param(0), listItemDependent);
int compareInt = atoi(cat.param(1).c_str());
return AddMultiInfo(GUIInfo(INTEGER_GREATER_THAN, info, compareInt));
}
else if (cat.name == "substring" && cat.num_params() >= 2)
{
int info = TranslateSingleString(cat.param(0), listItemDependent);
CStdString label = CGUIInfoLabel::GetLabel(cat.param(1));
StringUtils::ToLower(label);
int compareString = ConditionalStringParameter(label);
if (cat.num_params() > 2)
{
if (StringUtils::EqualsNoCase(cat.param(2), "left"))
return AddMultiInfo(GUIInfo(STRING_STR_LEFT, info, compareString));
else if (StringUtils::EqualsNoCase(cat.param(2), "right"))
return AddMultiInfo(GUIInfo(STRING_STR_RIGHT, info, compareString));
}
return AddMultiInfo(GUIInfo(STRING_STR, info, compareString));
}
}
else if (info.size() == 2)
{
const Property &prop = info[1];
if (cat.name == "player")
{
for (size_t i = 0; i < sizeof(player_labels) / sizeof(infomap); i++)
{
if (prop.name == player_labels[i].str)
return player_labels[i].val;
}
for (size_t i = 0; i < sizeof(player_times) / sizeof(infomap); i++)
{
if (prop.name == player_times[i].str)
return AddMultiInfo(GUIInfo(player_times[i].val, TranslateTimeFormat(prop.param())));
}
if (prop.num_params() == 1)
{
for (size_t i = 0; i < sizeof(player_param) / sizeof(infomap); i++)
{
if (prop.name == player_param[i].str)
return AddMultiInfo(GUIInfo(player_param[i].val, ConditionalStringParameter(prop.param())));
}
}
}
else if (cat.name == "weather")
{
for (size_t i = 0; i < sizeof(weather) / sizeof(infomap); i++)
{
if (prop.name == weather[i].str)
return weather[i].val;
}
}
else if (cat.name == "network")
{
for (size_t i = 0; i < sizeof(network_labels) / sizeof(infomap); i++)
{
if (prop.name == network_labels[i].str)
return network_labels[i].val;
}
}
else if (cat.name == "musicpartymode")
{
for (size_t i = 0; i < sizeof(musicpartymode) / sizeof(infomap); i++)
{
if (prop.name == musicpartymode[i].str)
return musicpartymode[i].val;
}
}
else if (cat.name == "system")
{
for (size_t i = 0; i < sizeof(system_labels) / sizeof(infomap); i++)
{
if (prop.name == system_labels[i].str)
return system_labels[i].val;
}
if (prop.num_params() == 1)
{
const CStdString ¶m = prop.param();
if (prop.name == "getbool")
{
std::string paramCopy = param;
StringUtils::ToLower(paramCopy);
return AddMultiInfo(GUIInfo(SYSTEM_GET_BOOL, ConditionalStringParameter(paramCopy, true)));
}
for (size_t i = 0; i < sizeof(system_param) / sizeof(infomap); i++)
{
if (prop.name == system_param[i].str)
return AddMultiInfo(GUIInfo(system_param[i].val, ConditionalStringParameter(param)));
}
if (prop.name == "memory")
{
if (param == "free") return SYSTEM_FREE_MEMORY;
else if (param == "free.percent") return SYSTEM_FREE_MEMORY_PERCENT;
else if (param == "used") return SYSTEM_USED_MEMORY;
else if (param == "used.percent") return SYSTEM_USED_MEMORY_PERCENT;
else if (param == "total") return SYSTEM_TOTAL_MEMORY;
}
else if (prop.name == "addontitle")
{
int infoLabel = TranslateSingleString(param, listItemDependent);
if (infoLabel > 0)
return AddMultiInfo(GUIInfo(SYSTEM_ADDON_TITLE, infoLabel, 0));
CStdString label = CGUIInfoLabel::GetLabel(param);
StringUtils::ToLower(label);
return AddMultiInfo(GUIInfo(SYSTEM_ADDON_TITLE, ConditionalStringParameter(label), 1));
}
else if (prop.name == "addonicon")
{
int infoLabel = TranslateSingleString(param, listItemDependent);
if (infoLabel > 0)
return AddMultiInfo(GUIInfo(SYSTEM_ADDON_ICON, infoLabel, 0));
CStdString label = CGUIInfoLabel::GetLabel(param);
StringUtils::ToLower(label);
return AddMultiInfo(GUIInfo(SYSTEM_ADDON_ICON, ConditionalStringParameter(label), 1));
}
else if (prop.name == "addonversion")
{
int infoLabel = TranslateSingleString(param, listItemDependent);
if (infoLabel > 0)
return AddMultiInfo(GUIInfo(SYSTEM_ADDON_VERSION, infoLabel, 0));
CStdString label = CGUIInfoLabel::GetLabel(param);
StringUtils::ToLower(label);
return AddMultiInfo(GUIInfo(SYSTEM_ADDON_VERSION, ConditionalStringParameter(label), 1));
}
else if (prop.name == "idletime")
return AddMultiInfo(GUIInfo(SYSTEM_IDLE_TIME, atoi(param.c_str())));
}
if (prop.name == "alarmlessorequal" && prop.num_params() == 2)
return AddMultiInfo(GUIInfo(SYSTEM_ALARM_LESS_OR_EQUAL, ConditionalStringParameter(prop.param(0)), ConditionalStringParameter(prop.param(1))));
else if (prop.name == "date")
{
if (prop.num_params() == 2)
return AddMultiInfo(GUIInfo(SYSTEM_DATE, StringUtils::DateStringToYYYYMMDD(prop.param(0)) % 10000, StringUtils::DateStringToYYYYMMDD(prop.param(1)) % 10000));
else if (prop.num_params() == 1)
{
int dateformat = StringUtils::DateStringToYYYYMMDD(prop.param(0));
if (dateformat <= 0) // not concrete date
return AddMultiInfo(GUIInfo(SYSTEM_DATE, ConditionalStringParameter(prop.param(0), true), -1));
else
return AddMultiInfo(GUIInfo(SYSTEM_DATE, dateformat % 10000));
}
return SYSTEM_DATE;
}
else if (prop.name == "time")
{
if (prop.num_params() == 0)
return AddMultiInfo(GUIInfo(SYSTEM_TIME, TIME_FORMAT_GUESS));
if (prop.num_params() == 1)
{
TIME_FORMAT timeFormat = TranslateTimeFormat(prop.param(0));
if (timeFormat == TIME_FORMAT_GUESS)
return AddMultiInfo(GUIInfo(SYSTEM_TIME, StringUtils::TimeStringToSeconds(prop.param(0))));
return AddMultiInfo(GUIInfo(SYSTEM_TIME, timeFormat));
}
else
return AddMultiInfo(GUIInfo(SYSTEM_TIME, StringUtils::TimeStringToSeconds(prop.param(0)), StringUtils::TimeStringToSeconds(prop.param(1))));
}
}
else if (cat.name == "library")
{
if (prop.name == "isscanning") return LIBRARY_IS_SCANNING;
else if (prop.name == "isscanningvideo") return LIBRARY_IS_SCANNING_VIDEO; // TODO: change to IsScanning(Video)
else if (prop.name == "isscanningmusic") return LIBRARY_IS_SCANNING_MUSIC;
else if (prop.name == "hascontent" && prop.num_params())
{
CStdString cat = prop.param(0);
StringUtils::ToLower(cat);
if (cat == "music") return LIBRARY_HAS_MUSIC;
else if (cat == "video") return LIBRARY_HAS_VIDEO;
else if (cat == "movies") return LIBRARY_HAS_MOVIES;
else if (cat == "tvshows") return LIBRARY_HAS_TVSHOWS;
else if (cat == "musicvideos") return LIBRARY_HAS_MUSICVIDEOS;
else if (cat == "moviesets") return LIBRARY_HAS_MOVIE_SETS;
}
}
else if (cat.name == "musicplayer")
{
for (size_t i = 0; i < sizeof(player_times) / sizeof(infomap); i++) // TODO: remove these, they're repeats
{
if (prop.name == player_times[i].str)
return AddMultiInfo(GUIInfo(player_times[i].val, TranslateTimeFormat(prop.param())));
}
if (prop.name == "property")
{
// properties are stored case sensitive in m_listItemProperties, but lookup is insensitive in CGUIListItem::GetProperty
if (StringUtils::EqualsNoCase(prop.param(), "fanart_image"))
return AddMultiInfo(GUIInfo(PLAYER_ITEM_ART, ConditionalStringParameter("fanart")));
return AddListItemProp(prop.param(), MUSICPLAYER_PROPERTY_OFFSET);
}
return TranslateMusicPlayerString(prop.name);
}
else if (cat.name == "videoplayer")
{
for (size_t i = 0; i < sizeof(player_times) / sizeof(infomap); i++) // TODO: remove these, they're repeats
{
if (prop.name == player_times[i].str)
return AddMultiInfo(GUIInfo(player_times[i].val, TranslateTimeFormat(prop.param())));
}
if (prop.name == "content" && prop.num_params())
return AddMultiInfo(GUIInfo(VIDEOPLAYER_CONTENT, ConditionalStringParameter(prop.param()), 0));
for (size_t i = 0; i < sizeof(videoplayer) / sizeof(infomap); i++)
{
if (prop.name == videoplayer[i].str)
return videoplayer[i].val;
}
}
else if (cat.name == "slideshow")
{
for (size_t i = 0; i < sizeof(slideshow) / sizeof(infomap); i++)
{
if (prop.name == slideshow[i].str)
return slideshow[i].val;
}
return CPictureInfoTag::TranslateString(prop.name);
}
else if (cat.name == "container")
{
for (size_t i = 0; i < sizeof(mediacontainer) / sizeof(infomap); i++) // these ones don't have or need an id
{
if (prop.name == mediacontainer[i].str)
return mediacontainer[i].val;
}
int id = atoi(cat.param().c_str());
for (size_t i = 0; i < sizeof(container_bools) / sizeof(infomap); i++) // these ones can have an id (but don't need to?)
{
if (prop.name == container_bools[i].str)
return id ? AddMultiInfo(GUIInfo(container_bools[i].val, id)) : container_bools[i].val;
}
for (size_t i = 0; i < sizeof(container_ints) / sizeof(infomap); i++) // these ones can have an int param on the property
{
if (prop.name == container_ints[i].str)
return AddMultiInfo(GUIInfo(container_ints[i].val, id, atoi(prop.param().c_str())));
}
for (size_t i = 0; i < sizeof(container_str) / sizeof(infomap); i++) // these ones have a string param on the property
{
if (prop.name == container_str[i].str)
return AddMultiInfo(GUIInfo(container_str[i].val, id, ConditionalStringParameter(prop.param())));
}
if (prop.name == "sortdirection")
{
SortOrder order = SortOrderNone;
if (StringUtils::EqualsNoCase(prop.param(), "ascending"))
order = SortOrderAscending;
else if (StringUtils::EqualsNoCase(prop.param(), "descending"))
order = SortOrderDescending;
return AddMultiInfo(GUIInfo(CONTAINER_SORT_DIRECTION, order));
}
else if (prop.name == "sort")
{
if (StringUtils::EqualsNoCase(prop.param(), "songrating"))
return AddMultiInfo(GUIInfo(CONTAINER_SORT_METHOD, SortByRating));
}
}
else if (cat.name == "listitem")
{
int offset = atoi(cat.param().c_str());
int ret = TranslateListItem(prop);
if (ret)
listItemDependent = true;
if (offset)
return AddMultiInfo(GUIInfo(ret, 0, offset, INFOFLAG_LISTITEM_WRAP));
return ret;
}
else if (cat.name == "listitemposition")
{
int offset = atoi(cat.param().c_str());
int ret = TranslateListItem(prop);
if (ret)
listItemDependent = true;
if (offset)
return AddMultiInfo(GUIInfo(ret, 0, offset, INFOFLAG_LISTITEM_POSITION));
return ret;
}
else if (cat.name == "listitemnowrap")
{
int offset = atoi(cat.param().c_str());
int ret = TranslateListItem(prop);
if (ret)
listItemDependent = true;
if (offset)
return AddMultiInfo(GUIInfo(ret, 0, offset));
return ret;
}
else if (cat.name == "visualisation")
{
for (size_t i = 0; i < sizeof(visualisation) / sizeof(infomap); i++)
{
if (prop.name == visualisation[i].str)
return visualisation[i].val;
}
}
else if (cat.name == "fanart")
{
for (size_t i = 0; i < sizeof(fanart_labels) / sizeof(infomap); i++)
{
if (prop.name == fanart_labels[i].str)
return fanart_labels[i].val;
}
}
else if (cat.name == "skin")
{
for (size_t i = 0; i < sizeof(skin_labels) / sizeof(infomap); i++)
{
if (prop.name == skin_labels[i].str)
return skin_labels[i].val;
}
if (prop.num_params())
{
if (prop.name == "string")
{
if (prop.num_params() == 2)
return AddMultiInfo(GUIInfo(SKIN_STRING, CSkinSettings::Get().TranslateString(prop.param(0)), ConditionalStringParameter(prop.param(1))));
else
return AddMultiInfo(GUIInfo(SKIN_STRING, CSkinSettings::Get().TranslateString(prop.param(0))));
}
if (prop.name == "hassetting")
return AddMultiInfo(GUIInfo(SKIN_BOOL, CSkinSettings::Get().TranslateBool(prop.param(0))));
else if (prop.name == "hastheme")
return AddMultiInfo(GUIInfo(SKIN_HAS_THEME, ConditionalStringParameter(prop.param(0))));
}
}
else if (cat.name == "window")
{
if (prop.name == "property" && prop.num_params() == 1)
{ // TODO: this doesn't support foo.xml
int winID = cat.param().empty() ? 0 : CButtonTranslator::TranslateWindow(cat.param());
if (winID != WINDOW_INVALID)
return AddMultiInfo(GUIInfo(WINDOW_PROPERTY, winID, ConditionalStringParameter(prop.param())));
}
for (size_t i = 0; i < sizeof(window_bools) / sizeof(infomap); i++)
{
if (prop.name == window_bools[i].str)
{ // TODO: The parameter for these should really be on the first not the second property
if (prop.param().find("xml") != std::string::npos)
return AddMultiInfo(GUIInfo(window_bools[i].val, 0, ConditionalStringParameter(prop.param())));
int winID = prop.param().empty() ? 0 : CButtonTranslator::TranslateWindow(prop.param());
if (winID != WINDOW_INVALID)
return AddMultiInfo(GUIInfo(window_bools[i].val, winID, 0));
return 0;
}
}
}
else if (cat.name == "control")
{
for (size_t i = 0; i < sizeof(control_labels) / sizeof(infomap); i++)
{
if (prop.name == control_labels[i].str)
{ // TODO: The parameter for these should really be on the first not the second property
int controlID = atoi(prop.param().c_str());
if (controlID)
return AddMultiInfo(GUIInfo(control_labels[i].val, controlID, 0));
return 0;
}
}
}
else if (cat.name == "controlgroup" && prop.name == "hasfocus")
{
int groupID = atoi(cat.param().c_str());
if (groupID)
return AddMultiInfo(GUIInfo(CONTROL_GROUP_HAS_FOCUS, groupID, atoi(prop.param(0).c_str())));
}
else if (cat.name == "playlist")
{
int ret = -1;
for (size_t i = 0; i < sizeof(playlist) / sizeof(infomap); i++)
{
if (prop.name == playlist[i].str)
{
ret = playlist[i].val;
break;
}
}
if (ret >= 0)
{
if (prop.num_params() <= 0)
return ret;
else
{
int playlistid = PLAYLIST_NONE;
if (StringUtils::EqualsNoCase(prop.param(), "video"))
playlistid = PLAYLIST_VIDEO;
else if (StringUtils::EqualsNoCase(prop.param(), "music"))
playlistid = PLAYLIST_MUSIC;
if (playlistid > PLAYLIST_NONE)
return AddMultiInfo(GUIInfo(ret, playlistid));
}
}
}
else if (cat.name == "pvr")
{
for (size_t i = 0; i < sizeof(pvr) / sizeof(infomap); i++)
{
if (prop.name == pvr[i].str)
return pvr[i].val;
}
}
}
else if (info.size() == 3 || info.size() == 4)
{
if (info[0].name == "system" && info[1].name == "platform")
{ // TODO: replace with a single system.platform
CStdString platform = info[2].name;
if (platform == "linux")
{
if (info.size() == 4)
{
CStdString device = info[3].name;
if (device == "raspberrypi") return SYSTEM_PLATFORM_LINUX_RASPBERRY_PI;
}
else return SYSTEM_PLATFORM_LINUX;
}
else if (platform == "windows") return SYSTEM_PLATFORM_WINDOWS;
else if (platform == "darwin") return SYSTEM_PLATFORM_DARWIN;
else if (platform == "osx") return SYSTEM_PLATFORM_DARWIN_OSX;
else if (platform == "ios") return SYSTEM_PLATFORM_DARWIN_IOS;
else if (platform == "atv2") return SYSTEM_PLATFORM_DARWIN_ATV2;
else if (platform == "android") return SYSTEM_PLATFORM_ANDROID;
}
if (info[0].name == "musicplayer")
{ // TODO: these two don't allow duration(foo) and also don't allow more than this number of levels...
if (info[1].name == "position")
{
int position = atoi(info[1].param().c_str());
int value = TranslateMusicPlayerString(info[2].name); // musicplayer.position(foo).bar
return AddMultiInfo(GUIInfo(value, 0, position));
}
else if (info[1].name == "offset")
{
int position = atoi(info[1].param().c_str());
int value = TranslateMusicPlayerString(info[2].name); // musicplayer.offset(foo).bar
return AddMultiInfo(GUIInfo(value, 1, position));
}
}
else if (info[0].name == "container")
{
int id = atoi(info[0].param().c_str());
int offset = atoi(info[1].param().c_str());
if (info[1].name == "listitemnowrap")
{
listItemDependent = true;
return AddMultiInfo(GUIInfo(TranslateListItem(info[2]), id, offset));
}
else if (info[1].name == "listitemposition")
{
listItemDependent = true;
return AddMultiInfo(GUIInfo(TranslateListItem(info[2]), id, offset, INFOFLAG_LISTITEM_POSITION));
}
else if (info[1].name == "listitem")
{
listItemDependent = true;
return AddMultiInfo(GUIInfo(TranslateListItem(info[2]), id, offset, INFOFLAG_LISTITEM_WRAP));
}
}
}
return 0;
}
int CGUIInfoManager::TranslateListItem(const Property &info)
{
for (size_t i = 0; i < sizeof(listitem_labels) / sizeof(infomap); i++) // these ones don't have or need an id
{
if (info.name == listitem_labels[i].str)
return listitem_labels[i].val;
}
if (info.name == "property" && info.num_params() == 1)
{
// properties are stored case sensitive in m_listItemProperties, but lookup is insensitive in CGUIListItem::GetProperty
if (StringUtils::EqualsNoCase(info.param(), "fanart_image"))
return AddListItemProp("fanart", LISTITEM_ART_OFFSET);
return AddListItemProp(info.param());
}
if (info.name == "art" && info.num_params() == 1)
return AddListItemProp(info.param(), LISTITEM_ART_OFFSET);
return 0;
}
int CGUIInfoManager::TranslateMusicPlayerString(const CStdString &info) const
{
for (size_t i = 0; i < sizeof(musicplayer) / sizeof(infomap); i++)
{
if (info == musicplayer[i].str)
return musicplayer[i].val;
}
return 0;
}
TIME_FORMAT CGUIInfoManager::TranslateTimeFormat(const CStdString &format)
{
if (format.empty()) 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;
else if (format.Equals("hh:mm:ss")) return TIME_FORMAT_HH_MM_SS;
else if (format.Equals("hh:mm:ss xx")) return TIME_FORMAT_HH_MM_SS_XX;
else if (format.Equals("h")) return TIME_FORMAT_H;
else if (format.Equals("h:mm:ss")) return TIME_FORMAT_H_MM_SS;
else if (format.Equals("h:mm:ss xx")) return TIME_FORMAT_H_MM_SS_XX;
else if (format.Equals("xx")) return TIME_FORMAT_XX;
return TIME_FORMAT_GUESS;
}
CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, std::string *fallback)
{
if (info >= CONDITIONAL_LABEL_START && info <= CONDITIONAL_LABEL_END)
return GetSkinVariableString(info, false);
CStdString strLabel;
if (info >= MULTI_INFO_START && info <= MULTI_INFO_END)
return GetMultiInfoLabel(m_multiInfo[info - MULTI_INFO_START], contextWindow);
if (info >= SLIDE_INFO_START && info <= SLIDE_INFO_END)
return GetPictureLabel(info);
if (info >= LISTITEM_PROPERTY_START+MUSICPLAYER_PROPERTY_OFFSET &&
info - (LISTITEM_PROPERTY_START+MUSICPLAYER_PROPERTY_OFFSET) < (int)m_listitemProperties.size())
{ // grab the property
if (!m_currentFile)
return "";
CStdString property = m_listitemProperties[info - LISTITEM_PROPERTY_START-MUSICPLAYER_PROPERTY_OFFSET];
return m_currentFile->GetProperty(property).asString();
}
if (info >= LISTITEM_START && info <= LISTITEM_END)
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS); // true for has list items
if (window)
{
CFileItemPtr item = window->GetCurrentListItem();
strLabel = GetItemLabel(item.get(), info, fallback);
}
return strLabel;
}
switch (info)
{
case PVR_NEXT_RECORDING_CHANNEL:
case PVR_NEXT_RECORDING_CHAN_ICO:
case PVR_NEXT_RECORDING_DATETIME:
case PVR_NEXT_RECORDING_TITLE:
case PVR_NOW_RECORDING_CHANNEL:
case PVR_NOW_RECORDING_CHAN_ICO:
case PVR_NOW_RECORDING_DATETIME:
case PVR_NOW_RECORDING_TITLE:
case PVR_BACKEND_NAME:
case PVR_BACKEND_VERSION:
case PVR_BACKEND_HOST:
case PVR_BACKEND_DISKSPACE:
case PVR_BACKEND_CHANNELS:
case PVR_BACKEND_TIMERS:
case PVR_BACKEND_RECORDINGS:
case PVR_BACKEND_NUMBER:
case PVR_TOTAL_DISKSPACE:
case PVR_NEXT_TIMER:
case PVR_PLAYING_DURATION:
case PVR_PLAYING_TIME:
case PVR_PLAYING_PROGRESS:
case PVR_ACTUAL_STREAM_CLIENT:
case PVR_ACTUAL_STREAM_DEVICE:
case PVR_ACTUAL_STREAM_STATUS:
case PVR_ACTUAL_STREAM_SIG:
case PVR_ACTUAL_STREAM_SNR:
case PVR_ACTUAL_STREAM_SIG_PROGR:
case PVR_ACTUAL_STREAM_SNR_PROGR:
case PVR_ACTUAL_STREAM_BER:
case PVR_ACTUAL_STREAM_UNC:
case PVR_ACTUAL_STREAM_VIDEO_BR:
case PVR_ACTUAL_STREAM_AUDIO_BR:
case PVR_ACTUAL_STREAM_DOLBY_BR:
case PVR_ACTUAL_STREAM_CRYPTION:
case PVR_ACTUAL_STREAM_SERVICE:
case PVR_ACTUAL_STREAM_MUX:
case PVR_ACTUAL_STREAM_PROVIDER:
g_PVRManager.TranslateCharInfo(info, strLabel);
break;
case WEATHER_CONDITIONS:
strLabel = g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_COND);
StringUtils::Trim(strLabel);
break;
case WEATHER_TEMPERATURE:
strLabel = StringUtils::Format("%s%s",
g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_TEMP).c_str(),
g_langInfo.GetTempUnitString().c_str());
break;
case WEATHER_LOCATION:
strLabel = g_weatherManager.GetInfo(WEATHER_LABEL_LOCATION);
break;
case WEATHER_FANART_CODE:
strLabel = URIUtils::GetFileName(g_weatherManager.GetInfo(WEATHER_IMAGE_CURRENT_ICON));
URIUtils::RemoveExtension(strLabel);
break;
case WEATHER_PLUGIN:
strLabel = CSettings::Get().GetString("weather.addon");
break;
case SYSTEM_DATE:
strLabel = GetDate();
break;
case SYSTEM_FPS:
strLabel = StringUtils::Format("%02.2f", m_fps);
break;
case PLAYER_VOLUME:
strLabel = StringUtils::Format("%2.1f dB", CAEUtil::PercentToGain(g_application.GetVolume(false)));
break;
case PLAYER_SUBTITLE_DELAY:
strLabel = StringUtils::Format("%2.3f s", CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay);
break;
case PLAYER_AUDIO_DELAY:
strLabel = StringUtils::Format("%2.3f s", CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay);
break;
case PLAYER_CHAPTER:
if(g_application.m_pPlayer->IsPlaying())
strLabel = StringUtils::Format("%02d", g_application.m_pPlayer->GetChapter());
break;
case PLAYER_CHAPTERCOUNT:
if(g_application.m_pPlayer->IsPlaying())
strLabel = StringUtils::Format("%02d", g_application.m_pPlayer->GetChapterCount());
break;
case PLAYER_CHAPTERNAME:
if(g_application.m_pPlayer->IsPlaying())
g_application.m_pPlayer->GetChapterName(strLabel);
break;
case PLAYER_CACHELEVEL:
{
int iLevel = 0;
if(g_application.m_pPlayer->IsPlaying() && GetInt(iLevel, PLAYER_CACHELEVEL) && iLevel >= 0)
strLabel = StringUtils::Format("%i", iLevel);
}
break;
case PLAYER_TIME:
if(g_application.m_pPlayer->IsPlaying())
strLabel = GetCurrentPlayTime(TIME_FORMAT_HH_MM);
break;
case PLAYER_DURATION:
if(g_application.m_pPlayer->IsPlaying())
strLabel = GetDuration(TIME_FORMAT_HH_MM);
break;
case PLAYER_PATH:
case PLAYER_FILENAME:
case PLAYER_FILEPATH:
if (m_currentFile)
{
if (m_currentFile->HasMusicInfoTag())
strLabel = m_currentFile->GetMusicInfoTag()->GetURL();
else if (m_currentFile->HasVideoInfoTag())
strLabel = m_currentFile->GetVideoInfoTag()->m_strFileNameAndPath;
if (strLabel.empty())
strLabel = m_currentFile->GetPath();
}
if (info == PLAYER_PATH)
{
// do this twice since we want the path outside the archive if this
// is to be of use.
if (URIUtils::IsInArchive(strLabel))
strLabel = URIUtils::GetParentPath(strLabel);
strLabel = URIUtils::GetParentPath(strLabel);
}
else if (info == PLAYER_FILENAME)
strLabel = URIUtils::GetFileName(strLabel);
break;
case PLAYER_TITLE:
{
if(m_currentFile)
{
if (m_currentFile->HasPVRChannelInfoTag())
{
CEpgInfoTag tag;
return m_currentFile->GetPVRChannelInfoTag()->GetEPGNow(tag) ?
tag.Title() :
CSettings::Get().GetBool("epg.hidenoinfoavailable") ?
StringUtils::EmptyString :
g_localizeStrings.Get(19055); // no information available
}
if (m_currentFile->HasPVRRecordingInfoTag() && !m_currentFile->GetPVRRecordingInfoTag()->m_strTitle.empty())
return m_currentFile->GetPVRRecordingInfoTag()->m_strTitle;
if (m_currentFile->HasVideoInfoTag() && !m_currentFile->GetVideoInfoTag()->m_strTitle.empty())
return m_currentFile->GetVideoInfoTag()->m_strTitle;
if (m_currentFile->HasMusicInfoTag() && !m_currentFile->GetMusicInfoTag()->GetTitle().empty())
return m_currentFile->GetMusicInfoTag()->GetTitle();
// don't have the title, so use dvdplayer, label, or drop down to title from path
if (!g_application.m_pPlayer->GetPlayingTitle().empty())
return g_application.m_pPlayer->GetPlayingTitle();
if (!m_currentFile->GetLabel().empty())
return m_currentFile->GetLabel();
return CUtil::GetTitleFromPath(m_currentFile->GetPath());
}
else
{
if (!g_application.m_pPlayer->GetPlayingTitle().empty())
return g_application.m_pPlayer->GetPlayingTitle();
}
}
break;
case MUSICPLAYER_TITLE:
case MUSICPLAYER_ALBUM:
case MUSICPLAYER_ARTIST:
case MUSICPLAYER_ALBUM_ARTIST:
case MUSICPLAYER_GENRE:
case MUSICPLAYER_YEAR:
case MUSICPLAYER_TRACK_NUMBER:
case MUSICPLAYER_BITRATE:
case MUSICPLAYER_PLAYLISTLEN:
case MUSICPLAYER_PLAYLISTPOS:
case MUSICPLAYER_CHANNELS:
case MUSICPLAYER_BITSPERSAMPLE:
case MUSICPLAYER_SAMPLERATE:
case MUSICPLAYER_CODEC:
case MUSICPLAYER_DISC_NUMBER:
case MUSICPLAYER_RATING:
case MUSICPLAYER_COMMENT:
case MUSICPLAYER_LYRICS:
case MUSICPLAYER_CHANNEL_NAME:
case MUSICPLAYER_CHANNEL_NUMBER:
case MUSICPLAYER_SUB_CHANNEL_NUMBER:
case MUSICPLAYER_CHANNEL_NUMBER_LBL:
case MUSICPLAYER_CHANNEL_GROUP:
case MUSICPLAYER_PLAYCOUNT:
case MUSICPLAYER_LASTPLAYED:
strLabel = GetMusicLabel(info);
break;
case VIDEOPLAYER_TITLE:
case VIDEOPLAYER_ORIGINALTITLE:
case VIDEOPLAYER_GENRE:
case VIDEOPLAYER_DIRECTOR:
case VIDEOPLAYER_YEAR:
case VIDEOPLAYER_PLAYLISTLEN:
case VIDEOPLAYER_PLAYLISTPOS:
case VIDEOPLAYER_PLOT:
case VIDEOPLAYER_PLOT_OUTLINE:
case VIDEOPLAYER_EPISODE:
case VIDEOPLAYER_SEASON:
case VIDEOPLAYER_RATING:
case VIDEOPLAYER_RATING_AND_VOTES:
case VIDEOPLAYER_TVSHOW:
case VIDEOPLAYER_PREMIERED:
case VIDEOPLAYER_STUDIO:
case VIDEOPLAYER_COUNTRY:
case VIDEOPLAYER_MPAA:
case VIDEOPLAYER_TOP250:
case VIDEOPLAYER_CAST:
case VIDEOPLAYER_CAST_AND_ROLE:
case VIDEOPLAYER_ARTIST:
case VIDEOPLAYER_ALBUM:
case VIDEOPLAYER_WRITER:
case VIDEOPLAYER_TAGLINE:
case VIDEOPLAYER_TRAILER:
case VIDEOPLAYER_STARTTIME:
case VIDEOPLAYER_ENDTIME:
case VIDEOPLAYER_NEXT_TITLE:
case VIDEOPLAYER_NEXT_GENRE:
case VIDEOPLAYER_NEXT_PLOT:
case VIDEOPLAYER_NEXT_PLOT_OUTLINE:
case VIDEOPLAYER_NEXT_STARTTIME:
case VIDEOPLAYER_NEXT_ENDTIME:
case VIDEOPLAYER_NEXT_DURATION:
case VIDEOPLAYER_CHANNEL_NAME:
case VIDEOPLAYER_CHANNEL_NUMBER:
case VIDEOPLAYER_SUB_CHANNEL_NUMBER:
case VIDEOPLAYER_CHANNEL_NUMBER_LBL:
case VIDEOPLAYER_CHANNEL_GROUP:
case VIDEOPLAYER_PARENTAL_RATING:
case VIDEOPLAYER_PLAYCOUNT:
case VIDEOPLAYER_LASTPLAYED:
strLabel = GetVideoLabel(info);
break;
case VIDEOPLAYER_VIDEO_CODEC:
if(g_application.m_pPlayer->IsPlaying())
{
strLabel = m_videoInfo.videoCodecName;
}
break;
case VIDEOPLAYER_VIDEO_RESOLUTION:
if(g_application.m_pPlayer->IsPlaying())
{
return CStreamDetails::VideoDimsToResolutionDescription(m_videoInfo.width, m_videoInfo.height);
}
break;
case VIDEOPLAYER_AUDIO_CODEC:
if(g_application.m_pPlayer->IsPlaying())
{
strLabel = m_audioInfo.audioCodecName;
}
break;
case VIDEOPLAYER_VIDEO_ASPECT:
if (g_application.m_pPlayer->IsPlaying())
{
strLabel = CStreamDetails::VideoAspectToAspectDescription(m_videoInfo.videoAspectRatio);
}
break;
case VIDEOPLAYER_AUDIO_CHANNELS:
if(g_application.m_pPlayer->IsPlaying())
{
strLabel = StringUtils::Format("%i", m_audioInfo.channels);
}
break;
case VIDEOPLAYER_AUDIO_LANG:
if(g_application.m_pPlayer->IsPlaying())
{
SPlayerAudioStreamInfo info;
g_application.m_pPlayer->GetAudioStreamInfo(g_application.m_pPlayer->GetAudioStream(), info);
strLabel = info.language;
}
break;
case VIDEOPLAYER_STEREOSCOPIC_MODE:
if(g_application.m_pPlayer->IsPlaying())
{
strLabel = m_videoInfo.stereoMode;
}
break;
case VIDEOPLAYER_SUBTITLES_LANG:
if(g_application.m_pPlayer && g_application.m_pPlayer->IsPlaying() && g_application.m_pPlayer->GetSubtitleVisible())
{
SPlayerSubtitleStreamInfo info;
g_application.m_pPlayer->GetSubtitleStreamInfo(g_application.m_pPlayer->GetSubtitle(), info);
strLabel = info.language;
}
break;
case PLAYLIST_LENGTH:
case PLAYLIST_POSITION:
case PLAYLIST_RANDOM:
case PLAYLIST_REPEAT:
strLabel = GetPlaylistLabel(info);
break;
case MUSICPM_SONGSPLAYED:
case MUSICPM_MATCHINGSONGS:
case MUSICPM_MATCHINGSONGSPICKED:
case MUSICPM_MATCHINGSONGSLEFT:
case MUSICPM_RELAXEDSONGSPICKED:
case MUSICPM_RANDOMSONGSPICKED:
strLabel = GetMusicPartyModeLabel(info);
break;
case SYSTEM_FREE_SPACE:
case SYSTEM_USED_SPACE:
case SYSTEM_TOTAL_SPACE:
case SYSTEM_FREE_SPACE_PERCENT:
case SYSTEM_USED_SPACE_PERCENT:
return g_sysinfo.GetHddSpaceInfo(info);
break;
case SYSTEM_CPU_TEMPERATURE:
case SYSTEM_GPU_TEMPERATURE:
case SYSTEM_FAN_SPEED:
case SYSTEM_CPU_USAGE:
return GetSystemHeatInfo(info);
break;
case SYSTEM_VIDEO_ENCODER_INFO:
case NETWORK_MAC_ADDRESS:
case SYSTEM_OS_VERSION_INFO:
case SYSTEM_CPUFREQUENCY:
case SYSTEM_INTERNET_STATE:
case SYSTEM_UPTIME:
case SYSTEM_TOTALUPTIME:
case SYSTEM_BATTERY_LEVEL:
return g_sysinfo.GetInfo(info);
break;
case SYSTEM_SCREEN_RESOLUTION:
if(g_Windowing.IsFullScreen())
strLabel = StringUtils::Format("%ix%i@%.2fHz - %s (%02.2f fps)",
CDisplaySettings::Get().GetCurrentResolutionInfo().iScreenWidth,
CDisplaySettings::Get().GetCurrentResolutionInfo().iScreenHeight,
CDisplaySettings::Get().GetCurrentResolutionInfo().fRefreshRate,
g_localizeStrings.Get(244).c_str(),
GetFPS());
else
strLabel = StringUtils::Format("%ix%i - %s (%02.2f fps)",
CDisplaySettings::Get().GetCurrentResolutionInfo().iScreenWidth,
CDisplaySettings::Get().GetCurrentResolutionInfo().iScreenHeight,
g_localizeStrings.Get(242).c_str(),
GetFPS());
return strLabel;
break;
case CONTAINER_FOLDERPATH:
case CONTAINER_FOLDERNAME:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
{
if (info==CONTAINER_FOLDERNAME)
strLabel = ((CGUIMediaWindow*)window)->CurrentDirectory().GetLabel();
else
strLabel = CURL(((CGUIMediaWindow*)window)->CurrentDirectory().GetPath()).GetWithoutUserDetails();
}
break;
}
case CONTAINER_PLUGINNAME:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
{
CURL url(((CGUIMediaWindow*)window)->CurrentDirectory().GetPath());
if (url.IsProtocol("plugin"))
strLabel = URIUtils::GetFileName(url.GetHostName());
}
break;
}
case CONTAINER_VIEWMODE:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
{
const CGUIControl *control = window->GetControl(window->GetViewContainerID());
if (control && control->IsContainer())
strLabel = ((IGUIContainer *)control)->GetLabel();
}
break;
}
case CONTAINER_SORT_METHOD:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
{
const CGUIViewState *viewState = ((CGUIMediaWindow*)window)->GetViewState();
if (viewState)
strLabel = g_localizeStrings.Get(viewState->GetSortMethodLabel());
}
}
break;
case CONTAINER_NUM_PAGES:
case CONTAINER_NUM_ITEMS:
case CONTAINER_CURRENT_PAGE:
return GetMultiInfoLabel(GUIInfo(info), contextWindow);
break;
case CONTAINER_SHOWPLOT:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("showplot").asString();
}
break;
case CONTAINER_TOTALTIME:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
{
const CFileItemList& items=((CGUIMediaWindow *)window)->CurrentDirectory();
int duration=0;
for (int i=0;i<items.Size();++i)
{
CFileItemPtr item=items.Get(i);
if (item->HasMusicInfoTag())
duration += item->GetMusicInfoTag()->GetDuration();
else if (item->HasVideoInfoTag())
duration += item->GetVideoInfoTag()->m_streamDetails.GetVideoDuration();
}
if (duration > 0)
return StringUtils::SecondsToTimeString(duration);
}
}
break;
case SYSTEM_BUILD_VERSION_SHORT:
strLabel = GetVersionShort();
break;
case SYSTEM_BUILD_VERSION:
strLabel = GetVersion();
break;
case SYSTEM_BUILD_DATE:
strLabel = GetBuild();
break;
case SYSTEM_FREE_MEMORY:
case SYSTEM_FREE_MEMORY_PERCENT:
case SYSTEM_USED_MEMORY:
case SYSTEM_USED_MEMORY_PERCENT:
case SYSTEM_TOTAL_MEMORY:
{
MEMORYSTATUSEX stat;
stat.dwLength = sizeof(MEMORYSTATUSEX);
GlobalMemoryStatusEx(&stat);
int iMemPercentFree = 100 - ((int)( 100.0f* (stat.ullTotalPhys - stat.ullAvailPhys)/stat.ullTotalPhys + 0.5f ));
int iMemPercentUsed = 100 - iMemPercentFree;
if (info == SYSTEM_FREE_MEMORY)
strLabel = StringUtils::Format("%luMB", (ULONG)(stat.ullAvailPhys/MB));
else if (info == SYSTEM_FREE_MEMORY_PERCENT)
strLabel = StringUtils::Format("%i%%", iMemPercentFree);
else if (info == SYSTEM_USED_MEMORY)
strLabel = StringUtils::Format("%luMB", (ULONG)((stat.ullTotalPhys - stat.ullAvailPhys)/MB));
else if (info == SYSTEM_USED_MEMORY_PERCENT)
strLabel = StringUtils::Format("%i%%", iMemPercentUsed);
else if (info == SYSTEM_TOTAL_MEMORY)
strLabel = StringUtils::Format("%luMB", (ULONG)(stat.ullTotalPhys/MB));
}
break;
case SYSTEM_SCREEN_MODE:
strLabel = g_graphicsContext.GetResInfo().strMode;
break;
case SYSTEM_SCREEN_WIDTH:
strLabel = StringUtils::Format("%i", g_graphicsContext.GetResInfo().iScreenWidth);
break;
case SYSTEM_SCREEN_HEIGHT:
strLabel = StringUtils::Format("%i", g_graphicsContext.GetResInfo().iScreenHeight);
break;
case SYSTEM_CURRENT_WINDOW:
return g_localizeStrings.Get(g_windowManager.GetFocusedWindow());
break;
case SYSTEM_STARTUP_WINDOW:
strLabel = StringUtils::Format("%i", CSettings::Get().GetInt("lookandfeel.startupwindow"));
break;
case SYSTEM_CURRENT_CONTROL:
{
CGUIWindow *window = g_windowManager.GetWindow(g_windowManager.GetFocusedWindow());
if (window)
{
CGUIControl *control = window->GetFocusedControl();
if (control)
strLabel = control->GetDescription();
}
}
break;
#ifdef HAS_DVD_DRIVE
case SYSTEM_DVD_LABEL:
strLabel = g_mediaManager.GetDiskLabel();
break;
#endif
case SYSTEM_ALARM_POS:
if (g_alarmClock.GetRemaining("shutdowntimer") == 0.f)
strLabel = "";
else
{
double fTime = g_alarmClock.GetRemaining("shutdowntimer");
if (fTime > 60.f)
strLabel = StringUtils::Format(g_localizeStrings.Get(13213).c_str(), g_alarmClock.GetRemaining("shutdowntimer")/60.f);
else
strLabel = StringUtils::Format(g_localizeStrings.Get(13214).c_str(), g_alarmClock.GetRemaining("shutdowntimer"));
}
break;
case SYSTEM_PROFILENAME:
strLabel = CProfilesManager::Get().GetCurrentProfile().getName();
break;
case SYSTEM_PROFILECOUNT:
strLabel = StringUtils::Format("%" PRIuS, CProfilesManager::Get().GetNumberOfProfiles());
break;
case SYSTEM_PROFILEAUTOLOGIN:
{
int profileId = CProfilesManager::Get().GetAutoLoginProfileId();
if ((profileId < 0) || (!CProfilesManager::Get().GetProfileName(profileId, strLabel)))
strLabel = g_localizeStrings.Get(37014); // Last used profile
}
break;
case SYSTEM_LANGUAGE:
strLabel = CSettings::Get().GetString("locale.language");
break;
case SYSTEM_TEMPERATURE_UNITS:
strLabel = g_langInfo.GetTempUnitString();
break;
case SYSTEM_PROGRESS_BAR:
{
int percent;
if (GetInt(percent, SYSTEM_PROGRESS_BAR) && percent > 0)
strLabel = StringUtils::Format("%i", percent);
}
break;
case SYSTEM_FRIENDLY_NAME:
{
CStdString friendlyName = CSettings::Get().GetString("services.devicename");
if (friendlyName.Equals(CCompileInfo::GetAppName()))
strLabel = StringUtils::Format("%s (%s)", friendlyName.c_str(), g_application.getNetwork().GetHostName().c_str());
else
strLabel = friendlyName;
}
break;
case SYSTEM_STEREOSCOPIC_MODE:
{
int stereoMode = CSettings::Get().GetInt("videoscreen.stereoscopicmode");
strLabel = StringUtils::Format("%i", stereoMode);
}
break;
case SKIN_THEME:
strLabel = CSettings::Get().GetString("lookandfeel.skintheme");
break;
case SKIN_COLOUR_THEME:
strLabel = CSettings::Get().GetString("lookandfeel.skincolors");
break;
case SKIN_ASPECT_RATIO:
if (g_SkinInfo)
strLabel = g_SkinInfo->GetCurrentAspect();
break;
case NETWORK_IP_ADDRESS:
{
CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
if (iface)
return iface->GetCurrentIPAddress();
}
break;
case NETWORK_SUBNET_MASK:
{
CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
if (iface)
return iface->GetCurrentNetmask();
}
break;
case NETWORK_GATEWAY_ADDRESS:
{
CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
if (iface)
return iface->GetCurrentDefaultGateway();
}
break;
case NETWORK_DNS1_ADDRESS:
{
vector<std::string> nss = g_application.getNetwork().GetNameServers();
if (nss.size() >= 1)
return nss[0];
}
break;
case NETWORK_DNS2_ADDRESS:
{
vector<std::string> nss = g_application.getNetwork().GetNameServers();
if (nss.size() >= 2)
return nss[1];
}
break;
case NETWORK_DHCP_ADDRESS:
{
CStdString dhcpserver;
return dhcpserver;
}
break;
case NETWORK_LINK_STATE:
{
CStdString linkStatus = g_localizeStrings.Get(151);
linkStatus += " ";
CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
if (iface && iface->IsConnected())
linkStatus += g_localizeStrings.Get(15207);
else
linkStatus += g_localizeStrings.Get(15208);
return linkStatus;
}
break;
case VISUALISATION_PRESET:
{
CGUIMessage msg(GUI_MSG_GET_VISUALISATION, 0, 0);
g_windowManager.SendMessage(msg);
if (msg.GetPointer())
{
CVisualisation* viz = NULL;
viz = (CVisualisation*)msg.GetPointer();
if (viz)
{
strLabel = viz->GetPresetName();
URIUtils::RemoveExtension(strLabel);
}
}
}
break;
case VISUALISATION_NAME:
{
AddonPtr addon;
strLabel = CSettings::Get().GetString("musicplayer.visualisation");
if (CAddonMgr::Get().GetAddon(strLabel,addon) && addon)
strLabel = addon->Name();
}
break;
case FANART_COLOR1:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("fanart_color1").asString();
}
break;
case FANART_COLOR2:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("fanart_color2").asString();
}
break;
case FANART_COLOR3:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty("fanart_color3").asString();
}
break;
case FANART_IMAGE:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
return ((CGUIMediaWindow *)window)->CurrentDirectory().GetArt("fanart");
}
break;
case SYSTEM_RENDER_VENDOR:
strLabel = g_Windowing.GetRenderVendor();
break;
case SYSTEM_RENDER_RENDERER:
strLabel = g_Windowing.GetRenderRenderer();
break;
case SYSTEM_RENDER_VERSION:
strLabel = g_Windowing.GetRenderVersionString();
break;
}
return strLabel;
}
// tries to get a integer value for use in progressbars/sliders and such
bool CGUIInfoManager::GetInt(int &value, int info, int contextWindow, const CGUIListItem *item /* = NULL */) const
{
if (info >= MULTI_INFO_START && info <= MULTI_INFO_END)
return GetMultiInfoInt(value, m_multiInfo[info - MULTI_INFO_START], contextWindow);
if (info >= LISTITEM_START && info <= LISTITEM_END)
{
if (item == NULL)
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS); // true for has list items
if (window)
item = window->GetCurrentListItem().get();
}
return GetItemInt(value, item, info);
}
value = 0;
switch( info )
{
case PLAYER_VOLUME:
value = (int)g_application.GetVolume();
return true;
case PLAYER_SUBTITLE_DELAY:
value = g_application.GetSubtitleDelay();
return true;
case PLAYER_AUDIO_DELAY:
value = g_application.GetAudioDelay();
return true;
case PLAYER_PROGRESS:
case PLAYER_PROGRESS_CACHE:
case PLAYER_SEEKBAR:
case PLAYER_CACHELEVEL:
case PLAYER_CHAPTER:
case PLAYER_CHAPTERCOUNT:
{
if( g_application.m_pPlayer->IsPlaying())
{
switch( info )
{
case PLAYER_PROGRESS:
value = (int)(g_application.GetPercentage());
break;
case PLAYER_PROGRESS_CACHE:
value = (int)(g_application.GetCachePercentage());
break;
case PLAYER_SEEKBAR:
value = (int)g_application.GetSeekHandler()->GetPercent();
break;
case PLAYER_CACHELEVEL:
value = (int)(g_application.m_pPlayer->GetCacheLevel());
break;
case PLAYER_CHAPTER:
value = g_application.m_pPlayer->GetChapter();
break;
case PLAYER_CHAPTERCOUNT:
value = g_application.m_pPlayer->GetChapterCount();
break;
}
}
}
return true;
case SYSTEM_FREE_MEMORY:
case SYSTEM_USED_MEMORY:
{
MEMORYSTATUSEX stat;
stat.dwLength = sizeof(MEMORYSTATUSEX);
GlobalMemoryStatusEx(&stat);
int memPercentUsed = (int)( 100.0f* (stat.ullTotalPhys - stat.ullAvailPhys)/stat.ullTotalPhys + 0.5f );
if (info == SYSTEM_FREE_MEMORY)
value = 100 - memPercentUsed;
else
value = memPercentUsed;
return true;
}
case SYSTEM_PROGRESS_BAR:
{
CGUIDialogProgress *bar = (CGUIDialogProgress *)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
if (bar && bar->IsDialogRunning())
value = bar->GetPercentage();
return true;
}
case SYSTEM_FREE_SPACE:
case SYSTEM_USED_SPACE:
{
g_sysinfo.GetHddSpaceInfo(value, info, true);
return true;
}
case SYSTEM_CPU_USAGE:
value = g_cpuInfo.getUsedPercentage();
return true;
case PVR_PLAYING_PROGRESS:
case PVR_ACTUAL_STREAM_SIG_PROGR:
case PVR_ACTUAL_STREAM_SNR_PROGR:
case PVR_BACKEND_DISKSPACE_PROGR:
value = g_PVRManager.TranslateIntInfo(info);
return true;
case SYSTEM_BATTERY_LEVEL:
value = g_powerManager.BatteryLevel();
return true;
}
return false;
}
// functor for comparison InfoPtr's
struct InfoBoolFinder
{
InfoBoolFinder(const std::string &expression, int context) : m_bool(expression, context) {};
bool operator() (const InfoPtr &right) const { return m_bool == *right; };
InfoBool m_bool;
};
INFO::InfoPtr CGUIInfoManager::Register(const CStdString &expression, int context)
{
CStdString condition(CGUIInfoLabel::ReplaceLocalize(expression));
StringUtils::Trim(condition);
if (condition.empty())
return INFO::InfoPtr();
CSingleLock lock(m_critInfo);
// do we have the boolean expression already registered?
vector<InfoPtr>::const_iterator i = find_if(m_bools.begin(), m_bools.end(), InfoBoolFinder(condition, context));
if (i != m_bools.end())
return *i;
if (condition.find_first_of("|+[]!") != condition.npos)
m_bools.push_back(boost::make_shared<InfoExpression>(condition, context));
else
m_bools.push_back(boost::make_shared<InfoSingle>(condition, context));
return m_bools.back();
}
bool CGUIInfoManager::EvaluateBool(const CStdString &expression, int contextWindow)
{
bool result = false;
INFO::InfoPtr info = Register(expression, contextWindow);
if (info)
result = info->Get();
return result;
}
// checks the condition and returns it as necessary. Currently used
// for toggle button controls and visibility of images.
bool CGUIInfoManager::GetBool(int condition1, int contextWindow, const CGUIListItem *item)
{
bool bReturn = false;
int condition = abs(condition1);
if (condition >= LISTITEM_START && condition < LISTITEM_END)
{
if (item)
bReturn = GetItemBool(item, condition);
else
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS); // true for has list items
if (window)
{
CFileItemPtr item = window->GetCurrentListItem();
bReturn = GetItemBool(item.get(), condition);
}
}
}
// Ethernet Link state checking
// Will check if system has a Ethernet Link connection! [Cable in!]
// This can used for the skinner to switch off Network or Inter required functions
else if ( condition == SYSTEM_ALWAYS_TRUE)
bReturn = true;
else if (condition == SYSTEM_ALWAYS_FALSE)
bReturn = false;
else if (condition == SYSTEM_ETHERNET_LINK_ACTIVE)
bReturn = true;
else if (condition == WINDOW_IS_MEDIA)
{ // note: This doesn't return true for dialogs (content, favourites, login, videoinfo)
CGUIWindow *pWindow = g_windowManager.GetWindow(g_windowManager.GetActiveWindow());
bReturn = (pWindow && pWindow->IsMediaWindow());
}
else if (condition == PLAYER_MUTED)
bReturn = g_application.IsMuted();
else if (condition >= LIBRARY_HAS_MUSIC && condition <= LIBRARY_HAS_MUSICVIDEOS)
bReturn = GetLibraryBool(condition);
else if (condition == LIBRARY_IS_SCANNING)
{
if (g_application.IsMusicScanning() || g_application.IsVideoScanning())
bReturn = true;
else
bReturn = false;
}
else if (condition == LIBRARY_IS_SCANNING_VIDEO)
{
bReturn = g_application.IsVideoScanning();
}
else if (condition == LIBRARY_IS_SCANNING_MUSIC)
{
bReturn = g_application.IsMusicScanning();
}
else if (condition == SYSTEM_PLATFORM_LINUX)
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
bReturn = true;
#else
bReturn = false;
#endif
else if (condition == SYSTEM_PLATFORM_WINDOWS)
#ifdef TARGET_WINDOWS
bReturn = true;
#else
bReturn = false;
#endif
else if (condition == SYSTEM_PLATFORM_DARWIN)
#ifdef TARGET_DARWIN
bReturn = true;
#else
bReturn = false;
#endif
else if (condition == SYSTEM_PLATFORM_DARWIN_OSX)
#ifdef TARGET_DARWIN_OSX
bReturn = true;
#else
bReturn = false;
#endif
else if (condition == SYSTEM_PLATFORM_DARWIN_IOS)
#ifdef TARGET_DARWIN_IOS
bReturn = true;
#else
bReturn = false;
#endif
else if (condition == SYSTEM_PLATFORM_DARWIN_ATV2)
#ifdef TARGET_DARWIN_IOS_ATV2
bReturn = true;
#else
bReturn = false;
#endif
else if (condition == SYSTEM_PLATFORM_ANDROID)
#if defined(TARGET_ANDROID)
bReturn = true;
#else
bReturn = false;
#endif
else if (condition == SYSTEM_PLATFORM_LINUX_RASPBERRY_PI)
#if defined(TARGET_RASPBERRY_PI)
bReturn = true;
#else
bReturn = false;
#endif
else if (condition == SYSTEM_MEDIA_DVD)
bReturn = g_mediaManager.IsDiscInDrive();
#ifdef HAS_DVD_DRIVE
else if (condition == SYSTEM_DVDREADY)
bReturn = g_mediaManager.GetDriveStatus() != DRIVE_NOT_READY;
else if (condition == SYSTEM_TRAYOPEN)
bReturn = g_mediaManager.GetDriveStatus() == DRIVE_OPEN;
#endif
else if (condition == SYSTEM_CAN_POWERDOWN)
bReturn = g_powerManager.CanPowerdown();
else if (condition == SYSTEM_CAN_SUSPEND)
bReturn = g_powerManager.CanSuspend();
else if (condition == SYSTEM_CAN_HIBERNATE)
bReturn = g_powerManager.CanHibernate();
else if (condition == SYSTEM_CAN_REBOOT)
bReturn = g_powerManager.CanReboot();
else if (condition == SYSTEM_SCREENSAVER_ACTIVE)
bReturn = g_application.IsInScreenSaver();
else if (condition == SYSTEM_DPMS_ACTIVE)
bReturn = g_application.IsDPMSActive();
else if (condition == PLAYER_SHOWINFO)
bReturn = m_playerShowInfo;
else if (condition == PLAYER_SHOWCODEC)
bReturn = m_playerShowCodec;
else if (condition >= MULTI_INFO_START && condition <= MULTI_INFO_END)
{
return GetMultiInfoBool(m_multiInfo[condition - MULTI_INFO_START], contextWindow, item);
}
else if (condition == SYSTEM_HASLOCKS)
bReturn = CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE;
else if (condition == SYSTEM_HAS_PVR)
bReturn = true;
else if (condition == SYSTEM_ISMASTER)
bReturn = CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && g_passwordManager.bMasterUser;
else if (condition == SYSTEM_ISFULLSCREEN)
bReturn = g_Windowing.IsFullScreen();
else if (condition == SYSTEM_ISSTANDALONE)
bReturn = g_application.IsStandAlone();
else if (condition == SYSTEM_ISINHIBIT)
bReturn = g_application.IsIdleShutdownInhibited();
else if (condition == SYSTEM_HAS_SHUTDOWN)
bReturn = (CSettings::Get().GetInt("powermanagement.shutdowntime") > 0);
else if (condition == SYSTEM_LOGGEDON)
bReturn = !(g_windowManager.GetActiveWindow() == WINDOW_LOGIN_SCREEN);
else if (condition == SYSTEM_SHOW_EXIT_BUTTON)
bReturn = g_advancedSettings.m_showExitButton;
else if (condition == SYSTEM_HAS_LOGINSCREEN)
bReturn = CProfilesManager::Get().UsingLoginScreen();
else if (condition == WEATHER_IS_FETCHED)
bReturn = g_weatherManager.IsFetched();
else if (condition >= PVR_CONDITIONS_START && condition <= PVR_CONDITIONS_END)
bReturn = g_PVRManager.TranslateBoolInfo(condition);
else if (condition == SYSTEM_INTERNET_STATE)
{
g_sysinfo.GetInfo(condition);
bReturn = g_sysinfo.HasInternet();
}
else if (condition == SKIN_HAS_VIDEO_OVERLAY)
{
bReturn = g_windowManager.IsOverlayAllowed() && g_application.m_pPlayer->IsPlayingVideo();
}
else if (condition == SKIN_HAS_MUSIC_OVERLAY)
{
bReturn = g_windowManager.IsOverlayAllowed() && g_application.m_pPlayer->IsPlayingAudio();
}
else if (condition == CONTAINER_HASFILES || condition == CONTAINER_HASFOLDERS)
{
CGUIWindow *pWindow = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (pWindow)
{
const CFileItemList& items=((CGUIMediaWindow*)pWindow)->CurrentDirectory();
for (int i=0;i<items.Size();++i)
{
CFileItemPtr item=items.Get(i);
if (!item->m_bIsFolder && condition == CONTAINER_HASFILES)
{
bReturn=true;
break;
}
else if (item->m_bIsFolder && !item->IsParentFolder() && condition == CONTAINER_HASFOLDERS)
{
bReturn=true;
break;
}
}
}
}
else if (condition == CONTAINER_STACKED)
{
CGUIWindow *pWindow = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (pWindow)
bReturn = ((CGUIMediaWindow*)pWindow)->CurrentDirectory().GetProperty("isstacked").asBoolean();
}
else if (condition == CONTAINER_HAS_THUMB)
{
CGUIWindow *pWindow = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (pWindow)
bReturn = ((CGUIMediaWindow*)pWindow)->CurrentDirectory().HasArt("thumb");
}
else if (condition == CONTAINER_HAS_NEXT || condition == CONTAINER_HAS_PREVIOUS
|| condition == CONTAINER_SCROLLING || condition == CONTAINER_ISUPDATING)
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
{
const CGUIControl* control = window->GetControl(window->GetViewContainerID());
if (control)
bReturn = control->GetCondition(condition, 0);
}
}
else if (condition == CONTAINER_CAN_FILTER)
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
bReturn = !((CGUIMediaWindow*)window)->CanFilterAdvanced();
}
else if (condition == CONTAINER_CAN_FILTERADVANCED)
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
bReturn = ((CGUIMediaWindow*)window)->CanFilterAdvanced();
}
else if (condition == CONTAINER_FILTERED)
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
bReturn = ((CGUIMediaWindow*)window)->IsFiltered();
}
else if (condition == VIDEOPLAYER_HAS_INFO)
bReturn = ((m_currentFile->HasVideoInfoTag() && !m_currentFile->GetVideoInfoTag()->IsEmpty()) ||
(m_currentFile->HasPVRChannelInfoTag() && !m_currentFile->GetPVRChannelInfoTag()->IsEmpty()));
else if (condition >= CONTAINER_SCROLL_PREVIOUS && condition <= CONTAINER_SCROLL_NEXT)
{
// no parameters, so we assume it's just requested for a media window. It therefore
// can only happen if the list has focus.
CGUIWindow *pWindow = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (pWindow)
{
map<int,int>::const_iterator it = m_containerMoves.find(pWindow->GetViewContainerID());
if (it != m_containerMoves.end())
{
if (condition > CONTAINER_STATIC) // moving up
bReturn = it->second >= std::max(condition - CONTAINER_STATIC, 1);
else
bReturn = it->second <= std::min(condition - CONTAINER_STATIC, -1);
}
}
}
else if (condition == SLIDESHOW_ISPAUSED)
{
CGUIWindowSlideShow *slideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
bReturn = (slideShow && slideShow->IsPaused());
}
else if (condition == SLIDESHOW_ISRANDOM)
{
CGUIWindowSlideShow *slideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
bReturn = (slideShow && slideShow->IsShuffled());
}
else if (condition == SLIDESHOW_ISACTIVE)
{
CGUIWindowSlideShow *slideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
bReturn = (slideShow && slideShow->InSlideShow());
}
else if (condition == SLIDESHOW_ISVIDEO)
{
CGUIWindowSlideShow *slideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
bReturn = (slideShow && slideShow->GetCurrentSlide() && slideShow->GetCurrentSlide()->IsVideo());
}
else if (g_application.m_pPlayer->IsPlaying())
{
switch (condition)
{
case PLAYER_HAS_MEDIA:
bReturn = true;
break;
case PLAYER_HAS_AUDIO:
bReturn = g_application.m_pPlayer->IsPlayingAudio();
break;
case PLAYER_HAS_VIDEO:
bReturn = g_application.m_pPlayer->IsPlayingVideo();
break;
case PLAYER_PLAYING:
bReturn = !g_application.m_pPlayer->IsPausedPlayback() && (g_application.m_pPlayer->GetPlaySpeed() == 1);
break;
case PLAYER_PAUSED:
bReturn = g_application.m_pPlayer->IsPausedPlayback();
break;
case PLAYER_REWINDING:
bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() < 1;
break;
case PLAYER_FORWARDING:
bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() > 1;
break;
case PLAYER_REWINDING_2x:
bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == -2;
break;
case PLAYER_REWINDING_4x:
bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == -4;
break;
case PLAYER_REWINDING_8x:
bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == -8;
break;
case PLAYER_REWINDING_16x:
bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == -16;
break;
case PLAYER_REWINDING_32x:
bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == -32;
break;
case PLAYER_FORWARDING_2x:
bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == 2;
break;
case PLAYER_FORWARDING_4x:
bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == 4;
break;
case PLAYER_FORWARDING_8x:
bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == 8;
break;
case PLAYER_FORWARDING_16x:
bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == 16;
break;
case PLAYER_FORWARDING_32x:
bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == 32;
break;
case PLAYER_CAN_RECORD:
bReturn = g_application.m_pPlayer->CanRecord();
break;
case PLAYER_CAN_PAUSE:
bReturn = g_application.m_pPlayer->CanPause();
break;
case PLAYER_CAN_SEEK:
bReturn = g_application.m_pPlayer->CanSeek();
break;
case PLAYER_RECORDING:
bReturn = g_application.m_pPlayer->IsRecording();
break;
case PLAYER_DISPLAY_AFTER_SEEK:
bReturn = GetDisplayAfterSeek();
break;
case PLAYER_CACHING:
bReturn = g_application.m_pPlayer->IsCaching();
break;
case PLAYER_SEEKBAR:
{
CGUIDialog *seekBar = (CGUIDialog*)g_windowManager.GetWindow(WINDOW_DIALOG_SEEK_BAR);
bReturn = seekBar ? seekBar->IsDialogRunning() : false;
}
break;
case PLAYER_SEEKING:
bReturn = m_playerSeeking;
break;
case PLAYER_SHOWTIME:
bReturn = m_playerShowTime;
break;
case PLAYER_PASSTHROUGH:
bReturn = g_application.m_pPlayer->IsPassthrough();
break;
case PLAYER_ISINTERNETSTREAM:
bReturn = m_currentFile && URIUtils::IsInternetStream(m_currentFile->GetPath());
break;
case MUSICPM_ENABLED:
bReturn = g_partyModeManager.IsEnabled();
break;
case MUSICPLAYER_HASPREVIOUS:
{
// requires current playlist be PLAYLIST_MUSIC
bReturn = false;
if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
bReturn = (g_playlistPlayer.GetCurrentSong() > 0); // not first song
}
break;
case MUSICPLAYER_HASNEXT:
{
// requires current playlist be PLAYLIST_MUSIC
bReturn = false;
if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
bReturn = (g_playlistPlayer.GetCurrentSong() < (g_playlistPlayer.GetPlaylist(PLAYLIST_MUSIC).size() - 1)); // not last song
}
break;
case MUSICPLAYER_PLAYLISTPLAYING:
{
bReturn = false;
if (g_application.m_pPlayer->IsPlayingAudio() && g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
bReturn = true;
}
break;
case VIDEOPLAYER_USING_OVERLAYS:
bReturn = (CSettings::Get().GetInt("videoplayer.rendermethod") == RENDER_OVERLAYS);
break;
case VIDEOPLAYER_ISFULLSCREEN:
bReturn = g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO;
break;
case VIDEOPLAYER_HASMENU:
bReturn = g_application.m_pPlayer->HasMenu();
break;
case PLAYLIST_ISRANDOM:
bReturn = g_playlistPlayer.IsShuffled(g_playlistPlayer.GetCurrentPlaylist());
break;
case PLAYLIST_ISREPEAT:
bReturn = g_playlistPlayer.GetRepeat(g_playlistPlayer.GetCurrentPlaylist()) == PLAYLIST::REPEAT_ALL;
break;
case PLAYLIST_ISREPEATONE:
bReturn = g_playlistPlayer.GetRepeat(g_playlistPlayer.GetCurrentPlaylist()) == PLAYLIST::REPEAT_ONE;
break;
case PLAYER_HASDURATION:
bReturn = g_application.GetTotalTime() > 0;
break;
case VIDEOPLAYER_HASTELETEXT:
if (g_application.m_pPlayer->GetTeletextCache())
bReturn = true;
break;
case VIDEOPLAYER_HASSUBTITLES:
bReturn = g_application.m_pPlayer->GetSubtitleCount() > 0;
break;
case VIDEOPLAYER_SUBTITLESENABLED:
bReturn = g_application.m_pPlayer->GetSubtitleVisible();
break;
case VISUALISATION_LOCKED:
{
CGUIMessage msg(GUI_MSG_GET_VISUALISATION, 0, 0);
g_windowManager.SendMessage(msg);
if (msg.GetPointer())
{
CVisualisation *pVis = (CVisualisation *)msg.GetPointer();
bReturn = pVis->IsLocked();
}
}
break;
case VISUALISATION_ENABLED:
bReturn = !CSettings::Get().GetString("musicplayer.visualisation").empty();
break;
case VIDEOPLAYER_HAS_EPG:
if (m_currentFile->HasPVRChannelInfoTag())
{
CEpgInfoTag epgTag;
bReturn = m_currentFile->GetPVRChannelInfoTag()->GetEPGNow(epgTag);
}
break;
case VIDEOPLAYER_IS_STEREOSCOPIC:
if(g_application.m_pPlayer->IsPlaying())
{
bReturn = !m_videoInfo.stereoMode.empty();
}
break;
default: // default, use integer value different from 0 as true
{
int val;
bReturn = GetInt(val, condition) && val != 0;
}
}
}
if (condition1 < 0)
bReturn = !bReturn;
return bReturn;
}
/// \brief Examines the multi information sent and returns true or false accordingly.
bool CGUIInfoManager::GetMultiInfoBool(const GUIInfo &info, int contextWindow, const CGUIListItem *item)
{
bool bReturn = false;
int condition = abs(info.m_info);
if (condition >= LISTITEM_START && condition <= LISTITEM_END)
{
if (!item)
{
CGUIWindow *window = NULL;
int data1 = info.GetData1();
if (!data1) // No container specified, so we lookup the current view container
{
window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS);
if (window && window->IsMediaWindow())
data1 = ((CGUIMediaWindow*)(window))->GetViewContainerID();
}
if (!window) // If we don't have a window already (from lookup above), get one
window = GetWindowWithCondition(contextWindow, 0);
if (window)
{
const CGUIControl *control = window->GetControl(data1);
if (control && control->IsContainer())
item = ((IGUIContainer *)control)->GetListItem(info.GetData2(), info.GetInfoFlag()).get();
}
}
if (item) // If we got a valid item, do the lookup
bReturn = GetItemBool(item, condition); // Image prioritizes images over labels (in the case of music item ratings for instance)
}
else
{
switch (condition)
{
case SKIN_BOOL:
{
bReturn = CSkinSettings::Get().GetBool(info.GetData1());
}
break;
case SKIN_STRING:
{
if (info.GetData2())
bReturn = StringUtils::EqualsNoCase(CSkinSettings::Get().GetString(info.GetData1()), m_stringParameters[info.GetData2()]);
else
bReturn = !CSkinSettings::Get().GetString(info.GetData1()).empty();
}
break;
case SKIN_HAS_THEME:
{
CStdString theme = CSettings::Get().GetString("lookandfeel.skintheme");
URIUtils::RemoveExtension(theme);
bReturn = StringUtils::EqualsNoCase(theme, m_stringParameters[info.GetData1()]);
}
break;
case STRING_IS_EMPTY:
// note: Get*Image() falls back to Get*Label(), so this should cover all of them
if (item && item->IsFileItem() && info.GetData1() >= LISTITEM_START && info.GetData1() < LISTITEM_END)
bReturn = GetItemImage((const CFileItem *)item, info.GetData1()).empty();
else
bReturn = GetImage(info.GetData1(), contextWindow).empty();
break;
case STRING_COMPARE:
{
CStdString compare;
if (info.GetData2() < 0) // info labels are stored with negative numbers
{
int info2 = -info.GetData2();
if (item && item->IsFileItem() && info2 >= LISTITEM_START && info2 < LISTITEM_END)
compare = GetItemImage((const CFileItem *)item, info2);
else
compare = GetImage(info2, contextWindow);
}
else if (info.GetData2() < (int)m_stringParameters.size())
{ // conditional string
compare = m_stringParameters[info.GetData2()];
}
if (item && item->IsFileItem() && info.GetData1() >= LISTITEM_START && info.GetData1() < LISTITEM_END)
bReturn = GetItemImage((const CFileItem *)item, info.GetData1()).Equals(compare);
else
bReturn = GetImage(info.GetData1(), contextWindow).Equals(compare);
}
break;
case INTEGER_GREATER_THAN:
{
int integer;
if (GetInt(integer, info.GetData1(), contextWindow, item))
bReturn = integer > info.GetData2();
else
{
CStdString value;
if (item && item->IsFileItem() && info.GetData1() >= LISTITEM_START && info.GetData1() < LISTITEM_END)
value = GetItemImage((const CFileItem *)item, info.GetData1());
else
value = GetImage(info.GetData1(), contextWindow);
// Handle the case when a value contains time separator (:). This makes IntegerGreaterThan
// useful for Player.Time* members without adding a separate set of members returning time in seconds
if ( value.find_first_of( ':' ) != value.npos )
bReturn = StringUtils::TimeStringToSeconds( value ) > info.GetData2();
else
bReturn = atoi( value.c_str() ) > info.GetData2();
}
}
break;
case STRING_STR:
case STRING_STR_LEFT:
case STRING_STR_RIGHT:
{
CStdString compare = m_stringParameters[info.GetData2()];
// our compare string is already in lowercase, so lower case our label as well
// as CStdString::Find() is case sensitive
CStdString label;
if (item && item->IsFileItem() && info.GetData1() >= LISTITEM_START && info.GetData1() < LISTITEM_END)
{
label = GetItemImage((const CFileItem *)item, info.GetData1());
StringUtils::ToLower(label);
}
else
{
label = GetImage(info.GetData1(), contextWindow);
StringUtils::ToLower(label);
}
if (condition == STRING_STR_LEFT)
bReturn = StringUtils::StartsWith(label, compare);
else if (condition == STRING_STR_RIGHT)
bReturn = StringUtils::EndsWith(label, compare);
else
bReturn = label.find(compare) != std::string::npos;
}
break;
case SYSTEM_ALARM_LESS_OR_EQUAL:
{
int time = lrint(g_alarmClock.GetRemaining(m_stringParameters[info.GetData1()]));
int timeCompare = atoi(m_stringParameters[info.GetData2()].c_str());
if (time > 0)
bReturn = timeCompare >= time;
else
bReturn = false;
}
break;
case SYSTEM_IDLE_TIME:
bReturn = g_application.GlobalIdleTime() >= (int)info.GetData1();
break;
case CONTROL_GROUP_HAS_FOCUS:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
bReturn = window->ControlGroupHasFocus(info.GetData1(), info.GetData2());
}
break;
case CONTROL_IS_VISIBLE:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
{
// Note: This'll only work for unique id's
const CGUIControl *control = window->GetControl(info.GetData1());
if (control)
bReturn = control->IsVisible();
}
}
break;
case CONTROL_IS_ENABLED:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
{
// Note: This'll only work for unique id's
const CGUIControl *control = window->GetControl(info.GetData1());
if (control)
bReturn = !control->IsDisabled();
}
}
break;
case CONTROL_HAS_FOCUS:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
bReturn = (window->GetFocusedControlID() == (int)info.GetData1());
}
break;
case WINDOW_NEXT:
if (info.GetData1())
bReturn = ((int)info.GetData1() == m_nextWindowID);
else
{
CGUIWindow *window = g_windowManager.GetWindow(m_nextWindowID);
if (window && StringUtils::EqualsNoCase(URIUtils::GetFileName(window->GetProperty("xmlfile").asString()), m_stringParameters[info.GetData2()]))
bReturn = true;
}
break;
case WINDOW_PREVIOUS:
if (info.GetData1())
bReturn = ((int)info.GetData1() == m_prevWindowID);
else
{
CGUIWindow *window = g_windowManager.GetWindow(m_prevWindowID);
if (window && StringUtils::EqualsNoCase(URIUtils::GetFileName(window->GetProperty("xmlfile").asString()), m_stringParameters[info.GetData2()]))
bReturn = true;
}
break;
case WINDOW_IS_VISIBLE:
if (info.GetData1())
bReturn = g_windowManager.IsWindowVisible(info.GetData1());
else
bReturn = g_windowManager.IsWindowVisible(m_stringParameters[info.GetData2()]);
break;
case WINDOW_IS_TOPMOST:
if (info.GetData1())
bReturn = g_windowManager.IsWindowTopMost(info.GetData1());
else
bReturn = g_windowManager.IsWindowTopMost(m_stringParameters[info.GetData2()]);
break;
case WINDOW_IS_ACTIVE:
if (info.GetData1())
bReturn = g_windowManager.IsWindowActive(info.GetData1());
else
bReturn = g_windowManager.IsWindowActive(m_stringParameters[info.GetData2()]);
break;
case SYSTEM_HAS_ALARM:
bReturn = g_alarmClock.HasAlarm(m_stringParameters[info.GetData1()]);
break;
case SYSTEM_GET_BOOL:
bReturn = CSettings::Get().GetBool(m_stringParameters[info.GetData1()]);
break;
case SYSTEM_HAS_CORE_ID:
bReturn = g_cpuInfo.HasCoreId(info.GetData1());
break;
case SYSTEM_SETTING:
{
if ( StringUtils::EqualsNoCase(m_stringParameters[info.GetData1()], "hidewatched") )
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
bReturn = CMediaSettings::Get().GetWatchedMode(((CGUIMediaWindow *)window)->CurrentDirectory().GetContent()) == WatchedModeUnwatched;
}
}
break;
case SYSTEM_HAS_ADDON:
{
AddonPtr addon;
bReturn = CAddonMgr::Get().GetAddon(m_stringParameters[info.GetData1()],addon) && addon;
break;
}
case CONTAINER_SCROLL_PREVIOUS:
case CONTAINER_MOVE_PREVIOUS:
case CONTAINER_MOVE_NEXT:
case CONTAINER_SCROLL_NEXT:
{
map<int,int>::const_iterator it = m_containerMoves.find(info.GetData1());
if (it != m_containerMoves.end())
{
if (condition > CONTAINER_STATIC) // moving up
bReturn = it->second >= std::max(condition - CONTAINER_STATIC, 1);
else
bReturn = it->second <= std::min(condition - CONTAINER_STATIC, -1);
}
}
break;
case CONTAINER_CONTENT:
{
CStdString content;
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
{
if (window->GetID() == WINDOW_DIALOG_MUSIC_INFO)
content = ((CGUIDialogMusicInfo *)window)->CurrentDirectory().GetContent();
else if (window->GetID() == WINDOW_DIALOG_VIDEO_INFO)
content = ((CGUIDialogVideoInfo *)window)->CurrentDirectory().GetContent();
}
if (content.empty())
{
window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
content = ((CGUIMediaWindow *)window)->CurrentDirectory().GetContent();
}
bReturn = StringUtils::EqualsNoCase(m_stringParameters[info.GetData2()], content);
}
break;
case CONTAINER_ROW:
case CONTAINER_COLUMN:
case CONTAINER_POSITION:
case CONTAINER_HAS_NEXT:
case CONTAINER_HAS_PREVIOUS:
case CONTAINER_SCROLLING:
case CONTAINER_SUBITEM:
case CONTAINER_ISUPDATING:
{
const CGUIControl *control = NULL;
if (info.GetData1())
{ // container specified
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
control = window->GetControl(info.GetData1());
}
else
{ // no container specified - assume a mediawindow
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
control = window->GetControl(window->GetViewContainerID());
}
if (control)
bReturn = control->GetCondition(condition, info.GetData2());
}
break;
case CONTAINER_HAS_FOCUS:
{ // grab our container
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
{
const CGUIControl *control = window->GetControl(info.GetData1());
if (control && control->IsContainer())
{
CFileItemPtr item = boost::static_pointer_cast<CFileItem>(((IGUIContainer *)control)->GetListItem(0));
if (item && item->m_iprogramCount == info.GetData2()) // programcount used to store item id
bReturn = true;
}
}
break;
}
case VIDEOPLAYER_CONTENT:
{
CStdString strContent="files";
if (m_currentFile->HasVideoInfoTag() && m_currentFile->GetVideoInfoTag()->m_type == MediaTypeMovie)
strContent = "movies";
if (m_currentFile->HasVideoInfoTag() && m_currentFile->GetVideoInfoTag()->m_iSeason > -1) // episode
strContent = "episodes";
if (m_currentFile->HasVideoInfoTag() && !m_currentFile->GetVideoInfoTag()->m_artist.empty())
strContent = "musicvideos";
if (m_currentFile->HasVideoInfoTag() && m_currentFile->GetVideoInfoTag()->m_strStatus == "livetv")
strContent = "livetv";
if (m_currentFile->HasPVRChannelInfoTag())
strContent = "livetv";
bReturn = StringUtils::EqualsNoCase(m_stringParameters[info.GetData1()], strContent);
}
break;
case CONTAINER_SORT_METHOD:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
{
const CGUIViewState *viewState = ((CGUIMediaWindow*)window)->GetViewState();
if (viewState)
bReturn = ((unsigned int)viewState->GetSortMethod().sortBy == info.GetData1());
}
break;
}
case CONTAINER_SORT_DIRECTION:
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
{
const CGUIViewState *viewState = ((CGUIMediaWindow*)window)->GetViewState();
if (viewState)
bReturn = ((unsigned int)viewState->GetDisplaySortOrder() == info.GetData1());
}
break;
}
case SYSTEM_DATE:
{
if (info.GetData2() == -1) // info doesn't contain valid startDate
return false;
CDateTime date = CDateTime::GetCurrentDateTime();
int currentDate = date.GetMonth()*100+date.GetDay();
int startDate = info.GetData1();
int stopDate = info.GetData2();
if (stopDate < startDate)
bReturn = currentDate >= startDate || currentDate < stopDate;
else
bReturn = currentDate >= startDate && currentDate < stopDate;
}
break;
case SYSTEM_TIME:
{
CDateTime time=CDateTime::GetCurrentDateTime();
int currentTime = time.GetMinuteOfDay();
int startTime = info.GetData1();
int stopTime = info.GetData2();
if (stopTime < startTime)
bReturn = currentTime >= startTime || currentTime < stopTime;
else
bReturn = currentTime >= startTime && currentTime < stopTime;
}
break;
case MUSICPLAYER_EXISTS:
{
int index = info.GetData2();
if (info.GetData1() == 1)
{ // relative index
if (g_playlistPlayer.GetCurrentPlaylist() != PLAYLIST_MUSIC)
{
bReturn = false;
break;
}
index += g_playlistPlayer.GetCurrentSong();
}
bReturn = (index >= 0 && index < g_playlistPlayer.GetPlaylist(PLAYLIST_MUSIC).size());
}
break;
case PLAYLIST_ISRANDOM:
{
int playlistid = info.GetData1();
if (playlistid > PLAYLIST_NONE)
bReturn = g_playlistPlayer.IsShuffled(playlistid);
}
break;
case PLAYLIST_ISREPEAT:
{
int playlistid = info.GetData1();
if (playlistid > PLAYLIST_NONE)
bReturn = g_playlistPlayer.GetRepeat(playlistid) == PLAYLIST::REPEAT_ALL;
}
break;
case PLAYLIST_ISREPEATONE:
{
int playlistid = info.GetData1();
if (playlistid > PLAYLIST_NONE)
bReturn = g_playlistPlayer.GetRepeat(playlistid) == PLAYLIST::REPEAT_ONE;
}
break;
}
}
return (info.m_info < 0) ? !bReturn : bReturn;
}
bool CGUIInfoManager::GetMultiInfoInt(int &value, const GUIInfo &info, int contextWindow) const
{
if (info.m_info >= LISTITEM_START && info.m_info <= LISTITEM_END)
{
CFileItemPtr item;
CGUIWindow *window = NULL;
int data1 = info.GetData1();
if (!data1) // No container specified, so we lookup the current view container
{
window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS);
if (window && window->IsMediaWindow())
data1 = ((CGUIMediaWindow*)(window))->GetViewContainerID();
}
if (!window) // If we don't have a window already (from lookup above), get one
window = GetWindowWithCondition(contextWindow, 0);
if (window)
{
const CGUIControl *control = window->GetControl(data1);
if (control && control->IsContainer())
item = boost::static_pointer_cast<CFileItem>(((IGUIContainer *)control)->GetListItem(info.GetData2(), info.GetInfoFlag()));
}
if (item) // If we got a valid item, do the lookup
return GetItemInt(value, item.get(), info.m_info);
}
return 0;
}
/// \brief Examines the multi information sent and returns the string as appropriate
CStdString CGUIInfoManager::GetMultiInfoLabel(const GUIInfo &info, int contextWindow, std::string *fallback)
{
if (info.m_info == SKIN_STRING)
{
return CSkinSettings::Get().GetString(info.GetData1());
}
else if (info.m_info == SKIN_BOOL)
{
bool bInfo = CSkinSettings::Get().GetBool(info.GetData1());
if (bInfo)
return g_localizeStrings.Get(20122);
}
if (info.m_info >= LISTITEM_START && info.m_info <= LISTITEM_END)
{
CFileItemPtr item;
CGUIWindow *window = NULL;
int data1 = info.GetData1();
if (!data1) // No container specified, so we lookup the current view container
{
window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS);
if (window && window->IsMediaWindow())
data1 = ((CGUIMediaWindow*)(window))->GetViewContainerID();
}
if (!window) // If we don't have a window already (from lookup above), get one
window = GetWindowWithCondition(contextWindow, 0);
if (window)
{
const CGUIControl *control = window->GetControl(data1);
if (control && control->IsContainer())
item = boost::static_pointer_cast<CFileItem>(((IGUIContainer *)control)->GetListItem(info.GetData2(), info.GetInfoFlag()));
}
if (item) // If we got a valid item, do the lookup
return GetItemImage(item.get(), info.m_info, fallback); // Image prioritizes images over labels (in the case of music item ratings for instance)
}
else if (info.m_info == PLAYER_TIME)
{
return GetCurrentPlayTime((TIME_FORMAT)info.GetData1());
}
else if (info.m_info == PLAYER_TIME_REMAINING)
{
return GetCurrentPlayTimeRemaining((TIME_FORMAT)info.GetData1());
}
else if (info.m_info == PLAYER_FINISH_TIME)
{
CDateTime time;
CEpgInfoTag currentTag;
if (GetEpgInfoTag(currentTag))
time = currentTag.EndAsLocalTime();
else
{
time = CDateTime::GetCurrentDateTime();
time += CDateTimeSpan(0, 0, 0, GetPlayTimeRemaining());
}
return LocalizeTime(time, (TIME_FORMAT)info.GetData1());
}
else if (info.m_info == PLAYER_START_TIME)
{
CDateTime time;
CEpgInfoTag currentTag;
if (GetEpgInfoTag(currentTag))
time = currentTag.StartAsLocalTime();
else
{
time = CDateTime::GetCurrentDateTime();
time -= CDateTimeSpan(0, 0, 0, (int)GetPlayTime());
}
return LocalizeTime(time, (TIME_FORMAT)info.GetData1());
}
else if (info.m_info == PLAYER_TIME_SPEED)
{
CStdString strTime;
if (g_application.m_pPlayer->GetPlaySpeed() != 1)
strTime = StringUtils::Format("%s (%ix)", GetCurrentPlayTime((TIME_FORMAT)info.GetData1()).c_str(), g_application.m_pPlayer->GetPlaySpeed());
else
strTime = GetCurrentPlayTime();
return strTime;
}
else if (info.m_info == PLAYER_DURATION)
{
return GetDuration((TIME_FORMAT)info.GetData1());
}
else if (info.m_info == PLAYER_SEEKTIME)
{
return GetCurrentSeekTime((TIME_FORMAT)info.GetData1());
}
else if (info.m_info == PLAYER_SEEKOFFSET)
{
CStdString seekOffset = StringUtils::SecondsToTimeString(abs(m_seekOffset / 1000), (TIME_FORMAT)info.GetData1());
if (m_seekOffset < 0)
return "-" + seekOffset;
if (m_seekOffset > 0)
return "+" + seekOffset;
}
else if (info.m_info == PLAYER_ITEM_ART)
{
return m_currentFile->GetArt(m_stringParameters[info.GetData1()]);
}
else if (info.m_info == SYSTEM_TIME)
{
return GetTime((TIME_FORMAT)info.GetData1());
}
else if (info.m_info == SYSTEM_DATE)
{
CDateTime time=CDateTime::GetCurrentDateTime();
return time.GetAsLocalizedDate(m_stringParameters[info.GetData1()],false);
}
else if (info.m_info == CONTAINER_NUM_PAGES || info.m_info == CONTAINER_CURRENT_PAGE ||
info.m_info == CONTAINER_NUM_ITEMS || info.m_info == CONTAINER_POSITION)
{
const CGUIControl *control = NULL;
if (info.GetData1())
{ // container specified
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
control = window->GetControl(info.GetData1());
}
else
{ // no container specified - assume a mediawindow
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
control = window->GetControl(window->GetViewContainerID());
}
if (control)
{
if (control->IsContainer())
return ((IGUIContainer *)control)->GetLabel(info.m_info);
else if (control->GetControlType() == CGUIControl::GUICONTROL_TEXTBOX)
return ((CGUITextBox *)control)->GetLabel(info.m_info);
}
}
else if (info.m_info == SYSTEM_GET_CORE_USAGE)
{
CStdString strCpu = StringUtils::Format("%4.2f", g_cpuInfo.GetCoreInfo(atoi(m_stringParameters[info.GetData1()].c_str())).m_fPct);
return strCpu;
}
else if (info.m_info >= MUSICPLAYER_TITLE && info.m_info <= MUSICPLAYER_ALBUM_ARTIST)
return GetMusicPlaylistInfo(info);
else if (info.m_info == CONTAINER_PROPERTY)
{
CGUIWindow *window = NULL;
if (info.GetData1())
{ // container specified
window = GetWindowWithCondition(contextWindow, 0);
}
else
{ // no container specified - assume a mediawindow
window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
}
if (window)
return ((CGUIMediaWindow *)window)->CurrentDirectory().GetProperty(m_stringParameters[info.GetData2()]).asString();
}
else if (info.m_info == CONTROL_GET_LABEL)
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, 0);
if (window)
{
const CGUIControl *control = window->GetControl(info.GetData1());
if (control)
return control->GetDescription();
}
}
else if (info.m_info == WINDOW_PROPERTY)
{
CGUIWindow *window = NULL;
if (info.GetData1())
{ // window specified
window = g_windowManager.GetWindow(info.GetData1());//GetWindowWithCondition(contextWindow, 0);
}
else
{ // no window specified - assume active
window = GetWindowWithCondition(contextWindow, 0);
}
if (window)
return window->GetProperty(m_stringParameters[info.GetData2()]).asString();
}
else if (info.m_info == SYSTEM_ADDON_TITLE ||
info.m_info == SYSTEM_ADDON_ICON ||
info.m_info == SYSTEM_ADDON_VERSION)
{
// This logic does not check/care whether an addon has been disabled/marked as broken,
// it simply retrieves it's name or icon that means if an addon is placed on the home screen it
// will stay there even if it's disabled/marked as broken. This might need to be changed/fixed
// in the future.
AddonPtr addon;
if (info.GetData2() == 0)
CAddonMgr::Get().GetAddon(const_cast<CGUIInfoManager*>(this)->GetLabel(info.GetData1(), contextWindow),addon,ADDON_UNKNOWN,false);
else
CAddonMgr::Get().GetAddon(m_stringParameters[info.GetData1()],addon,ADDON_UNKNOWN,false);
if (addon && info.m_info == SYSTEM_ADDON_TITLE)
return addon->Name();
if (addon && info.m_info == SYSTEM_ADDON_ICON)
return addon->Icon();
if (addon && info.m_info == SYSTEM_ADDON_VERSION)
return addon->Version().asString();
}
else if (info.m_info == PLAYLIST_LENGTH ||
info.m_info == PLAYLIST_POSITION ||
info.m_info == PLAYLIST_RANDOM ||
info.m_info == PLAYLIST_REPEAT)
{
int playlistid = info.GetData1();
if (playlistid > PLAYLIST_NONE)
return GetPlaylistLabel(info.m_info, playlistid);
}
return StringUtils::EmptyString;
}
/// \brief Obtains the filename of the image to show from whichever subsystem is needed
CStdString CGUIInfoManager::GetImage(int info, int contextWindow, std::string *fallback)
{
if (info >= CONDITIONAL_LABEL_START && info <= CONDITIONAL_LABEL_END)
return GetSkinVariableString(info, true);
if (info >= MULTI_INFO_START && info <= MULTI_INFO_END)
{
return GetMultiInfoLabel(m_multiInfo[info - MULTI_INFO_START], contextWindow, fallback);
}
else if (info == WEATHER_CONDITIONS)
return g_weatherManager.GetInfo(WEATHER_IMAGE_CURRENT_ICON);
else if (info == SYSTEM_PROFILETHUMB)
{
CStdString thumb = CProfilesManager::Get().GetCurrentProfile().getThumb();
if (thumb.empty())
thumb = "unknown-user.png";
return thumb;
}
else if (info == MUSICPLAYER_COVER)
{
if (!g_application.m_pPlayer->IsPlayingAudio()) return "";
if (fallback)
*fallback = "DefaultAlbumCover.png";
return m_currentFile->HasArt("thumb") ? m_currentFile->GetArt("thumb") : "DefaultAlbumCover.png";
}
else if (info == MUSICPLAYER_RATING)
{
if (!g_application.m_pPlayer->IsPlayingAudio()) return "";
return GetItemImage(m_currentFile, LISTITEM_RATING);
}
else if (info == PLAYER_STAR_RATING)
{
if (!g_application.m_pPlayer->IsPlaying()) return "";
return GetItemImage(m_currentFile, LISTITEM_STAR_RATING);
}
else if (info == VIDEOPLAYER_COVER)
{
if (!g_application.m_pPlayer->IsPlayingVideo()) return "";
if (fallback)
*fallback = "DefaultVideoCover.png";
if(m_currentMovieThumb.empty())
return m_currentFile->HasArt("thumb") ? m_currentFile->GetArt("thumb") : "DefaultVideoCover.png";
else return m_currentMovieThumb;
}
else if (info == CONTAINER_FOLDERTHUMB)
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
return GetItemImage(&const_cast<CFileItemList&>(((CGUIMediaWindow*)window)->CurrentDirectory()), LISTITEM_THUMB, fallback);
}
else if (info == CONTAINER_TVSHOWTHUMB)
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
return ((CGUIMediaWindow *)window)->CurrentDirectory().GetArt("tvshow.thumb");
}
else if (info == CONTAINER_SEASONTHUMB)
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_IS_MEDIA_WINDOW);
if (window)
return ((CGUIMediaWindow *)window)->CurrentDirectory().GetArt("season.thumb");
}
else if (info == LISTITEM_THUMB || info == LISTITEM_ICON || info == LISTITEM_ACTUAL_ICON ||
info == LISTITEM_OVERLAY || info == LISTITEM_RATING || info == LISTITEM_STAR_RATING)
{
CGUIWindow *window = GetWindowWithCondition(contextWindow, WINDOW_CONDITION_HAS_LIST_ITEMS);
if (window)
{
CFileItemPtr item = window->GetCurrentListItem();
if (item)
return GetItemImage(item.get(), info, fallback);
}
}
return GetLabel(info, contextWindow, fallback);
}
CStdString CGUIInfoManager::GetDate(bool bNumbersOnly)
{
CDateTime time=CDateTime::GetCurrentDateTime();
return time.GetAsLocalizedDate(!bNumbersOnly);
}
CStdString CGUIInfoManager::GetTime(TIME_FORMAT format) const
{
CDateTime time=CDateTime::GetCurrentDateTime();
return LocalizeTime(time, format);
}
CStdString CGUIInfoManager::LocalizeTime(const CDateTime &time, TIME_FORMAT format) const
{
const CStdString timeFormat = g_langInfo.GetTimeFormat();
bool use12hourclock = timeFormat.find('h') != std::string::npos;
switch (format)
{
case TIME_FORMAT_GUESS:
return time.GetAsLocalizedTime("", false);
case TIME_FORMAT_SS:
return time.GetAsLocalizedTime("ss", true);
case TIME_FORMAT_MM:
return time.GetAsLocalizedTime("mm", true);
case TIME_FORMAT_MM_SS:
return time.GetAsLocalizedTime("mm:ss", true);
case TIME_FORMAT_HH: // this forces it to a 12 hour clock
return time.GetAsLocalizedTime(use12hourclock ? "h" : "HH", false);
case TIME_FORMAT_HH_MM:
return time.GetAsLocalizedTime(use12hourclock ? "h:mm" : "HH:mm", false);
case TIME_FORMAT_HH_MM_XX:
return time.GetAsLocalizedTime(use12hourclock ? "h:mm xx" : "HH:mm", false);
case TIME_FORMAT_HH_MM_SS:
return time.GetAsLocalizedTime(use12hourclock ? "hh:mm:ss" : "HH:mm:ss", true);
case TIME_FORMAT_HH_MM_SS_XX:
return time.GetAsLocalizedTime(use12hourclock ? "hh:mm:ss xx" : "HH:mm:ss", true);
case TIME_FORMAT_H:
return time.GetAsLocalizedTime("h", false);
case TIME_FORMAT_H_MM_SS:
return time.GetAsLocalizedTime("h:mm:ss", true);
case TIME_FORMAT_H_MM_SS_XX:
return time.GetAsLocalizedTime("h:mm:ss xx", true);
case TIME_FORMAT_XX:
return use12hourclock ? time.GetAsLocalizedTime("xx", false) : "";
default:
break;
}
return time.GetAsLocalizedTime("", false);
}
CStdString CGUIInfoManager::GetDuration(TIME_FORMAT format) const
{
if (g_application.m_pPlayer->IsPlayingAudio() && m_currentFile->HasMusicInfoTag())
{
const CMusicInfoTag& tag = *m_currentFile->GetMusicInfoTag();
if (tag.GetDuration() > 0)
return StringUtils::SecondsToTimeString(tag.GetDuration(), format);
}
if (g_application.m_pPlayer->IsPlayingVideo() && !m_currentMovieDuration.empty())
return m_currentMovieDuration; // for tuxbox
unsigned int iTotal = (unsigned int)g_application.GetTotalTime();
if (iTotal > 0)
return StringUtils::SecondsToTimeString(iTotal, format);
return "";
}
CStdString CGUIInfoManager::GetMusicPartyModeLabel(int item)
{
// get song counts
if (item >= MUSICPM_SONGSPLAYED && item <= MUSICPM_RANDOMSONGSPICKED)
{
int iSongs = -1;
switch (item)
{
case MUSICPM_SONGSPLAYED:
{
iSongs = g_partyModeManager.GetSongsPlayed();
break;
}
case MUSICPM_MATCHINGSONGS:
{
iSongs = g_partyModeManager.GetMatchingSongs();
break;
}
case MUSICPM_MATCHINGSONGSPICKED:
{
iSongs = g_partyModeManager.GetMatchingSongsPicked();
break;
}
case MUSICPM_MATCHINGSONGSLEFT:
{
iSongs = g_partyModeManager.GetMatchingSongsLeft();
break;
}
case MUSICPM_RELAXEDSONGSPICKED:
{
iSongs = g_partyModeManager.GetRelaxedSongs();
break;
}
case MUSICPM_RANDOMSONGSPICKED:
{
iSongs = g_partyModeManager.GetRandomSongs();
break;
}
}
if (iSongs < 0)
return "";
CStdString strLabel = StringUtils::Format("%i", iSongs);
return strLabel;
}
return "";
}
const CStdString CGUIInfoManager::GetMusicPlaylistInfo(const GUIInfo& info)
{
PLAYLIST::CPlayList& playlist = g_playlistPlayer.GetPlaylist(PLAYLIST_MUSIC);
if (playlist.size() < 1)
return "";
int index = info.GetData2();
if (info.GetData1() == 1)
{ // relative index (requires current playlist is PLAYLIST_MUSIC)
if (g_playlistPlayer.GetCurrentPlaylist() != PLAYLIST_MUSIC)
return "";
index = g_playlistPlayer.GetNextSong(index);
}
if (index < 0 || index >= playlist.size())
return "";
CFileItemPtr playlistItem = playlist[index];
if (!playlistItem->GetMusicInfoTag()->Loaded())
{
playlistItem->LoadMusicTag();
playlistItem->GetMusicInfoTag()->SetLoaded();
}
// try to set a thumbnail
if (!playlistItem->HasArt("thumb"))
{
CMusicThumbLoader loader;
loader.LoadItem(playlistItem.get());
// still no thumb? then just the set the default cover
if (!playlistItem->HasArt("thumb"))
playlistItem->SetArt("thumb", "DefaultAlbumCover.png");
}
if (info.m_info == MUSICPLAYER_PLAYLISTPOS)
{
CStdString strPosition = StringUtils::Format("%i", index + 1);
return strPosition;
}
else if (info.m_info == MUSICPLAYER_COVER)
return playlistItem->GetArt("thumb");
return GetMusicTagLabel(info.m_info, playlistItem.get());
}
CStdString CGUIInfoManager::GetPlaylistLabel(int item, int playlistid /* = PLAYLIST_NONE */) const
{
if (playlistid <= PLAYLIST_NONE && !g_application.m_pPlayer->IsPlaying())
return "";
int iPlaylist = playlistid == PLAYLIST_NONE ? g_playlistPlayer.GetCurrentPlaylist() : playlistid;
switch (item)
{
case PLAYLIST_LENGTH:
{
return StringUtils::Format("%i", g_playlistPlayer.GetPlaylist(iPlaylist).size());;
}
case PLAYLIST_POSITION:
{
return StringUtils::Format("%i", g_playlistPlayer.GetCurrentSong() + 1);
}
case PLAYLIST_RANDOM:
{
if (g_playlistPlayer.IsShuffled(iPlaylist))
return g_localizeStrings.Get(590); // 590: Random
else
return g_localizeStrings.Get(591); // 591: Off
}
case PLAYLIST_REPEAT:
{
PLAYLIST::REPEAT_STATE state = g_playlistPlayer.GetRepeat(iPlaylist);
if (state == PLAYLIST::REPEAT_ONE)
return g_localizeStrings.Get(592); // 592: One
else if (state == PLAYLIST::REPEAT_ALL)
return g_localizeStrings.Get(593); // 593: All
else
return g_localizeStrings.Get(594); // 594: Off
}
}
return "";
}
CStdString CGUIInfoManager::GetMusicLabel(int item)
{
if (!g_application.m_pPlayer->IsPlaying() || !m_currentFile->HasMusicInfoTag()) return "";
switch (item)
{
case MUSICPLAYER_PLAYLISTLEN:
{
if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
return GetPlaylistLabel(PLAYLIST_LENGTH);
}
break;
case MUSICPLAYER_PLAYLISTPOS:
{
if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_MUSIC)
return GetPlaylistLabel(PLAYLIST_POSITION);
}
break;
case MUSICPLAYER_BITRATE:
{
CStdString strBitrate = "";
if (m_audioInfo.bitrate > 0)
strBitrate = StringUtils::Format("%i", MathUtils::round_int((double)m_audioInfo.bitrate / 1000.0));
return strBitrate;
}
break;
case MUSICPLAYER_CHANNELS:
{
CStdString strChannels = "";
if (m_audioInfo.channels > 0)
{
strChannels = StringUtils::Format("%i", m_audioInfo.channels);
}
return strChannels;
}
break;
case MUSICPLAYER_BITSPERSAMPLE:
{
CStdString strBitsPerSample = "";
if (m_audioInfo.bitspersample > 0)
strBitsPerSample = StringUtils::Format("%i", m_audioInfo.bitspersample);
return strBitsPerSample;
}
break;
case MUSICPLAYER_SAMPLERATE:
{
CStdString strSampleRate = "";
if (m_audioInfo.samplerate > 0)
strSampleRate = StringUtils::Format("%.5g", ((double)m_audioInfo.samplerate / 1000.0));
return strSampleRate;
}
break;
case MUSICPLAYER_CODEC:
{
return StringUtils::Format("%s", m_audioInfo.audioCodecName.c_str());
}
break;
case MUSICPLAYER_LYRICS:
return GetItemLabel(m_currentFile, AddListItemProp("lyrics"));
}
return GetMusicTagLabel(item, m_currentFile);
}
CStdString CGUIInfoManager::GetMusicTagLabel(int info, const CFileItem *item)
{
if (!item->HasMusicInfoTag()) return "";
const CMusicInfoTag &tag = *item->GetMusicInfoTag();
switch (info)
{
case MUSICPLAYER_TITLE:
if (tag.GetTitle().size()) { return tag.GetTitle(); }
break;
case MUSICPLAYER_ALBUM:
if (tag.GetAlbum().size()) { return tag.GetAlbum(); }
break;
case MUSICPLAYER_ARTIST:
if (tag.GetArtist().size()) { return StringUtils::Join(tag.GetArtist(), g_advancedSettings.m_musicItemSeparator); }
break;
case MUSICPLAYER_ALBUM_ARTIST:
if (tag.GetAlbumArtist().size()) { return StringUtils::Join(tag.GetAlbumArtist(), g_advancedSettings.m_musicItemSeparator); }
break;
case MUSICPLAYER_YEAR:
if (tag.GetYear()) { return tag.GetYearString(); }
break;
case MUSICPLAYER_GENRE:
if (tag.GetGenre().size()) { return StringUtils::Join(tag.GetGenre(), g_advancedSettings.m_musicItemSeparator); }
break;
case MUSICPLAYER_LYRICS:
if (tag.GetLyrics().size()) { return tag.GetLyrics(); }
break;
case MUSICPLAYER_TRACK_NUMBER:
{
CStdString strTrack;
if (tag.Loaded() && tag.GetTrackNumber() > 0)
{
return StringUtils::Format("%02i", tag.GetTrackNumber());
}
}
break;
case MUSICPLAYER_DISC_NUMBER:
return GetItemLabel(item, LISTITEM_DISC_NUMBER);
case MUSICPLAYER_RATING:
return GetItemLabel(item, LISTITEM_RATING);
case MUSICPLAYER_COMMENT:
return GetItemLabel(item, LISTITEM_COMMENT);
case MUSICPLAYER_DURATION:
return GetItemLabel(item, LISTITEM_DURATION);
case MUSICPLAYER_CHANNEL_NAME:
{
if (m_currentFile->HasPVRChannelInfoTag())
return m_currentFile->GetPVRChannelInfoTag()->ChannelName();
}
break;
case MUSICPLAYER_CHANNEL_NUMBER:
{
if (m_currentFile->HasPVRChannelInfoTag())
return StringUtils::Format("%i", m_currentFile->GetPVRChannelInfoTag()->ChannelNumber());
}
break;
case MUSICPLAYER_SUB_CHANNEL_NUMBER:
{
if (m_currentFile->HasPVRChannelInfoTag())
return StringUtils::Format("%i", m_currentFile->GetPVRChannelInfoTag()->SubChannelNumber());
}
break;
case MUSICPLAYER_CHANNEL_NUMBER_LBL:
{
if (m_currentFile->HasPVRChannelInfoTag())
return m_currentFile->GetPVRChannelInfoTag()->FormattedChannelNumber();
}
break;
case MUSICPLAYER_CHANNEL_GROUP:
{
if (m_currentFile->HasPVRChannelInfoTag() && m_currentFile->GetPVRChannelInfoTag()->IsRadio())
return g_PVRManager.GetPlayingGroup(true)->GroupName();
}
break;
case MUSICPLAYER_PLAYCOUNT:
return GetItemLabel(item, LISTITEM_PLAYCOUNT);
case MUSICPLAYER_LASTPLAYED:
return GetItemLabel(item, LISTITEM_LASTPLAYED);
}
return "";
}
CStdString CGUIInfoManager::GetVideoLabel(int item)
{
if (!g_application.m_pPlayer->IsPlaying())
return "";
if (item == VIDEOPLAYER_TITLE)
{
if(g_application.m_pPlayer->IsPlayingVideo())
return GetLabel(PLAYER_TITLE);
}
else if (item == VIDEOPLAYER_PLAYLISTLEN)
{
if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_VIDEO)
return GetPlaylistLabel(PLAYLIST_LENGTH);
}
else if (item == VIDEOPLAYER_PLAYLISTPOS)
{
if (g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_VIDEO)
return GetPlaylistLabel(PLAYLIST_POSITION);
}
else if (m_currentFile->HasPVRChannelInfoTag())
{
CPVRChannel* tag = m_currentFile->GetPVRChannelInfoTag();
CEpgInfoTag epgTag;
switch (item)
{
/* Now playing infos */
case VIDEOPLAYER_ORIGINALTITLE:
return tag->GetEPGNow(epgTag) ?
epgTag.Title() :
CSettings::Get().GetBool("epg.hidenoinfoavailable") ?
StringUtils::EmptyString :
g_localizeStrings.Get(19055); // no information available
case VIDEOPLAYER_GENRE:
return tag->GetEPGNow(epgTag) ? StringUtils::Join(epgTag.Genre(), g_advancedSettings.m_videoItemSeparator) : "";
case VIDEOPLAYER_PLOT:
return tag->GetEPGNow(epgTag) ? epgTag.Plot() : "";
case VIDEOPLAYER_PLOT_OUTLINE:
return tag->GetEPGNow(epgTag) ? epgTag.PlotOutline() : "";
case VIDEOPLAYER_STARTTIME:
return tag->GetEPGNow(epgTag) ? epgTag.StartAsLocalTime().GetAsLocalizedTime("", false) : CDateTime::GetCurrentDateTime().GetAsLocalizedTime("", false);
case VIDEOPLAYER_ENDTIME:
return tag->GetEPGNow(epgTag) ? epgTag.EndAsLocalTime().GetAsLocalizedTime("", false) : CDateTime::GetCurrentDateTime().GetAsLocalizedTime("", false);
/* Next playing infos */
case VIDEOPLAYER_NEXT_TITLE:
return tag->GetEPGNext(epgTag) ?
epgTag.Title() :
CSettings::Get().GetBool("epg.hidenoinfoavailable") ?
StringUtils::EmptyString :
g_localizeStrings.Get(19055); // no information available
case VIDEOPLAYER_NEXT_GENRE:
return tag->GetEPGNext(epgTag) ? StringUtils::Join(epgTag.Genre(), g_advancedSettings.m_videoItemSeparator) : "";
case VIDEOPLAYER_NEXT_PLOT:
return tag->GetEPGNext(epgTag) ? epgTag.Plot() : "";
case VIDEOPLAYER_NEXT_PLOT_OUTLINE:
return tag->GetEPGNext(epgTag) ? epgTag.PlotOutline() : "";
case VIDEOPLAYER_NEXT_STARTTIME:
return tag->GetEPGNext(epgTag) ? epgTag.StartAsLocalTime().GetAsLocalizedTime("", false) : CDateTime::GetCurrentDateTime().GetAsLocalizedTime("", false);
case VIDEOPLAYER_NEXT_ENDTIME:
return tag->GetEPGNext(epgTag) ? epgTag.EndAsLocalTime().GetAsLocalizedTime("", false) : CDateTime::GetCurrentDateTime().GetAsLocalizedTime("", false);
case VIDEOPLAYER_NEXT_DURATION:
{
CStdString duration;
if (tag->GetEPGNext(epgTag) && epgTag.GetDuration() > 0)
duration = StringUtils::SecondsToTimeString(epgTag.GetDuration());
return duration;
}
case VIDEOPLAYER_PARENTAL_RATING:
{
CStdString rating;
if (tag->GetEPGNow(epgTag) && epgTag.ParentalRating() > 0)
rating = StringUtils::Format("%i", epgTag.ParentalRating());
return rating;
}
break;
/* General channel infos */
case VIDEOPLAYER_CHANNEL_NAME:
return tag->ChannelName();
case VIDEOPLAYER_CHANNEL_NUMBER:
return StringUtils::Format("%i", tag->ChannelNumber());
case VIDEOPLAYER_SUB_CHANNEL_NUMBER:
return StringUtils::Format("%i", tag->SubChannelNumber());
case VIDEOPLAYER_CHANNEL_NUMBER_LBL:
return tag->FormattedChannelNumber();
case VIDEOPLAYER_CHANNEL_GROUP:
{
if (tag && !tag->IsRadio())
return g_PVRManager.GetPlayingTVGroupName();
}
}
}
else if (m_currentFile->HasVideoInfoTag())
{
switch (item)
{
case VIDEOPLAYER_ORIGINALTITLE:
return m_currentFile->GetVideoInfoTag()->m_strOriginalTitle;
break;
case VIDEOPLAYER_GENRE:
return StringUtils::Join(m_currentFile->GetVideoInfoTag()->m_genre, g_advancedSettings.m_videoItemSeparator);
break;
case VIDEOPLAYER_DIRECTOR:
return StringUtils::Join(m_currentFile->GetVideoInfoTag()->m_director, g_advancedSettings.m_videoItemSeparator);
break;
case VIDEOPLAYER_RATING:
{
CStdString strRating;
if (m_currentFile->GetVideoInfoTag()->m_fRating > 0.f)
strRating = StringUtils::Format("%.1f", m_currentFile->GetVideoInfoTag()->m_fRating);
return strRating;
}
break;
case VIDEOPLAYER_RATING_AND_VOTES:
{
CStdString strRatingAndVotes;
if (m_currentFile->GetVideoInfoTag()->m_fRating > 0.f)
{
if (m_currentFile->GetVideoInfoTag()->m_strVotes.empty())
strRatingAndVotes = StringUtils::Format("%.1f",
m_currentFile->GetVideoInfoTag()->m_fRating);
else
strRatingAndVotes = StringUtils::Format("%.1f (%s %s)",
m_currentFile->GetVideoInfoTag()->m_fRating,
m_currentFile->GetVideoInfoTag()->m_strVotes.c_str(),
g_localizeStrings.Get(20350).c_str());
}
return strRatingAndVotes;
}
break;
case VIDEOPLAYER_VOTES:
return m_currentFile->GetVideoInfoTag()->m_strVotes;
case VIDEOPLAYER_YEAR:
{
CStdString strYear;
if (m_currentFile->GetVideoInfoTag()->m_iYear > 0)
strYear = StringUtils::Format("%i", m_currentFile->GetVideoInfoTag()->m_iYear);
return strYear;
}
break;
case VIDEOPLAYER_PREMIERED:
{
CDateTime dateTime;
if (m_currentFile->GetVideoInfoTag()->m_firstAired.IsValid())
dateTime = m_currentFile->GetVideoInfoTag()->m_firstAired;
else if (m_currentFile->GetVideoInfoTag()->m_premiered.IsValid())
dateTime = m_currentFile->GetVideoInfoTag()->m_premiered;
if (dateTime.IsValid())
return dateTime.GetAsLocalizedDate();
break;
}
break;
case VIDEOPLAYER_PLOT:
return m_currentFile->GetVideoInfoTag()->m_strPlot;
case VIDEOPLAYER_TRAILER:
return m_currentFile->GetVideoInfoTag()->m_strTrailer;
case VIDEOPLAYER_PLOT_OUTLINE:
return m_currentFile->GetVideoInfoTag()->m_strPlotOutline;
case VIDEOPLAYER_EPISODE:
if (m_currentFile->GetVideoInfoTag()->m_iEpisode > 0)
{
CStdString strEpisode;
if (m_currentFile->GetVideoInfoTag()->m_iSeason == 0) // prefix episode with 'S'
strEpisode = StringUtils::Format("S%i", m_currentFile->GetVideoInfoTag()->m_iEpisode);
else
strEpisode = StringUtils::Format("%i", m_currentFile->GetVideoInfoTag()->m_iEpisode);
return strEpisode;
}
break;
case VIDEOPLAYER_SEASON:
if (m_currentFile->GetVideoInfoTag()->m_iSeason > 0)
{
return StringUtils::Format("%i", m_currentFile->GetVideoInfoTag()->m_iSeason);
}
break;
case VIDEOPLAYER_TVSHOW:
return m_currentFile->GetVideoInfoTag()->m_strShowTitle;
case VIDEOPLAYER_STUDIO:
return StringUtils::Join(m_currentFile->GetVideoInfoTag()->m_studio, g_advancedSettings.m_videoItemSeparator);
case VIDEOPLAYER_COUNTRY:
return StringUtils::Join(m_currentFile->GetVideoInfoTag()->m_country, g_advancedSettings.m_videoItemSeparator);
case VIDEOPLAYER_MPAA:
return m_currentFile->GetVideoInfoTag()->m_strMPAARating;
case VIDEOPLAYER_TOP250:
{
CStdString strTop250;
if (m_currentFile->GetVideoInfoTag()->m_iTop250 > 0)
strTop250 = StringUtils::Format("%i", m_currentFile->GetVideoInfoTag()->m_iTop250);
return strTop250;
}
break;
case VIDEOPLAYER_CAST:
return m_currentFile->GetVideoInfoTag()->GetCast();
case VIDEOPLAYER_CAST_AND_ROLE:
return m_currentFile->GetVideoInfoTag()->GetCast(true);
case VIDEOPLAYER_ARTIST:
return StringUtils::Join(m_currentFile->GetVideoInfoTag()->m_artist, g_advancedSettings.m_videoItemSeparator);
case VIDEOPLAYER_ALBUM:
return m_currentFile->GetVideoInfoTag()->m_strAlbum;
case VIDEOPLAYER_WRITER:
return StringUtils::Join(m_currentFile->GetVideoInfoTag()->m_writingCredits, g_advancedSettings.m_videoItemSeparator);
case VIDEOPLAYER_TAGLINE:
return m_currentFile->GetVideoInfoTag()->m_strTagLine;
case VIDEOPLAYER_LASTPLAYED:
{
if (m_currentFile->GetVideoInfoTag()->m_lastPlayed.IsValid())
return m_currentFile->GetVideoInfoTag()->m_lastPlayed.GetAsLocalizedDateTime();
break;
}
case VIDEOPLAYER_PLAYCOUNT:
{
CStdString strPlayCount;
if (m_currentFile->GetVideoInfoTag()->m_playCount > 0)
strPlayCount = StringUtils::Format("%i", m_currentFile->GetVideoInfoTag()->m_playCount);
return strPlayCount;
}
}
}
return "";
}
int64_t CGUIInfoManager::GetPlayTime() const
{
if (g_application.m_pPlayer->IsPlaying())
{
int64_t lPTS = (int64_t)(g_application.GetTime() * 1000);
if (lPTS < 0) lPTS = 0;
return lPTS;
}
return 0;
}
CStdString CGUIInfoManager::GetCurrentPlayTime(TIME_FORMAT format) const
{
if (format == TIME_FORMAT_GUESS && GetTotalPlayTime() >= 3600)
format = TIME_FORMAT_HH_MM_SS;
if (g_application.m_pPlayer->IsPlaying())
return StringUtils::SecondsToTimeString((int)(GetPlayTime()/1000), format);
return "";
}
CStdString CGUIInfoManager::GetCurrentSeekTime(TIME_FORMAT format) const
{
if (format == TIME_FORMAT_GUESS && GetTotalPlayTime() >= 3600)
format = TIME_FORMAT_HH_MM_SS;
float time = GetTotalPlayTime() * g_application.GetSeekHandler()->GetPercent() * 0.01f;
return StringUtils::SecondsToTimeString((int)time, format);
}
int CGUIInfoManager::GetTotalPlayTime() const
{
int iTotalTime = (int)g_application.GetTotalTime();
return iTotalTime > 0 ? iTotalTime : 0;
}
int CGUIInfoManager::GetPlayTimeRemaining() const
{
int iReverse = GetTotalPlayTime() - (int)g_application.GetTime();
return iReverse > 0 ? iReverse : 0;
}
CStdString CGUIInfoManager::GetCurrentPlayTimeRemaining(TIME_FORMAT format) const
{
if (format == TIME_FORMAT_GUESS && GetTotalPlayTime() >= 3600)
format = TIME_FORMAT_HH_MM_SS;
int timeRemaining = GetPlayTimeRemaining();
if (timeRemaining && g_application.m_pPlayer->IsPlaying())
return StringUtils::SecondsToTimeString(timeRemaining, format);
return "";
}
void CGUIInfoManager::ResetCurrentItem()
{
m_currentFile->Reset();
m_currentMovieThumb = "";
m_currentMovieDuration = "";
}
void CGUIInfoManager::SetCurrentItem(CFileItem &item)
{
ResetCurrentItem();
if (item.IsAudio())
SetCurrentSong(item);
else
SetCurrentMovie(item);
if (item.HasEPGInfoTag())
*m_currentFile->GetEPGInfoTag() = *item.GetEPGInfoTag();
else if (item.HasPVRChannelInfoTag())
{
CEpgInfoTag tag;
if (item.GetPVRChannelInfoTag()->GetEPGNow(tag))
*m_currentFile->GetEPGInfoTag() = tag;
}
SetChanged();
NotifyObservers(ObservableMessageCurrentItem);
}
void CGUIInfoManager::SetCurrentAlbumThumb(const CStdString &thumbFileName)
{
if (CFile::Exists(thumbFileName))
m_currentFile->SetArt("thumb", thumbFileName);
else
{
m_currentFile->SetArt("thumb", "");
m_currentFile->FillInDefaultIcon();
}
}
void CGUIInfoManager::SetCurrentSong(CFileItem &item)
{
CLog::Log(LOGDEBUG,"CGUIInfoManager::SetCurrentSong(%s)",item.GetPath().c_str());
*m_currentFile = item;
m_currentFile->LoadMusicTag();
if (m_currentFile->GetMusicInfoTag()->GetTitle().empty())
{
// No title in tag, show filename only
m_currentFile->GetMusicInfoTag()->SetTitle(CUtil::GetTitleFromPath(m_currentFile->GetPath()));
}
m_currentFile->GetMusicInfoTag()->SetLoaded(true);
// find a thumb for this file.
if (m_currentFile->IsInternetStream())
{
if (!g_application.m_strPlayListFile.empty())
{
CLog::Log(LOGDEBUG,"Streaming media detected... using %s to find a thumb", g_application.m_strPlayListFile.c_str());
CFileItem streamingItem(g_application.m_strPlayListFile,false);
CMusicThumbLoader loader;
loader.FillThumb(streamingItem);
if (streamingItem.HasArt("thumb"))
m_currentFile->SetArt("thumb", streamingItem.GetArt("thumb"));
}
}
else
{
CMusicThumbLoader loader;
loader.LoadItem(m_currentFile);
}
m_currentFile->FillInDefaultIcon();
CMusicInfoLoader::LoadAdditionalTagInfo(m_currentFile);
}
void CGUIInfoManager::SetCurrentMovie(CFileItem &item)
{
CLog::Log(LOGDEBUG,"CGUIInfoManager::SetCurrentMovie(%s)", CURL::GetRedacted(item.GetPath()).c_str());
*m_currentFile = item;
/* also call GetMovieInfo() when a VideoInfoTag is already present or additional info won't be present in the tag */
if (!m_currentFile->HasPVRChannelInfoTag())
{
CVideoDatabase dbs;
if (dbs.Open())
{
CStdString path = item.GetPath();
CStdString videoInfoTagPath(item.GetVideoInfoTag()->m_strFileNameAndPath);
if (videoInfoTagPath.find("removable://") == 0)
path = videoInfoTagPath;
dbs.LoadVideoInfo(path, *m_currentFile->GetVideoInfoTag());
dbs.Close();
}
}
// Find a thumb for this file.
if (!item.HasArt("thumb"))
{
CVideoThumbLoader loader;
loader.LoadItem(m_currentFile);
}
// find a thumb for this stream
if (item.IsInternetStream())
{
// case where .strm is used to start an audio stream
if (g_application.m_pPlayer->IsPlayingAudio())
{
SetCurrentSong(item);
return;
}
// else its a video
if (!g_application.m_strPlayListFile.empty())
{
CLog::Log(LOGDEBUG,"Streaming media detected... using %s to find a thumb", g_application.m_strPlayListFile.c_str());
CFileItem thumbItem(g_application.m_strPlayListFile,false);
CVideoThumbLoader loader;
if (loader.FillThumb(thumbItem))
item.SetArt("thumb", thumbItem.GetArt("thumb"));
}
}
item.FillInDefaultIcon();
m_currentMovieThumb = item.GetArt("thumb");
}
string CGUIInfoManager::GetSystemHeatInfo(int info)
{
if (CTimeUtils::GetFrameTime() - m_lastSysHeatInfoTime >= SYSHEATUPDATEINTERVAL)
{ // update our variables
m_lastSysHeatInfoTime = CTimeUtils::GetFrameTime();
#if defined(TARGET_POSIX)
g_cpuInfo.getTemperature(m_cpuTemp);
m_gpuTemp = GetGPUTemperature();
#endif
}
CStdString text;
switch(info)
{
case SYSTEM_CPU_TEMPERATURE:
return m_cpuTemp.IsValid() ? m_cpuTemp.ToString() : "?";
break;
case SYSTEM_GPU_TEMPERATURE:
return m_gpuTemp.IsValid() ? m_gpuTemp.ToString() : "?";
break;
case SYSTEM_FAN_SPEED:
text = StringUtils::Format("%i%%", m_fanSpeed * 2);
break;
case SYSTEM_CPU_USAGE:
#if defined(TARGET_DARWIN_OSX)
text = StringUtils::Format("%4.2f%%", m_resourceCounter.GetCPUUsage());
#elif defined(TARGET_DARWIN) || defined(TARGET_WINDOWS)
text = StringUtils::Format("%d%%", g_cpuInfo.getUsedPercentage());
#else
text = StringUtils::Format("%s", g_cpuInfo.GetCoresUsageString().c_str());
#endif
break;
}
return text;
}
CTemperature CGUIInfoManager::GetGPUTemperature()
{
int value = 0;
char scale = 0;
#if defined(TARGET_DARWIN_OSX)
value = SMCGetTemperature(SMC_KEY_GPU_TEMP);
return CTemperature::CreateFromCelsius(value);
#else
CStdString cmd = g_advancedSettings.m_gpuTempCmd;
int ret = 0;
FILE *p = NULL;
if (cmd.empty() || !(p = popen(cmd.c_str(), "r")))
return CTemperature();
ret = fscanf(p, "%d %c", &value, &scale);
pclose(p);
if (ret != 2)
return CTemperature();
#endif
if (scale == 'C' || scale == 'c')
return CTemperature::CreateFromCelsius(value);
if (scale == 'F' || scale == 'f')
return CTemperature::CreateFromFahrenheit(value);
return CTemperature();
}
// Version string MUST NOT contain spaces. It is used
// in the HTTP request user agent.
std::string CGUIInfoManager::GetVersionShort(void)
{
if (strlen(CCompileInfo::GetSuffix()) == 0)
return StringUtils::Format("%d.%d", CCompileInfo::GetMajor(), CCompileInfo::GetMinor());
else
return StringUtils::Format("%d.%d-%s", CCompileInfo::GetMajor(), CCompileInfo::GetMinor(), CCompileInfo::GetSuffix());
}
CStdString CGUIInfoManager::GetVersion()
{
return GetVersionShort() + " Git:" + CCompileInfo::GetSCMID();
}
CStdString CGUIInfoManager::GetBuild()
{
return StringUtils::Format("%s", __DATE__);
}
CStdString CGUIInfoManager::GetAppName()
{
return CCompileInfo::GetAppName();
}
void CGUIInfoManager::SetDisplayAfterSeek(unsigned int timeOut, int seekOffset)
{
g_infoManager.m_performingSeek = false;
if (timeOut>0)
{
m_AfterSeekTimeout = CTimeUtils::GetFrameTime() + timeOut;
if (seekOffset)
m_seekOffset = seekOffset;
}
else
m_AfterSeekTimeout = 0;
}
bool CGUIInfoManager::GetDisplayAfterSeek()
{
if (CTimeUtils::GetFrameTime() < m_AfterSeekTimeout)
return true;
m_seekOffset = 0;
return false;
}
void CGUIInfoManager::Clear()
{
CSingleLock lock(m_critInfo);
m_skinVariableStrings.clear();
/*
Erase any info bools that are unused. We do this repeatedly as each run
will remove those bools that are no longer dependencies of other bools
in the vector.
*/
vector<InfoPtr>::iterator i = remove_if(m_bools.begin(), m_bools.end(), std::mem_fun_ref(&InfoPtr::unique));
while (i != m_bools.end())
{
m_bools.erase(i, m_bools.end());
i = remove_if(m_bools.begin(), m_bools.end(), std::mem_fun_ref(&InfoPtr::unique));
}
// log which ones are used - they should all be gone by now
for (vector<InfoPtr>::const_iterator i = m_bools.begin(); i != m_bools.end(); ++i)
CLog::Log(LOGDEBUG, "Infobool '%s' still used by %u instances", (*i)->GetExpression().c_str(), (unsigned int) i->use_count());
}
void CGUIInfoManager::UpdateFPS()
{
m_frameCounter++;
unsigned int curTime = CTimeUtils::GetFrameTime();
float fTimeSpan = (float)(curTime - m_lastFPSTime);
if (fTimeSpan >= 1000.0f)
{
fTimeSpan /= 1000.0f;
m_fps = m_frameCounter / fTimeSpan;
m_lastFPSTime = curTime;
m_frameCounter = 0;
}
}
void CGUIInfoManager::UpdateAVInfo()
{
if(g_application.m_pPlayer->IsPlaying())
{
if (g_dataCacheCore.HasAVInfoChanges())
{
SPlayerVideoStreamInfo video;
SPlayerAudioStreamInfo audio;
g_application.m_pPlayer->GetVideoStreamInfo(video);
g_application.m_pPlayer->GetAudioStreamInfo(g_application.m_pPlayer->GetAudioStream(), audio);
m_videoInfo = video;
m_audioInfo = audio;
}
}
}
int CGUIInfoManager::AddListItemProp(const CStdString &str, int offset)
{
for (int i=0; i < (int)m_listitemProperties.size(); i++)
if (m_listitemProperties[i] == str)
return (LISTITEM_PROPERTY_START+offset + i);
if (m_listitemProperties.size() < LISTITEM_PROPERTY_END - LISTITEM_PROPERTY_START)
{
m_listitemProperties.push_back(str);
return LISTITEM_PROPERTY_START + offset + m_listitemProperties.size() - 1;
}
CLog::Log(LOGERROR,"%s - not enough listitem property space!", __FUNCTION__);
return 0;
}
int CGUIInfoManager::AddMultiInfo(const GUIInfo &info)
{
// check to see if we have this info already
for (unsigned int i = 0; i < m_multiInfo.size(); i++)
if (m_multiInfo[i] == info)
return (int)i + MULTI_INFO_START;
// return the new offset
m_multiInfo.push_back(info);
int id = (int)m_multiInfo.size() + MULTI_INFO_START - 1;
if (id > MULTI_INFO_END)
CLog::Log(LOGERROR, "%s - too many multiinfo bool/labels in this skin", __FUNCTION__);
return id;
}
int CGUIInfoManager::ConditionalStringParameter(const CStdString ¶meter, bool caseSensitive /*= false*/)
{
// check to see if we have this parameter already
if (caseSensitive)
{
vector<string>::const_iterator i = find(m_stringParameters.begin(), m_stringParameters.end(), parameter);
if (i != m_stringParameters.end())
return (int)distance<vector<string>::const_iterator>(m_stringParameters.begin(), i);
}
else
{
for (unsigned int i = 0; i < m_stringParameters.size(); i++)
if (StringUtils::EqualsNoCase(parameter, m_stringParameters[i]))
return (int)i;
}
// return the new offset
m_stringParameters.push_back(parameter);
return (int)m_stringParameters.size() - 1;
}
bool CGUIInfoManager::GetItemInt(int &value, const CGUIListItem *item, int info) const
{
if (!item)
{
value = 0;
return false;
}
if (info >= LISTITEM_PROPERTY_START && info - LISTITEM_PROPERTY_START < (int)m_listitemProperties.size())
{ // grab the property
CStdString property = m_listitemProperties[info - LISTITEM_PROPERTY_START];
CStdString val = item->GetProperty(property).asString();
value = atoi(val);
return true;
}
switch (info)
{
case LISTITEM_PROGRESS:
{
value = 0;
if (item->IsFileItem())
{
const CFileItem *pItem = (const CFileItem *)item;
if (pItem && pItem->HasPVRChannelInfoTag())
{
CEpgInfoTag epgNow;
if (pItem->GetPVRChannelInfoTag()->GetEPGNow(epgNow))
value = (int) epgNow.ProgressPercentage();
}
else if (pItem && pItem->HasEPGInfoTag())
{
value = (int) pItem->GetEPGInfoTag()->ProgressPercentage();
}
}
return true;
}
break;
case LISTITEM_PERCENT_PLAYED:
if (item->IsFileItem() && ((const CFileItem *)item)->HasVideoInfoTag() && ((const CFileItem *)item)->GetVideoInfoTag()->m_resumePoint.IsPartWay())
value = (int)(100 * ((const CFileItem *)item)->GetVideoInfoTag()->m_resumePoint.timeInSeconds / ((const CFileItem *)item)->GetVideoInfoTag()->m_resumePoint.totalTimeInSeconds);
else if (item->IsFileItem() && ((const CFileItem *)item)->HasPVRRecordingInfoTag() && ((const CFileItem *)item)->GetPVRRecordingInfoTag()->m_resumePoint.IsPartWay())
value = (int)(100 * ((const CFileItem *)item)->GetPVRRecordingInfoTag()->m_resumePoint.timeInSeconds / ((const CFileItem *)item)->GetPVRRecordingInfoTag()->m_resumePoint.totalTimeInSeconds);
else
value = 0;
return true;
}
value = 0;
return false;
}
CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, std::string *fallback)
{
if (!item) return "";
if (info >= CONDITIONAL_LABEL_START && info <= CONDITIONAL_LABEL_END)
return GetSkinVariableString(info, false, item);
if (info >= LISTITEM_PROPERTY_START + LISTITEM_ART_OFFSET && info - (LISTITEM_PROPERTY_START + LISTITEM_ART_OFFSET) < (int)m_listitemProperties.size())
{ // grab the art
std::string art = m_listitemProperties[info - (LISTITEM_PROPERTY_START + LISTITEM_ART_OFFSET)];
return item->GetArt(art);
}
if (info >= LISTITEM_PROPERTY_START && info - LISTITEM_PROPERTY_START < (int)m_listitemProperties.size())
{ // grab the property
CStdString property = m_listitemProperties[info - LISTITEM_PROPERTY_START];
return item->GetProperty(property).asString();
}
if (info >= LISTITEM_PICTURE_START && info <= LISTITEM_PICTURE_END && item->HasPictureInfoTag())
return item->GetPictureInfoTag()->GetInfo(picture_slide_map[info - LISTITEM_PICTURE_START]);
switch (info)
{
case LISTITEM_LABEL:
return item->GetLabel();
case LISTITEM_LABEL2:
return item->GetLabel2();
case LISTITEM_TITLE:
if (item->HasPVRChannelInfoTag())
{
CEpgInfoTag epgTag;
return item->GetPVRChannelInfoTag()->GetEPGNow(epgTag) ?
epgTag.Title() :
CSettings::Get().GetBool("epg.hidenoinfoavailable") ?
StringUtils::EmptyString :
g_localizeStrings.Get(19055); // no information available
}
if (item->HasPVRRecordingInfoTag())
return item->GetPVRRecordingInfoTag()->m_strTitle;
if (item->HasEPGInfoTag())
return item->GetEPGInfoTag()->Title();
if (item->HasPVRTimerInfoTag())
return item->GetPVRTimerInfoTag()->Title();
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strTitle;
if (item->HasMusicInfoTag())
return item->GetMusicInfoTag()->GetTitle();
break;
case LISTITEM_ORIGINALTITLE:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strOriginalTitle;
break;
case LISTITEM_PLAYCOUNT:
{
CStdString strPlayCount;
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_playCount > 0)
strPlayCount = StringUtils::Format("%i", item->GetVideoInfoTag()->m_playCount);
if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetPlayCount() > 0)
strPlayCount = StringUtils::Format("%i", item->GetMusicInfoTag()->GetPlayCount());
return strPlayCount;
}
case LISTITEM_LASTPLAYED:
{
CDateTime dateTime;
if (item->HasVideoInfoTag())
dateTime = item->GetVideoInfoTag()->m_lastPlayed;
else if (item->HasMusicInfoTag())
dateTime = item->GetMusicInfoTag()->GetLastPlayed();
if (dateTime.IsValid())
return dateTime.GetAsLocalizedDate();
break;
}
case LISTITEM_TRACKNUMBER:
{
CStdString track;
if (item->HasMusicInfoTag())
track = StringUtils::Format("%i", item->GetMusicInfoTag()->GetTrackNumber());
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_iTrack > -1 )
track = StringUtils::Format("%i", item->GetVideoInfoTag()->m_iTrack);
return track;
}
case LISTITEM_DISC_NUMBER:
{
CStdString disc;
if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetDiscNumber() > 0)
disc = StringUtils::Format("%i", item->GetMusicInfoTag()->GetDiscNumber());
return disc;
}
case LISTITEM_ARTIST:
if (item->HasVideoInfoTag())
return StringUtils::Join(item->GetVideoInfoTag()->m_artist, g_advancedSettings.m_videoItemSeparator);
if (item->HasMusicInfoTag())
return StringUtils::Join(item->GetMusicInfoTag()->GetArtist(), g_advancedSettings.m_musicItemSeparator);
break;
case LISTITEM_ALBUM_ARTIST:
if (item->HasMusicInfoTag())
return StringUtils::Join(item->GetMusicInfoTag()->GetAlbumArtist(), g_advancedSettings.m_musicItemSeparator);
break;
case LISTITEM_DIRECTOR:
if (item->HasVideoInfoTag())
return StringUtils::Join(item->GetVideoInfoTag()->m_director, g_advancedSettings.m_videoItemSeparator);
break;
case LISTITEM_ALBUM:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strAlbum;
if (item->HasMusicInfoTag())
return item->GetMusicInfoTag()->GetAlbum();
break;
case LISTITEM_YEAR:
if (item->HasVideoInfoTag())
{
CStdString strResult;
if (item->GetVideoInfoTag()->m_iYear > 0)
strResult = StringUtils::Format("%i",item->GetVideoInfoTag()->m_iYear);
return strResult;
}
if (item->HasMusicInfoTag())
return item->GetMusicInfoTag()->GetYearString();
break;
case LISTITEM_PREMIERED:
if (item->HasVideoInfoTag())
{
CDateTime dateTime;
if (item->GetVideoInfoTag()->m_firstAired.IsValid())
dateTime = item->GetVideoInfoTag()->m_firstAired;
else if (item->GetVideoInfoTag()->m_premiered.IsValid())
dateTime = item->GetVideoInfoTag()->m_premiered;
if (dateTime.IsValid())
return dateTime.GetAsLocalizedDate();
break;
}
break;
case LISTITEM_GENRE:
if (item->HasVideoInfoTag())
return StringUtils::Join(item->GetVideoInfoTag()->m_genre, g_advancedSettings.m_videoItemSeparator);
if (item->HasMusicInfoTag())
return StringUtils::Join(item->GetMusicInfoTag()->GetGenre(), g_advancedSettings.m_musicItemSeparator);
if (item->HasPVRChannelInfoTag())
{
CEpgInfoTag epgTag;
return item->GetPVRChannelInfoTag()->GetEPGNow(epgTag) ? StringUtils::Join(epgTag.Genre(), g_advancedSettings.m_videoItemSeparator) : "";
}
if (item->HasPVRRecordingInfoTag())
return StringUtils::Join(item->GetPVRRecordingInfoTag()->m_genre, g_advancedSettings.m_videoItemSeparator);
if (item->HasEPGInfoTag())
return StringUtils::Join(item->GetEPGInfoTag()->Genre(), g_advancedSettings.m_videoItemSeparator);
break;
case LISTITEM_FILENAME:
case LISTITEM_FILE_EXTENSION:
{
CStdString strFile;
if (item->IsMusicDb() && item->HasMusicInfoTag())
strFile = URIUtils::GetFileName(item->GetMusicInfoTag()->GetURL());
else if (item->IsVideoDb() && item->HasVideoInfoTag())
strFile = URIUtils::GetFileName(item->GetVideoInfoTag()->m_strFileNameAndPath);
else
strFile = URIUtils::GetFileName(item->GetPath());
if (info==LISTITEM_FILE_EXTENSION)
{
CStdString strExtension = URIUtils::GetExtension(strFile);
return StringUtils::TrimLeft(strExtension, ".");
}
return strFile;
}
break;
case LISTITEM_DATE:
if (item->HasEPGInfoTag())
return item->GetEPGInfoTag()->StartAsLocalTime().GetAsLocalizedDateTime(false, false);
if (item->HasPVRChannelInfoTag())
{
CEpgInfoTag epgTag;
return item->GetPVRChannelInfoTag()->GetEPGNow(epgTag) ? epgTag.StartAsLocalTime().GetAsLocalizedDateTime(false, false) : CDateTime::GetCurrentDateTime().GetAsLocalizedDateTime(false, false);
}
if (item->HasPVRRecordingInfoTag())
return item->GetPVRRecordingInfoTag()->RecordingTimeAsLocalTime().GetAsLocalizedDateTime(false, false);
if (item->HasPVRTimerInfoTag())
return item->GetPVRTimerInfoTag()->Summary();
if (item->m_dateTime.IsValid())
return item->m_dateTime.GetAsLocalizedDate();
break;
case LISTITEM_SIZE:
if (!item->m_bIsFolder || item->m_dwSize)
return StringUtils::SizeToString(item->m_dwSize);
break;
case LISTITEM_RATING:
{
CStdString rating;
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_fRating > 0.f) // movie rating
rating = StringUtils::Format("%.1f", item->GetVideoInfoTag()->m_fRating);
else if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetRating() > '0')
{ // song rating. Images will probably be better than numbers for this in the long run
rating.assign(1, item->GetMusicInfoTag()->GetRating());
}
return rating;
}
case LISTITEM_RATING_AND_VOTES:
{
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_fRating > 0.f) // movie rating
{
CStdString strRatingAndVotes;
if (item->GetVideoInfoTag()->m_strVotes.empty())
strRatingAndVotes = StringUtils::Format("%.1f",
item->GetVideoInfoTag()->m_fRating);
else
strRatingAndVotes = StringUtils::Format("%.1f (%s %s)",
item->GetVideoInfoTag()->m_fRating,
item->GetVideoInfoTag()->m_strVotes.c_str(),
g_localizeStrings.Get(20350).c_str());
return strRatingAndVotes;
}
}
break;
case LISTITEM_VOTES:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strVotes;
break;
case LISTITEM_PROGRAM_COUNT:
{
return StringUtils::Format("%i", item->m_iprogramCount);;
}
case LISTITEM_DURATION:
{
CStdString duration;
if (item->HasPVRChannelInfoTag())
{
const CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
CEpgInfoTag tag;
if (channel && channel->GetEPGNow(tag))
return StringUtils::SecondsToTimeString(tag.GetDuration());
return StringUtils::EmptyString;
}
else if (item->HasPVRRecordingInfoTag())
{
if (item->GetPVRRecordingInfoTag()->GetDuration() > 0)
duration = StringUtils::SecondsToTimeString(item->GetPVRRecordingInfoTag()->GetDuration());
}
else if (item->HasEPGInfoTag())
{
if (item->GetEPGInfoTag()->GetDuration() > 0)
duration = StringUtils::SecondsToTimeString(item->GetEPGInfoTag()->GetDuration());
}
else if (item->HasVideoInfoTag())
{
if (item->GetVideoInfoTag()->GetDuration() > 0)
duration = StringUtils::Format("%d", item->GetVideoInfoTag()->GetDuration() / 60);
}
else if (item->HasMusicInfoTag())
{
if (item->GetMusicInfoTag()->GetDuration() > 0)
duration = StringUtils::SecondsToTimeString(item->GetMusicInfoTag()->GetDuration());
}
return duration;
}
case LISTITEM_PLOT:
if (item->HasPVRChannelInfoTag())
{
const CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
CEpgInfoTag tag;
if (channel && channel->GetEPGNow(tag))
return tag.Plot();
return StringUtils::EmptyString;
}
if (item->HasEPGInfoTag())
return item->GetEPGInfoTag()->Plot();
if (item->HasPVRRecordingInfoTag())
return item->GetPVRRecordingInfoTag()->m_strPlot;
if (item->HasVideoInfoTag())
{
if (!(!item->GetVideoInfoTag()->m_strShowTitle.empty() && item->GetVideoInfoTag()->m_iSeason == -1)) // dont apply to tvshows
if (item->GetVideoInfoTag()->m_playCount == 0 && !CSettings::Get().GetBool("videolibrary.showunwatchedplots"))
return g_localizeStrings.Get(20370);
return item->GetVideoInfoTag()->m_strPlot;
}
break;
case LISTITEM_PLOT_OUTLINE:
if (item->HasPVRChannelInfoTag())
{
const CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
CEpgInfoTag tag;
if (channel && channel->GetEPGNow(tag))
return tag.PlotOutline();
return StringUtils::EmptyString;
}
if (item->HasEPGInfoTag())
return item->GetEPGInfoTag()->PlotOutline();
if (item->HasPVRRecordingInfoTag())
return item->GetPVRRecordingInfoTag()->m_strPlotOutline;
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strPlotOutline;
break;
case LISTITEM_EPISODE:
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_iEpisode > 0)
{
CStdString strResult;
if (item->GetVideoInfoTag()->m_iSeason == 0) // prefix episode with 'S'
strResult = StringUtils::Format("S%d",item->GetVideoInfoTag()->m_iEpisode);
else
strResult = StringUtils::Format("%d",item->GetVideoInfoTag()->m_iEpisode);
return strResult;
}
break;
case LISTITEM_SEASON:
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_iSeason > 0)
{
return StringUtils::Format("%d",item->GetVideoInfoTag()->m_iSeason);;
}
break;
case LISTITEM_TVSHOW:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strShowTitle;
break;
case LISTITEM_COMMENT:
if (item->HasPVRTimerInfoTag())
return item->GetPVRTimerInfoTag()->GetStatus();
if (item->HasMusicInfoTag())
return item->GetMusicInfoTag()->GetComment();
break;
case LISTITEM_ACTUAL_ICON:
return item->GetIconImage();
case LISTITEM_ICON:
{
CStdString strThumb = item->GetArt("thumb");
if (strThumb.empty())
strThumb = item->GetIconImage();
if (fallback)
*fallback = item->GetIconImage();
return strThumb;
}
case LISTITEM_OVERLAY:
return item->GetOverlayImage();
case LISTITEM_THUMB:
return item->GetArt("thumb");
case LISTITEM_FOLDERPATH:
return CURL(item->GetPath()).GetWithoutUserDetails();
case LISTITEM_FOLDERNAME:
case LISTITEM_PATH:
{
CStdString path;
if (item->IsMusicDb() && item->HasMusicInfoTag())
path = URIUtils::GetDirectory(item->GetMusicInfoTag()->GetURL());
else if (item->IsVideoDb() && item->HasVideoInfoTag())
{
if( item->m_bIsFolder )
path = item->GetVideoInfoTag()->m_strPath;
else
URIUtils::GetParentPath(item->GetVideoInfoTag()->m_strFileNameAndPath, path);
}
else
URIUtils::GetParentPath(item->GetPath(), path);
path = CURL(path).GetWithoutUserDetails();
if (info==LISTITEM_FOLDERNAME)
{
URIUtils::RemoveSlashAtEnd(path);
path=URIUtils::GetFileName(path);
}
return path;
}
case LISTITEM_FILENAME_AND_PATH:
{
CStdString path;
if (item->IsMusicDb() && item->HasMusicInfoTag())
path = item->GetMusicInfoTag()->GetURL();
else if (item->IsVideoDb() && item->HasVideoInfoTag())
path = item->GetVideoInfoTag()->m_strFileNameAndPath;
else
path = item->GetPath();
path = CURL(path).GetWithoutUserDetails();
return path;
}
case LISTITEM_PICTURE_PATH:
if (item->IsPicture() && (!item->IsZIP() || item->IsRAR() || item->IsCBZ() || item->IsCBR()))
return item->GetPath();
break;
case LISTITEM_STUDIO:
if (item->HasVideoInfoTag())
return StringUtils::Join(item->GetVideoInfoTag()->m_studio, g_advancedSettings.m_videoItemSeparator);
break;
case LISTITEM_COUNTRY:
if (item->HasVideoInfoTag())
return StringUtils::Join(item->GetVideoInfoTag()->m_country, g_advancedSettings.m_videoItemSeparator);
break;
case LISTITEM_MPAA:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strMPAARating;
break;
case LISTITEM_CAST:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->GetCast();
break;
case LISTITEM_CAST_AND_ROLE:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->GetCast(true);
break;
case LISTITEM_WRITER:
if (item->HasVideoInfoTag())
return StringUtils::Join(item->GetVideoInfoTag()->m_writingCredits, g_advancedSettings.m_videoItemSeparator);
break;
case LISTITEM_TAGLINE:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strTagLine;
break;
case LISTITEM_TRAILER:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strTrailer;
break;
case LISTITEM_TOP250:
if (item->HasVideoInfoTag())
{
CStdString strResult;
if (item->GetVideoInfoTag()->m_iTop250 > 0)
strResult = StringUtils::Format("%i",item->GetVideoInfoTag()->m_iTop250);
return strResult;
}
break;
case LISTITEM_SORT_LETTER:
{
CStdString letter;
std::wstring character(1, item->GetSortLabel()[0]);
StringUtils::ToUpper(character);
g_charsetConverter.wToUTF8(character, letter);
return letter;
}
break;
case LISTITEM_VIDEO_CODEC:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_streamDetails.GetVideoCodec();
break;
case LISTITEM_VIDEO_RESOLUTION:
if (item->HasVideoInfoTag())
return CStreamDetails::VideoDimsToResolutionDescription(item->GetVideoInfoTag()->m_streamDetails.GetVideoWidth(), item->GetVideoInfoTag()->m_streamDetails.GetVideoHeight());
break;
case LISTITEM_VIDEO_ASPECT:
if (item->HasVideoInfoTag())
return CStreamDetails::VideoAspectToAspectDescription(item->GetVideoInfoTag()->m_streamDetails.GetVideoAspect());
break;
case LISTITEM_AUDIO_CODEC:
if (item->HasVideoInfoTag())
{
return item->GetVideoInfoTag()->m_streamDetails.GetAudioCodec();
}
break;
case LISTITEM_AUDIO_CHANNELS:
if (item->HasVideoInfoTag())
{
CStdString strResult;
int iChannels = item->GetVideoInfoTag()->m_streamDetails.GetAudioChannels();
if (iChannels > -1)
strResult = StringUtils::Format("%i", iChannels);
return strResult;
}
break;
case LISTITEM_AUDIO_LANGUAGE:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_streamDetails.GetAudioLanguage();
break;
case LISTITEM_SUBTITLE_LANGUAGE:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_streamDetails.GetSubtitleLanguage();
break;
case LISTITEM_STARTTIME:
if (item->HasPVRChannelInfoTag())
{
const CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
CEpgInfoTag tag;
if (channel && channel->GetEPGNow(tag))
return tag.StartAsLocalTime().GetAsLocalizedTime("", false);
return CDateTime::GetCurrentDateTime().GetAsLocalizedTime("", false);
}
if (item->HasEPGInfoTag())
return item->GetEPGInfoTag()->StartAsLocalTime().GetAsLocalizedTime("", false);
if (item->HasPVRTimerInfoTag())
return item->GetPVRTimerInfoTag()->StartAsLocalTime().GetAsLocalizedTime("", false);
if (item->HasPVRRecordingInfoTag())
return item->GetPVRRecordingInfoTag()->RecordingTimeAsLocalTime().GetAsLocalizedTime("", false);
if (item->m_dateTime.IsValid())
return item->m_dateTime.GetAsLocalizedTime("", false);
break;
case LISTITEM_ENDTIME:
if (item->HasPVRChannelInfoTag())
{
const CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
CEpgInfoTag tag;
if (channel && channel->GetEPGNow(tag))
return tag.EndAsLocalTime().GetAsLocalizedTime("", false);
return CDateTime::GetCurrentDateTime().GetAsLocalizedTime("", false);
}
if (item->HasEPGInfoTag())
return item->GetEPGInfoTag()->EndAsLocalTime().GetAsLocalizedTime("", false);
if (item->HasPVRTimerInfoTag())
return item->GetPVRTimerInfoTag()->EndAsLocalTime().GetAsLocalizedTime("", false);
break;
case LISTITEM_STARTDATE:
if (item->HasPVRChannelInfoTag())
{
const CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
CEpgInfoTag tag;
if (channel && channel->GetEPGNow(tag))
return tag.StartAsLocalTime().GetAsLocalizedDate(true);
return CDateTime::GetCurrentDateTime().GetAsLocalizedDate(true);
}
if (item->HasEPGInfoTag())
return item->GetEPGInfoTag()->StartAsLocalTime().GetAsLocalizedDate(true);
if (item->HasPVRTimerInfoTag())
return item->GetPVRTimerInfoTag()->StartAsLocalTime().GetAsLocalizedDate(true);
if (item->HasPVRRecordingInfoTag())
return item->GetPVRRecordingInfoTag()->RecordingTimeAsLocalTime().GetAsLocalizedDate(true);
if (item->m_dateTime.IsValid())
return item->m_dateTime.GetAsLocalizedDate(true);
break;
case LISTITEM_ENDDATE:
if (item->HasPVRChannelInfoTag())
{
const CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
CEpgInfoTag tag;
if (channel && channel->GetEPGNow(tag))
return tag.EndAsLocalTime().GetAsLocalizedDate(true);
return CDateTime::GetCurrentDateTime().GetAsLocalizedDate(true);
}
if (item->HasEPGInfoTag())
return item->GetEPGInfoTag()->EndAsLocalTime().GetAsLocalizedDate(true);
if (item->HasPVRTimerInfoTag())
return item->GetPVRTimerInfoTag()->EndAsLocalTime().GetAsLocalizedDate(true);
break;
case LISTITEM_CHANNEL_NUMBER:
{
CStdString number;
if (item->HasPVRChannelInfoTag())
number = StringUtils::Format("%i", item->GetPVRChannelInfoTag()->ChannelNumber());
if (item->HasEPGInfoTag() && item->GetEPGInfoTag()->HasPVRChannel())
number = StringUtils::Format("%i", item->GetEPGInfoTag()->PVRChannelNumber());
if (item->HasPVRTimerInfoTag())
number = StringUtils::Format("%i", item->GetPVRTimerInfoTag()->ChannelNumber());
return number;
}
break;
case LISTITEM_SUB_CHANNEL_NUMBER:
{
CStdString number;
if (item->HasPVRChannelInfoTag())
number = StringUtils::Format("%i", item->GetPVRChannelInfoTag()->SubChannelNumber());
if (item->HasEPGInfoTag() && item->GetEPGInfoTag()->HasPVRChannel())
number = StringUtils::Format("%i", item->GetEPGInfoTag()->ChannelTag()->SubChannelNumber());
if (item->HasPVRTimerInfoTag())
number = StringUtils::Format("%i", item->GetPVRTimerInfoTag()->ChannelTag()->SubChannelNumber());
return number;
}
break;
case LISTITEM_CHANNEL_NUMBER_LBL:
{
CPVRChannelPtr channel;
if (item->HasPVRChannelInfoTag())
channel = CPVRChannelPtr(new CPVRChannel(*item->GetPVRChannelInfoTag()));
else if (item->HasEPGInfoTag() && item->GetEPGInfoTag()->HasPVRChannel())
channel = item->GetEPGInfoTag()->ChannelTag();
else if (item->HasPVRTimerInfoTag())
channel = item->GetPVRTimerInfoTag()->ChannelTag();
return channel ?
channel->FormattedChannelNumber() :
"";
}
break;
case LISTITEM_CHANNEL_NAME:
if (item->HasPVRChannelInfoTag())
return item->GetPVRChannelInfoTag()->ChannelName();
if (item->HasEPGInfoTag() && item->GetEPGInfoTag()->HasPVRChannel())
return item->GetEPGInfoTag()->PVRChannelName();
if (item->HasPVRRecordingInfoTag())
return item->GetPVRRecordingInfoTag()->m_strChannelName;
if (item->HasPVRTimerInfoTag())
return item->GetPVRTimerInfoTag()->ChannelName();
break;
case LISTITEM_NEXT_STARTTIME:
{
const CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
CEpgInfoTag tag;
if (channel && channel->GetEPGNext(tag))
return tag.StartAsLocalTime().GetAsLocalizedTime("", false);
}
return CDateTime::GetCurrentDateTime().GetAsLocalizedTime("", false);
case LISTITEM_NEXT_ENDTIME:
{
const CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
CEpgInfoTag tag;
if (channel && channel->GetEPGNext(tag))
return tag.EndAsLocalTime().GetAsLocalizedTime("", false);
}
return CDateTime::GetCurrentDateTime().GetAsLocalizedTime("", false);
case LISTITEM_NEXT_STARTDATE:
{
const CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
CEpgInfoTag tag;
if (channel && channel->GetEPGNext(tag))
return tag.StartAsLocalTime().GetAsLocalizedDate(true);
}
return CDateTime::GetCurrentDateTime().GetAsLocalizedDate(true);
case LISTITEM_NEXT_ENDDATE:
{
const CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
CEpgInfoTag tag;
if (channel && channel->GetEPGNext(tag))
return tag.EndAsLocalTime().GetAsLocalizedDate(true);
}
return CDateTime::GetCurrentDateTime().GetAsLocalizedDate(true);
case LISTITEM_NEXT_PLOT:
{
const CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
CEpgInfoTag tag;
if (channel && channel->GetEPGNext(tag))
return tag.Plot();
}
return StringUtils::EmptyString;
case LISTITEM_NEXT_PLOT_OUTLINE:
{
const CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
CEpgInfoTag tag;
if (channel && channel->GetEPGNext(tag))
return tag.PlotOutline();
}
return StringUtils::EmptyString;
case LISTITEM_NEXT_DURATION:
{
const CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
CEpgInfoTag tag;
if (channel && channel->GetEPGNext(tag))
return StringUtils::SecondsToTimeString(tag.GetDuration());
}
return StringUtils::EmptyString;
case LISTITEM_NEXT_GENRE:
{
const CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
CEpgInfoTag tag;
if (channel && channel->GetEPGNext(tag))
return StringUtils::Join(tag.Genre(), g_advancedSettings.m_videoItemSeparator);
}
return StringUtils::EmptyString;
case LISTITEM_NEXT_TITLE:
{
const CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
CEpgInfoTag tag;
if (channel && channel->GetEPGNext(tag))
return tag.Title();
}
return StringUtils::EmptyString;
case LISTITEM_PARENTALRATING:
{
CStdString rating;
if (item->HasEPGInfoTag() && item->GetEPGInfoTag()->ParentalRating() > 0)
rating = StringUtils::Format("%i", item->GetEPGInfoTag()->ParentalRating());
return rating;
}
break;
case LISTITEM_PERCENT_PLAYED:
{
int val;
if (GetItemInt(val, item, info))
{
return StringUtils::Format("%d", val);;
}
break;
}
case LISTITEM_DATE_ADDED:
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_dateAdded.IsValid())
return item->GetVideoInfoTag()->m_dateAdded.GetAsLocalizedDate();
break;
case LISTITEM_DBTYPE:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_type;
break;
case LISTITEM_DBID:
if (item->HasVideoInfoTag())
{
return StringUtils::Format("%i", item->GetVideoInfoTag()->m_iDbId);;
}
if (item->HasMusicInfoTag())
{
return StringUtils::Format("%i", item->GetMusicInfoTag()->GetDatabaseId());;
}
break;
case LISTITEM_STEREOSCOPIC_MODE:
{
std::string stereoMode = item->GetProperty("stereomode").asString();
if (stereoMode.empty() && item->HasVideoInfoTag())
stereoMode = CStereoscopicsManager::Get().NormalizeStereoMode(item->GetVideoInfoTag()->m_streamDetails.GetStereoMode());
return stereoMode;
}
}
return "";
}
CStdString CGUIInfoManager::GetItemImage(const CFileItem *item, int info, std::string *fallback)
{
if (info >= CONDITIONAL_LABEL_START && info <= CONDITIONAL_LABEL_END)
return GetSkinVariableString(info, true, item);
switch (info)
{
case LISTITEM_RATING: // old song rating format
{
if (item->HasMusicInfoTag())
{
return StringUtils::Format("songrating%c.png", item->GetMusicInfoTag()->GetRating());
}
}
break;
case LISTITEM_STAR_RATING:
{
CStdString rating;
if (item->HasVideoInfoTag())
{ // rating for videos is assumed 0..10, so convert to 0..5
rating = StringUtils::Format("rating%ld.png", (long)((item->GetVideoInfoTag()->m_fRating * 0.5f) + 0.5f));
}
else if (item->HasMusicInfoTag())
{ // song rating.
rating = StringUtils::Format("rating%c.png", item->GetMusicInfoTag()->GetRating());
}
return rating;
}
break;
} /* switch (info) */
return GetItemLabel(item, info, fallback);
}
bool CGUIInfoManager::GetItemBool(const CGUIListItem *item, int condition) const
{
if (!item) return false;
if (condition >= LISTITEM_PROPERTY_START && condition - LISTITEM_PROPERTY_START < (int)m_listitemProperties.size())
{ // grab the property
CStdString property = m_listitemProperties[condition - LISTITEM_PROPERTY_START];
return item->GetProperty(property).asBoolean();
}
else if (condition == LISTITEM_ISPLAYING)
{
if (item->HasProperty("playlistposition"))
return (int)item->GetProperty("playlisttype").asInteger() == g_playlistPlayer.GetCurrentPlaylist() && (int)item->GetProperty("playlistposition").asInteger() == g_playlistPlayer.GetCurrentSong();
else if (item->IsFileItem() && !m_currentFile->GetPath().empty())
{
if (!g_application.m_strPlayListFile.empty())
{
//playlist file that is currently playing or the playlistitem that is currently playing.
return ((const CFileItem *)item)->IsPath(g_application.m_strPlayListFile) || m_currentFile->IsSamePath((const CFileItem *)item);
}
return m_currentFile->IsSamePath((const CFileItem *)item);
}
}
else if (condition == LISTITEM_ISSELECTED)
return item->IsSelected();
else if (condition == LISTITEM_IS_FOLDER)
return item->m_bIsFolder;
else if (condition == LISTITEM_IS_RESUMABLE)
{
if (item->IsFileItem())
{
if (((const CFileItem *)item)->HasVideoInfoTag())
return ((const CFileItem *)item)->GetVideoInfoTag()->m_resumePoint.timeInSeconds > 0;
else if (((const CFileItem *)item)->HasPVRRecordingInfoTag())
return ((const CFileItem *)item)->GetPVRRecordingInfoTag()->m_resumePoint.timeInSeconds > 0;
}
}
else if (item->IsFileItem())
{
const CFileItem *pItem = (const CFileItem *)item;
if (condition == LISTITEM_ISRECORDING)
{
if (!g_PVRManager.IsStarted())
return false;
if (pItem->HasPVRChannelInfoTag())
{
return pItem->GetPVRChannelInfoTag()->IsRecording();
}
else if (pItem->HasPVRTimerInfoTag())
{
const CPVRTimerInfoTag *timer = pItem->GetPVRTimerInfoTag();
if (timer)
return timer->IsRecording();
}
else if (pItem->HasEPGInfoTag())
{
CFileItemPtr timer = g_PVRTimers->GetTimerForEpgTag(pItem);
if (timer && timer->HasPVRTimerInfoTag())
return timer->GetPVRTimerInfoTag()->IsRecording();
}
}
else if (condition == LISTITEM_INPROGRESS)
{
if (!g_PVRManager.IsStarted())
return false;
if (pItem->HasEPGInfoTag())
return pItem->GetEPGInfoTag()->IsActive();
}
else if (condition == LISTITEM_HASTIMER)
{
if (pItem->HasEPGInfoTag())
{
CFileItemPtr timer = g_PVRTimers->GetTimerForEpgTag(pItem);
if (timer && timer->HasPVRTimerInfoTag())
return timer->GetPVRTimerInfoTag()->IsActive();
}
}
else if (condition == LISTITEM_HASRECORDING)
{
return pItem->HasEPGInfoTag() && pItem->GetEPGInfoTag()->HasRecording();
}
else if (condition == LISTITEM_HAS_EPG)
{
if (pItem->HasPVRChannelInfoTag())
{
CEpgInfoTag epgTag;
return pItem->GetPVRChannelInfoTag()->GetEPGNow(epgTag);
}
else
{
return pItem->HasEPGInfoTag();
}
}
else if (condition == LISTITEM_ISENCRYPTED)
{
if (pItem->HasPVRChannelInfoTag())
{
return pItem->GetPVRChannelInfoTag()->IsEncrypted();
}
else if (pItem->HasEPGInfoTag() && pItem->GetEPGInfoTag()->HasPVRChannel())
{
return pItem->GetEPGInfoTag()->ChannelTag()->IsEncrypted();
}
}
else if (condition == LISTITEM_IS_STEREOSCOPIC)
{
std::string stereoMode = pItem->GetProperty("stereomode").asString();
if (stereoMode.empty() && pItem->HasVideoInfoTag())
stereoMode = CStereoscopicsManager::Get().NormalizeStereoMode(pItem->GetVideoInfoTag()->m_streamDetails.GetStereoMode());
if (!stereoMode.empty() && stereoMode != "mono")
return true;
}
}
return false;
}
void CGUIInfoManager::ResetCache()
{
// reset any animation triggers as well
m_containerMoves.clear();
// mark our infobools as dirty
CSingleLock lock(m_critInfo);
for (vector<InfoPtr>::iterator i = m_bools.begin(); i != m_bools.end(); ++i)
(*i)->SetDirty();
}
// Called from tuxbox service thread to update current status
void CGUIInfoManager::UpdateFromTuxBox()
{
if(g_tuxbox.vVideoSubChannel.mode)
m_currentFile->GetVideoInfoTag()->m_strTitle = g_tuxbox.vVideoSubChannel.current_name;
// Set m_currentMovieDuration
if(!g_tuxbox.sCurSrvData.current_event_duration.empty() &&
!g_tuxbox.sCurSrvData.next_event_description.empty() &&
g_tuxbox.sCurSrvData.current_event_duration != "-" &&
g_tuxbox.sCurSrvData.next_event_description != "-")
{
StringUtils::Replace(g_tuxbox.sCurSrvData.current_event_duration, "(","");
StringUtils::Replace(g_tuxbox.sCurSrvData.current_event_duration, ")","");
m_currentMovieDuration = StringUtils::Format("%s: %s %s (%s - %s)",
g_localizeStrings.Get(180).c_str(),
g_tuxbox.sCurSrvData.current_event_duration.c_str(),
g_localizeStrings.Get(12391).c_str(),
g_tuxbox.sCurSrvData.current_event_time.c_str(),
g_tuxbox.sCurSrvData.next_event_time.c_str());
}
//Set strVideoGenre
if (!g_tuxbox.sCurSrvData.current_event_description.empty() &&
!g_tuxbox.sCurSrvData.next_event_description.empty() &&
g_tuxbox.sCurSrvData.current_event_description != "-" &&
g_tuxbox.sCurSrvData.next_event_description != "-")
{
CStdString genre = StringUtils::Format("%s %s - (%s: %s)",
g_localizeStrings.Get(143).c_str(),
g_tuxbox.sCurSrvData.current_event_description.c_str(),
g_localizeStrings.Get(209).c_str(),
g_tuxbox.sCurSrvData.next_event_description.c_str());
m_currentFile->GetVideoInfoTag()->m_genre = StringUtils::Split(genre, g_advancedSettings.m_videoItemSeparator);
}
//Set m_currentMovie.m_director
if (g_tuxbox.sCurSrvData.current_event_details != "-" &&
!g_tuxbox.sCurSrvData.current_event_details.empty())
{
m_currentFile->GetVideoInfoTag()->m_director = StringUtils::Split(g_tuxbox.sCurSrvData.current_event_details, g_advancedSettings.m_videoItemSeparator);
}
}
CStdString CGUIInfoManager::GetPictureLabel(int info)
{
if (info == SLIDE_FILE_NAME)
return GetItemLabel(m_currentSlide, LISTITEM_FILENAME);
else if (info == SLIDE_FILE_PATH)
{
CStdString path = URIUtils::GetDirectory(m_currentSlide->GetPath());
return CURL(path).GetWithoutUserDetails();
}
else if (info == SLIDE_FILE_SIZE)
return GetItemLabel(m_currentSlide, LISTITEM_SIZE);
else if (info == SLIDE_FILE_DATE)
return GetItemLabel(m_currentSlide, LISTITEM_DATE);
else if (info == SLIDE_INDEX)
{
CGUIWindowSlideShow *slideshow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (slideshow && slideshow->NumSlides())
{
return StringUtils::Format("%d/%d", slideshow->CurrentSlide(), slideshow->NumSlides());
}
}
if (m_currentSlide->HasPictureInfoTag())
return m_currentSlide->GetPictureInfoTag()->GetInfo(info);
return "";
}
void CGUIInfoManager::SetCurrentSlide(CFileItem &item)
{
if (m_currentSlide->GetPath() != item.GetPath())
{
if (!item.GetPictureInfoTag()->Loaded()) // If picture metadata has not been loaded yet, load it now
item.GetPictureInfoTag()->Load(item.GetPath());
*m_currentSlide = item;
}
}
void CGUIInfoManager::ResetCurrentSlide()
{
m_currentSlide->Reset();
}
bool CGUIInfoManager::CheckWindowCondition(CGUIWindow *window, int condition) const
{
// check if it satisfies our condition
if (!window) return false;
if ((condition & WINDOW_CONDITION_HAS_LIST_ITEMS) && !window->HasListItems())
return false;
if ((condition & WINDOW_CONDITION_IS_MEDIA_WINDOW) && !window->IsMediaWindow())
return false;
return true;
}
CGUIWindow *CGUIInfoManager::GetWindowWithCondition(int contextWindow, int condition) const
{
CGUIWindow *window = g_windowManager.GetWindow(contextWindow);
if (CheckWindowCondition(window, condition))
return window;
// try topmost dialog
window = g_windowManager.GetWindow(g_windowManager.GetTopMostModalDialogID());
if (CheckWindowCondition(window, condition))
return window;
// try active window
window = g_windowManager.GetWindow(g_windowManager.GetActiveWindow());
if (CheckWindowCondition(window, condition))
return window;
return NULL;
}
void CGUIInfoManager::SetCurrentVideoTag(const CVideoInfoTag &tag)
{
*m_currentFile->GetVideoInfoTag() = tag;
m_currentFile->m_lStartOffset = 0;
}
void CGUIInfoManager::SetCurrentSongTag(const MUSIC_INFO::CMusicInfoTag &tag)
{
//CLog::Log(LOGDEBUG, "Asked to SetCurrentTag");
*m_currentFile->GetMusicInfoTag() = tag;
m_currentFile->m_lStartOffset = 0;
}
const CFileItem& CGUIInfoManager::GetCurrentSlide() const
{
return *m_currentSlide;
}
const MUSIC_INFO::CMusicInfoTag* CGUIInfoManager::GetCurrentSongTag() const
{
if (m_currentFile->HasMusicInfoTag())
return m_currentFile->GetMusicInfoTag();
return NULL;
}
const CVideoInfoTag* CGUIInfoManager::GetCurrentMovieTag() const
{
if (m_currentFile->HasVideoInfoTag())
return m_currentFile->GetVideoInfoTag();
return NULL;
}
void GUIInfo::SetInfoFlag(uint32_t flag)
{
assert(flag >= (1 << 24));
m_data1 |= flag;
}
uint32_t GUIInfo::GetInfoFlag() const
{
// we strip out the bottom 24 bits, where we keep data
// and return the flag only
return m_data1 & 0xff000000;
}
uint32_t GUIInfo::GetData1() const
{
// we strip out the top 8 bits, where we keep flags
// and return the unflagged data
return m_data1 & ((1 << 24) -1);
}
int GUIInfo::GetData2() const
{
return m_data2;
}
void CGUIInfoManager::SetLibraryBool(int condition, bool value)
{
switch (condition)
{
case LIBRARY_HAS_MUSIC:
m_libraryHasMusic = value ? 1 : 0;
break;
case LIBRARY_HAS_MOVIES:
m_libraryHasMovies = value ? 1 : 0;
break;
case LIBRARY_HAS_MOVIE_SETS:
m_libraryHasMovieSets = value ? 1 : 0;
break;
case LIBRARY_HAS_TVSHOWS:
m_libraryHasTVShows = value ? 1 : 0;
break;
case LIBRARY_HAS_MUSICVIDEOS:
m_libraryHasMusicVideos = value ? 1 : 0;
break;
default:
break;
}
}
void CGUIInfoManager::ResetLibraryBools()
{
m_libraryHasMusic = -1;
m_libraryHasMovies = -1;
m_libraryHasTVShows = -1;
m_libraryHasMusicVideos = -1;
m_libraryHasMovieSets = -1;
}
bool CGUIInfoManager::GetLibraryBool(int condition)
{
if (condition == LIBRARY_HAS_MUSIC)
{
if (m_libraryHasMusic < 0)
{ // query
CMusicDatabase db;
if (db.Open())
{
m_libraryHasMusic = (db.GetSongsCount() > 0) ? 1 : 0;
db.Close();
}
}
return m_libraryHasMusic > 0;
}
else if (condition == LIBRARY_HAS_MOVIES)
{
if (m_libraryHasMovies < 0)
{
CVideoDatabase db;
if (db.Open())
{
m_libraryHasMovies = db.HasContent(VIDEODB_CONTENT_MOVIES) ? 1 : 0;
db.Close();
}
}
return m_libraryHasMovies > 0;
}
else if (condition == LIBRARY_HAS_MOVIE_SETS)
{
if (m_libraryHasMovieSets < 0)
{
CVideoDatabase db;
if (db.Open())
{
m_libraryHasMovieSets = db.HasSets() ? 1 : 0;
db.Close();
}
}
return m_libraryHasMovieSets > 0;
}
else if (condition == LIBRARY_HAS_TVSHOWS)
{
if (m_libraryHasTVShows < 0)
{
CVideoDatabase db;
if (db.Open())
{
m_libraryHasTVShows = db.HasContent(VIDEODB_CONTENT_TVSHOWS) ? 1 : 0;
db.Close();
}
}
return m_libraryHasTVShows > 0;
}
else if (condition == LIBRARY_HAS_MUSICVIDEOS)
{
if (m_libraryHasMusicVideos < 0)
{
CVideoDatabase db;
if (db.Open())
{
m_libraryHasMusicVideos = db.HasContent(VIDEODB_CONTENT_MUSICVIDEOS) ? 1 : 0;
db.Close();
}
}
return m_libraryHasMusicVideos > 0;
}
else if (condition == LIBRARY_HAS_VIDEO)
{
return (GetLibraryBool(LIBRARY_HAS_MOVIES) ||
GetLibraryBool(LIBRARY_HAS_TVSHOWS) ||
GetLibraryBool(LIBRARY_HAS_MUSICVIDEOS));
}
return false;
}
int CGUIInfoManager::RegisterSkinVariableString(const CSkinVariableString* info)
{
if (!info)
return 0;
CSingleLock lock(m_critInfo);
m_skinVariableStrings.push_back(*info);
delete info;
return CONDITIONAL_LABEL_START + m_skinVariableStrings.size() - 1;
}
int CGUIInfoManager::TranslateSkinVariableString(const CStdString& name, int context)
{
for (vector<CSkinVariableString>::const_iterator it = m_skinVariableStrings.begin();
it != m_skinVariableStrings.end(); ++it)
{
if (StringUtils::EqualsNoCase(it->GetName(), name) && it->GetContext() == context)
return it - m_skinVariableStrings.begin() + CONDITIONAL_LABEL_START;
}
return 0;
}
CStdString CGUIInfoManager::GetSkinVariableString(int info,
bool preferImage /*= false*/,
const CGUIListItem *item /*= NULL*/)
{
info -= CONDITIONAL_LABEL_START;
if (info >= 0 && info < (int)m_skinVariableStrings.size())
return m_skinVariableStrings[info].GetValue(preferImage, item);
return "";
}
bool CGUIInfoManager::ConditionsChangedValues(const std::map<INFO::InfoPtr, bool>& map)
{
for (std::map<INFO::InfoPtr, bool>::const_iterator it = map.begin() ; it != map.end() ; it++)
{
if (it->first->Get() != it->second)
return true;
}
return false;
}
bool CGUIInfoManager::GetEpgInfoTag(CEpgInfoTag& tag) const
{
if (m_currentFile->HasEPGInfoTag())
{
CEpgInfoTag* currentTag = m_currentFile->GetEPGInfoTag();
while (currentTag && !currentTag->IsActive())
currentTag = currentTag->GetNextEvent().get();
if (currentTag)
{
tag = *currentTag;
return true;
}
}
return false;
}
|