forked from bitfocus/companion-module-videolan-vlc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
1196 lines (1084 loc) · 24.4 KB
/
index.js
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
// 'use strict';
var rest_client = require('node-rest-client').Client
var crypto = require('crypto')
var instance_skel = require('../../instance_skel')
var GetUpgradeScripts = require('./upgrades')
function instance(system, id, config) {
var self = this
// super-constructor
instance_skel.apply(this, arguments)
self.VLC_IS_STOPPED = 0
self.VLC_IS_PAUSED = 1
self.VLC_IS_PLAYING = 2
self.VLC_IS_STOPPING = 3
self.actions() // export actions
if (process.env.DEVELOPER) {
self.config._configIdx = -1
}
return self
}
instance.GetUpgradeScripts = GetUpgradeScripts
instance.prototype.MSTATUS_CHAR = {
running: '\u23F5',
paused: '\u23F8',
stopped: '\u23F9',
empty: '\u00b7',
}
instance.prototype.NO_CLIP = {
title: '',
num: 0,
length: 0,
position: 0,
time: 0,
}
// hash the playlist name and position
// to detect if we need to update our copy
instance.prototype.makeHash = function (list) {
var hasher = crypto.createHash('md5')
list.forEach(function (item, pos) {
hasher.update(item.name + pos)
})
return hasher.digest('hex')
}
instance.prototype.show_error = function (err) {
var self = this
if (!self.disabled && self.lastStatus != self.STATUS_ERROR) {
self.status(self.STATUS_ERROR, err.message)
self.log('error', err.message)
self.reset_variables()
self.updateStatus()
self.lastStatus = self.STATUS_ERROR
}
}
instance.prototype.updateConfig = function (config) {
var self = this
// remove any 'reserved' name variables
var oldClear = self.config.pre_clear
if (oldClear) {
self.pre_clear = 0
self.clearList(oldClear)
}
// before changing config
self.config = config
self.startup()
}
instance.prototype.init = function () {
var self = this
self.startup()
}
function vlc_MediaInfo(info) {
if (info) {
this.id = info.id
this.duration = info.duration
this.uri = info.uri
this.name = info.name
} else {
this.id = 0
this.duration = 0
this.uri = ''
this.name = ''
}
}
instance.prototype.titleMunge = function (t) {
var self = this
return t.length > 20 ? (t = t.slice(0, 10) + t.slice(-10)) : t
}
instance.prototype.reset_variables = function () {
var self = this
self.pre_clear = self.config.pre_clear
self.use_bullet = self.config.use_bullet
self.clearList(0)
self.PlayIDs = []
self.PlayList = {}
self.PlayListCheck = ''
self.PlayState = self.VLC_IS_STOPPED
self.NowPlaying = 0
self.PollCount = 0
self.vlcVersion = 'Not Connected'
self.PlayStatus = self.NO_CLIP
self.PlayLoop = false
self.PlayRepeat = false
self.PlayRandom = false
self.PlayFull = false
self.PollWaiting = 0
self.lastStatus = -1
self.disabled = false
}
instance.prototype.clear = function (closing) {
var self = this
if (self.plPoll) {
clearInterval(self.plPoll)
delete self.plPoll
}
if (self.pbPoll) {
clearInterval(self.pbPoll)
delete self.pbPoll
}
if (self.client) {
delete self.client
}
// don't recharge variables if shutting down
if (!closing) {
self.hires = self.config.hires ? true : false
self.baseURL = ''
self.reset_variables()
}
}
instance.prototype.clear_vars = function () {
var self = this
self.reset_variables()
self.init_variables()
}
instance.prototype.startup = function () {
var self = this
self.clear()
self.status(self.STATUS_WARNING, 'Initializing')
if (self.config.host && self.config.port) {
self.init_client()
self.init_variables()
self.init_feedbacks()
self.init_presets()
self.plPoll = setInterval(function () {
self.pollPlaylist()
}, 500)
self.pbPoll = setInterval(function () {
self.pollPlayback()
}, 100)
} else {
self.status(self.STATUS_WARNING, 'No host configured')
}
}
instance.prototype.init_client = function () {
var self = this
self.baseURL = 'http://' + self.config.host + ':' + self.config.port
self.auth = {}
if (self.config.password) {
self.auth = {
headers: { Authorization: 'Basic ' + Buffer.from(['', self.config.password].join(':')).toString('base64') },
}
}
self.client = new rest_client()
self.status(self.STATUS_WARNING, 'Connecting')
self.client.on('error', self.show_error.bind(self))
}
// feedback definitions
instance.prototype.init_feedbacks = function () {
var self = this
var feedbacks = {
c_status: {
label: 'Color for Player State',
description: 'Set Button colors for Player State',
options: [
{
type: 'colorpicker',
label: 'Foreground color',
id: 'fg',
default: '16777215',
},
{
type: 'colorpicker',
label: 'Background color',
id: 'bg',
default: self.rgb(128, 0, 0),
},
{
type: 'dropdown',
label: 'Which Status?',
id: 'playStat',
default: '0',
choices: [
{ id: '0', label: 'Stopped' },
{ id: '1', label: 'Paused' },
{ id: '2', label: 'Playing' },
],
},
],
callback: function (feedback, bank) {
var ret = {}
var options = feedback.options
if (self.PlayState == parseInt(options.playStat)) {
ret = { color: options.fg, bgcolor: options.bg }
}
return ret
},
},
c_cue: {
label: 'Color for Item state',
description: 'Set Button colors for single Item State',
options: [
{
type: 'colorpicker',
label: 'Foreground color',
id: 'fg',
default: '16777215',
},
{
type: 'colorpicker',
label: 'Background color',
id: 'bg',
default: self.rgb(0, 128, 0),
},
{
type: 'textinput',
label: 'Clip Number',
id: 'clip',
default: 1,
regex: self.REGEX_NUMBER,
},
{
type: 'dropdown',
label: 'Which Status?',
id: 'playStat',
default: '2',
choices: [
{ id: '0', label: 'Stopped' },
{ id: '1', label: 'Paused' },
{ id: '2', label: 'Playing' },
],
},
],
callback: function (feedback, bank) {
var ret = {}
var options = feedback.options
if (self.PlayStatus.num == parseInt(options.clip)) {
if (self.PlayState == parseInt(options.playStat)) {
ret = { color: options.fg, bgcolor: options.bg }
}
} else if (0 == parseInt(options.playStat)) {
// not playing
ret = { color: options.fg, bgcolor: options.bg }
}
return ret
},
},
c_loop: {
label: 'Loop mode Color',
description: 'Button colors when Player in Loop mode',
options: [
{
type: 'colorpicker',
label: 'Foreground color',
id: 'fg',
default: '16777215',
},
{
type: 'colorpicker',
label: 'Background color',
id: 'bg',
default: self.rgb(0, 128, 128),
},
],
callback: function (feedback, bank) {
var options = feedback.options
return self.PlayLoop ? { color: options.fg, bgcolor: options.bg } : {}
},
},
c_repeat: {
label: 'Repeat mode Color',
description: 'Button colors when Player in Repeat mode',
options: [
{
type: 'colorpicker',
label: 'Foreground color',
id: 'fg',
default: '16777215',
},
{
type: 'colorpicker',
label: 'Background color',
id: 'bg',
default: self.rgb(128, 0, 128),
},
],
callback: function (feedback, bank) {
var options = feedback.options
return self.PlayRepeat ? { color: options.fg, bgcolor: options.bg } : {}
},
},
c_random: {
label: 'Shuffle mode Color',
description: 'Button colors when Player in Shuffle mode',
options: [
{
type: 'colorpicker',
label: 'Foreground color',
id: 'fg',
default: '16777215',
},
{
type: 'colorpicker',
label: 'Background color',
id: 'bg',
default: self.rgb(0, 0, 128),
},
],
callback: function (feedback, bank) {
var options = feedback.options
return self.PlayRandom ? { color: options.fg, bgcolor: options.bg } : {}
},
},
c_full: {
label: 'Full Screen Color',
description: 'Button colors when Player is Full Screen',
options: [
{
type: 'colorpicker',
label: 'Foreground color',
id: 'fg',
default: '16777215',
},
{
type: 'colorpicker',
label: 'Background color',
id: 'bg',
default: self.rgb(204, 0, 128),
},
],
callback: function (feedback, bank) {
var options = feedback.options
return self.PlayFull ? { color: options.fg, bgcolor: options.bg } : {}
},
},
}
self.setFeedbackDefinitions(feedbacks)
}
// define instance variables
instance.prototype.init_variables = function () {
var self = this
var variables = [
{
label: 'VLC Version',
name: 'v_ver',
},
{
label: 'Playing Status',
name: 'r_stat',
},
{
label: 'Playing Item VLC ID',
name: 'r_id',
},
{
label: 'Playing Item Name',
name: 'r_name',
},
{
label: 'Playing Item Playlist Number',
name: 'r_num',
},
{
label: 'Playing Item Time left, variable size',
name: 'r_left',
},
{
label: 'Playing Item Time left, HH:MM:SS',
name: 'r_hhmmss',
},
{
label: 'Playing Item Time left, Hour',
name: 'r_hh',
},
{
label: 'Playing Item Time left, Minute',
name: 'r_mm',
},
{
label: 'Playing Item Time left, Second',
name: 'r_ss',
},
{
label: 'Playing Item Elapsed Time, variable size',
name: 'e_time',
},
{
label: 'Playing Item Elapsed Time, HH:MM:SS',
name: 'e_hhmmss',
},
{
label: 'Playing Item Elapsed Time, Hour',
name: 'e_hh',
},
{
label: 'Playing Item Elapsed Time, Minute',
name: 'e_mm',
},
{
label: 'Playing Item Elapsed Time, Second',
name: 'e_ss',
},
]
self.setVariableDefinitions(variables)
}
instance.prototype.clearList = function (oldLength) {
var self = this
var pc = self.pre_clear
var empty = self.use_bullet ? self.MSTATUS_CHAR.empty : ''
var newLength = self.PlayIDs ? self.PlayIDs.length : 0
var emptyFrom = newLength < pc ? newLength + 1 : pc
// add placeholder char for empty clips
while (pc > newLength && emptyFrom <= pc) {
self.setVariable('pname_' + parseInt(emptyFrom), empty)
emptyFrom++
}
// remove any variables left over
while (oldLength > emptyFrom) {
self.setVariable('pname_' + parseInt(oldLength))
oldLength--
}
}
instance.prototype.updatePlaylist = function (data) {
var self = this
var pList = JSON.parse(data.toString())
var newList
var PlayList = {}
var oldLength = self.PlayIDs.length
if (pList.children) {
newList = pList.children
}
if (newList.length > 0) {
var nl = newList[0].children
var pc = self.makeHash(nl)
var pi = []
if (pc != self.PlayListCheck) {
var m, p
for (p in nl) {
m = new vlc_MediaInfo(nl[p])
PlayList[m.id] = m
pi.push(m.id)
}
for (p in pi) {
var oName = self.PlayList[self.PlayIDs[p]] ? self.PlayList[self.PlayIDs[p]].name : ''
var nName = PlayList[pi[p]].name
if (oName != nName) {
self.setVariable('pname_' + (parseInt(p) + 1), nName)
}
}
self.PlayIDs = pi
self.PlayList = PlayList
self.PlayListCheck = pc
}
}
if (self.PlayIDs.length != oldLength) {
self.clearList(oldLength)
}
}
instance.prototype.updateStatus = function () {
var self = this
var tenths = self.config.useTenths ? 0 : 1
var ps = self.PlayStatus
var state = self.PlayState
var tElapsed = ps.length * ps.position
var eh = Math.floor(tElapsed / 3600)
var ehh = ('00' + eh).slice(-2)
var em = Math.floor(tElapsed / 60) % 60
var emm = ('00' + em).slice(-2)
var es = Math.floor(tElapsed % 60)
var ess = ('00' + es).slice(-2)
var eft = ''
if (ehh > 0) {
eft = ehh + ':'
}
if (emm > 0) {
eft = eft + emm + ':'
}
eft = eft + ess
var tLeft = ps.length * (1 - ps.position)
if (tLeft > 0) {
tLeft += tenths
}
var h = Math.floor(tLeft / 3600)
var hh = ('00' + h).slice(-2)
var m = Math.floor(tLeft / 60) % 60
var mm = ('00' + m).slice(-2)
var s = Math.floor(tLeft % 60)
var ss = ('00' + s).slice(-2)
var ft = ''
if (hh > 0) {
ft = hh + ':'
}
if (mm > 0) {
ft = ft + mm + ':'
}
ft = ft + ss
if (tenths == 0) {
var f = Math.floor((tLeft - Math.trunc(tLeft)) * 10)
var ms = ('0' + f).slice(-1)
if (tLeft < 5 && tLeft != 0) {
ft = ft.slice(-1) + '.' + ms
}
}
self.setVariable('v_ver', self.vlcVersion)
self.setVariable('r_id', self.NowPlaying)
self.setVariable('r_name', ps.title)
self.setVariable('r_num', ps.num)
self.setVariable(
'r_stat',
state == self.VLC_IS_PLAYING
? self.MSTATUS_CHAR.running
: state == self.VLC_IS_PAUSED
? self.MSTATUS_CHAR.paused
: self.MSTATUS_CHAR.stopped
)
self.setVariable('r_hhmmss', hh + ':' + mm + ':' + ss)
self.setVariable('r_hh', hh)
self.setVariable('r_mm', mm)
self.setVariable('r_ss', ss)
self.setVariable('r_left', ft)
self.setVariable('e_hhmmss', ehh + ':' + emm + ':' + ess)
self.setVariable('e_hh', ehh)
self.setVariable('e_mm', emm)
self.setVariable('e_ss', ess)
self.setVariable('e_time', eft)
self.checkFeedbacks()
}
instance.prototype.updatePlayback = function (data) {
var self = this
var stateChanged = false
// hmmm. parsing the buffer directly frequently threw an error
// so I extracted as a string first to debug and it seems
// more robust this way. A glitch in JSON.parse?
var debuf = data.toString()
var pbInfo = JSON.parse(debuf)
var wasPlaying = pbStat({ currentplid: self.NowPlaying, position: self.PlayStatus.position })
self.vlcVersion = pbInfo.version
function pbStat(info) {
return info.currentplid + ':' + info.position + ':' + self.PlayState + ':' + self.PlayStatus.title
}
///
/// pb vars and feedback here
///
stateChanged =
stateChanged || self.PlayState != (self.PlayState = ['stopped', 'paused', 'playing'].indexOf(pbInfo.state))
stateChanged = stateChanged || self.PlayRepeat != (self.PlayRepeat = pbInfo.repeat ? true : false)
stateChanged = stateChanged || self.PlayLoop != (self.PlayLoop = pbInfo.loop ? true : false)
stateChanged = stateChanged || self.PlayRandom != (self.PlayRandom = pbInfo.random ? true : false)
stateChanged = stateChanged || self.PlayFull != (self.PlayFull = pbInfo.fullscreen ? true : false)
if (pbInfo.currentplid < 2) {
self.NowPlaying = -1
self.PlayStatus = self.NO_CLIP
} else if (self.PlayIDs.length > 0) {
if (pbInfo.currentplid) {
self.NowPlaying = pbInfo.currentplid
var t = self.PlayList[self.NowPlaying] ? self.titleMunge(self.PlayList[self.NowPlaying].name) : ''
self.PlayStatus = {
title: t,
num: 1 + self.PlayIDs.indexOf(pbInfo.currentplid.toString()),
length: pbInfo.length,
position: pbInfo.position,
time: pbInfo.time,
}
} else {
self.NowPlaying = -1
self.PlayStatus = self.NO_CLIP
}
}
if (stateChanged) {
self.checkFeedbacks()
}
if (pbStat(pbInfo) != wasPlaying) {
self.updateStatus()
}
}
instance.prototype.getRequest = function (url, cb) {
var self = this
var emsg = ''
// wait until prior request is finished or timed-out
// to reduce stacking of unanswered requests
if (self.PollWaiting > 0) {
return
}
self.PollWaiting++
self.client
.get(self.baseURL + url, self.auth, function (data, response) {
// data is a Buffer
if (response.statusCode == 401) {
// error/not found
if (self.lastStatus != self.STATUS_WARNING) {
emsg = response.statusMessage + '.\nBad Password?'
self.status(self.STATUS_WARNING, emsg)
self.log('error', emsg)
self.lastStatus = self.STATUS_WARNING
}
} else if (response.statusCode != 200) {
// page OK
self.show_error({ message: 'Remote says: ' + response.statusMessage + '\nIs this VLC?' })
} else if (data[0] != 123) {
// but is it JSON?
// check 1st character of data for JSON open brace '{'
// otherwise it is probably an HTML page from VLC
// apparently password is not the only issue
// so forward VLC response to logs
emsg = data.toString()
if (self.lastStatus != self.STATUS_WARNING) {
self.status(self.STATUS_WARNING, emsg)
self.log('error', emsg)
self.lastStatus = self.STATUS_WARNING
}
} else {
if (self.lastStatus != self.STATUS_OK) {
self.status(self.STATUS_OK)
self.log('info', 'Connected to ' + self.config.host + ':' + self.config.port)
self.lastStatus = self.STATUS_OK
}
cb.call(self, data)
}
self.PollWaiting--
})
.on('error', function (err) {
self.show_error(err)
self.PollWaiting--
})
}
instance.prototype.pollPlaylist = function () {
var self = this
// don't ask until connected (we have a valid status response)
if (self.lastStatus == self.STATUS_OK) {
self.getRequest('/requests/playlist.json', self.updatePlaylist)
}
}
instance.prototype.pollPlayback = function () {
var self = this
var data
var pollNow = false
var pollTicks = self.lastStatus == self.STATUS_OK ? 5 : 50
// poll every tick if not stopped and hires
pollNow = self.PlayState != self.VLC_IS_STOPPED && self.hires
// or poll every 500ms if connected and not playing
// every 5 seconds if not connected to allow for timeouts
pollNow = pollNow || 0 == self.PollCount % pollTicks
if (pollNow) {
self.getRequest('/requests/status.json', self.updatePlayback)
}
self.PollCount += 1
}
// When module gets deleted
instance.prototype.destroy = function () {
var self = this
self.clear(true)
self.disabled = true
self.status(self.STATUS_UNKNOWN, 'Disabled')
self.debug('destroy')
}
// Return config fields for web config
instance.prototype.config_fields = function () {
var self = this
return [
{
type: 'textinput',
id: 'host',
label: 'Target IP',
width: 8,
default: '127.0.0.1',
regex: self.REGEX_IP,
},
{
type: 'textinput',
id: 'port',
label: 'Target Port',
width: 4,
default: 8080,
regex: self.REGEX_PORT,
},
{
type: 'textinput',
id: 'password',
label: 'HTTP Password (required)',
width: 8,
},
{
type: 'checkbox',
id: 'hires',
label: 'Increase timer resolution?',
tooltip: 'Poll playback counter more frequently\nfor better response and resolution',
default: false,
width: 4,
},
{
type: 'number',
id: 'pre_clear',
label: 'Number of clip names to reserve',
tooltip: 'Always create this many clip names.\nPrevents $NA when clip name is empty.',
default: 0,
min: 0,
max: 50,
width: 8,
},
{
type: 'checkbox',
id: 'use_bullet',
label: 'Use \u00b7 for empty?',
tooltip: 'Display \u00b7 for empty clip names\notherwise display blank.',
default: false,
width: 4,
},
]
}
instance.prototype.init_presets = function () {
var self = this
var presets = [
{
category: 'Player',
label: 'Play',
bank: {
style: 'png',
text: '',
png64: self.ICON_PLAY_INACTIVE,
pngalignment: 'center:center',
size: '18',
color: '16777215',
bgcolor: self.rgb(0, 0, 0),
},
actions: [
{
action: 'play',
options: {},
},
],
feedbacks: [
{
type: 'c_status',
options: {
fg: '16777215',
bg: self.rgb(0, 128, 0),
playStat: '2',
},
},
],
},
{
category: 'Player',
label: 'Pause',
bank: {
style: 'png',
text: '',
png64: self.ICON_PAUSE_INACTIVE,
pngalignment: 'center:center',
size: '18',
color: self.rgb(255, 255, 255),
bgcolor: self.rgb(0, 0, 0),
},
actions: [
{
action: 'pause',
options: {},
},
],
feedbacks: [
{
type: 'c_status',
options: {
fg: '16777215',
bg: self.rgb(128, 128, 0),
playStat: '1',
},
},
],
},
{
category: 'Player',
label: 'Stop',
bank: {
style: 'png',
text: '',
png64: self.ICON_STOP_INACTIVE,
pngalignment: 'center:center',
size: '18',
color: '16777215',
bgcolor: self.rgb(0, 0, 0),
},
actions: [
{
action: 'stop',
options: {},
},
],
feedbacks: [
{
type: 'c_status',
options: {
fg: '16777215',
bg: self.rgb(128, 0, 0),
playStat: '0',
},
},
],
},
{
category: 'Player',
label: 'Loop',
bank: {
style: 'png',
text: 'Loop Mode',
size: '18',
color: '16777215',
bgcolor: self.rgb(0, 0, 0),
},
actions: [
{
action: 'loop',
options: {},
},
],
feedbacks: [
{
type: 'c_loop',
options: {
fg: '16777215',
bg: self.rgb(0, 128, 128),
},
},
],
},
{
category: 'Player',
label: 'Repeat',
bank: {
style: 'png',
text: 'Repeat Mode',
size: '18',
color: '16777215',
bgcolor: self.rgb(0, 0, 0),
},
actions: [
{
action: 'repeat',
options: {},
},
],
feedbacks: [
{
type: 'c_repeat',
options: {
fg: '16777215',
bg: self.rgb(128, 0, 128),
playStat: '0',
},
},
],
},
{
category: 'Player',
label: 'Shuffle',
bank: {
style: 'png',
text: 'Shuffle Mode',
size: '18',
color: '16777215',
bgcolor: self.rgb(0, 0, 0),
},
actions: [
{
action: 'shuffle',
options: {},
},
],
feedbacks: [
{
type: 'c_random',
options: {
fg: '16777215',
bg: self.rgb(0, 0, 128),
playStat: '0',
},
},
],
},
{
category: 'Player',
label: 'Full Screen',
bank: {
style: 'png',
text: 'Full Screen Mode',
size: '18',
color: '16777215',
bgcolor: self.rgb(0, 0, 0),
},
actions: [
{
action: 'full',
options: {},
},
],
feedbacks: [
{
type: 'c_full',
options: {
fg: '16777215',
bg: self.rgb(204, 0, 128),
playStat: '0',
},
},
],
},
]