forked from estbeetoo/node-red-contrib-kodi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkodi.html
134 lines (125 loc) · 4.33 KB
/
kodi.html
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
<script type="text/x-red" data-template-name="kodi-controller">
<div class="form-row">
<label for="node-config-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-config-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-config-input-host"><i class="icon-bookmark"></i> kodi Host</label>
<input type="text" id="node-config-input-host">
</div>
<div class="form-row">
<label for="node-config-input-port"><i class="icon-bookmark"></i> kodi Port</label>
<input type="text" id="node-config-input-port">
</div>
</script>
<script type="text/x-red" data-template-name="kodi-out">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-controller"><i class="icon-bookmark"></i> Kodi host</label>
<input type="text" id="node-input-controller">
</div>
<div class="form-row">
<label for="node-input-kodicommand"><i class="icon-bookmark"></i> Command</label>
<input type="text" id="node-input-kodicommand">
</div>
</script>
<script type="text/x-red" data-template-name="kodi-in">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-controller"><i class="icon-bookmark"></i> Controller</label>
<input type="text" id="node-input-controller">
</div>
</script>
<script type="text/x-red" data-help-name="kodi-out">
<p>
Use this to <b>send</b> JSON RPC commands to a Kodi player.<br/>
<b>msg.payload</b> must be a JavaScript object or a string
</p>
<p>
For example, simple string (command does not has arguments): <code>Input.Home</code><br/>
Or Javascript object (command + parameters):
<pre>{
"cmd": "Player.Stop",
"args" :{
"playerid": 0
}
}</pre>
</p>
<p>Look at official Kodi's JSON-RPC API: <a href="http://kodi.wiki/view/JSON-RPC_API/v6" target="_blank">http://kodi.wiki/view/JSON-RPC_API/v6</a></p>
</script>
<script type="text/x-red" data-help-name="kodi-in">
<p>
Use this to <b>inject</b> flows from Kodi player<br/>
Kodi notification being injected as a Javascript object, for example:
<pre>{
"data": {
"data": {
"item": {
"title": "Lounge FM Terrace ()",
"type": "song"
},
"playlistid": 0,
"position": 0
},
"sender": "xbmc"
},
"notification": "Playlist.OnAdd"
}</pre>
</p>
<p>Read more about official Kodi's JSON-RPC api here: http://kodi.wiki/view/JSON-RPC_API/v6</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('kodi-controller', {
category: 'config',
defaults: {
name: {value: ""},
host: {value: "127.0.0.1", required: true},
port: {value: 9090, required: false, validate: RED.validators.number()}
},
label: function () {
return (this.name || 'kodi' ) + "@" + this.host + ":" + this.port;
}
});
</script>
<script type="text/javascript">
RED.nodes.registerType('kodi-out', {
category: 'output',
color: '#26b050',
defaults: {
name: {value: ""},
controller: {value: "", type: "kodi-controller"},
unit_number: {value: "1", required: false},
output: {value: "1", required: false},
kodicommand: {value: ""}
},
inputs: 1,
outputs: 0,
align: 'right',
icon: "bridge-dash.png",
label: function () {
return (this.groupaddr || this.name || "kodi");
}
});
</script>
<script type="text/javascript">
RED.nodes.registerType('kodi-in', {
category: 'input',
color: '#26b050',
defaults: {
name: {value: ""},
controller: {value: "", type: "kodi-controller"}
},
inputs: 0,
outputs: 1,
icon: "bridge-dash.png",
label: function () {
return (this.groupaddr || this.name || "kodi");
}
});
</script>