-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.lua
103 lines (85 loc) · 2.13 KB
/
main.lua
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
require("script.core");
------------------------------------------------------------------------
-- Local variable
------------------------------------------------------------------------
local funcArray = {exitKodi, shutdownKodi, suspendKodi, hibernateKodi, rebootKodi};
------------------------------------------------------------------------
-- actions
------------------------------------------------------------------------
--@help Navigate home
actions.home = function ()
send("Input.Home");
end
--@help Toggle context menu
actions.menu = function ()
input("contextmenu");
end
--@help Toggle information
actions.info = function ()
input("info");
end
actions.power = function ()
libs.server.update({
type = "dialog",
title = "Shutdown",
children = {
{ type = "item", text="Exit" },
{ type = "item", text="Shutdown" },
{ type = "item", text="Suspend" },
{ type = "item", text="Hibernate" },
{ type = "item", text="Reboot" }
},
ontap = "shutdown"
});
end
actions.shutdown = function(i)
i = i + 1;
if funcArray[i] ~= nil then
funcArray[i]();
end
end
--@help Set volume level
--@param vol:number Volume level (0-100)
actions.set_volume = function (vol)
if (vol > 100) then vol = 100; end
if (vol < 0) then vol = 0; end
send("Application.SetVolume", { volume = vol });
end
--@help Toggle mute volume
actions.volume_mute = function ()
send("Application.SetMute", { mute = "toggle" });
end
--@help Lower volume
actions.volume_down = function ()
actions.set_volume(volume() - 10);
end
--@help Raise volume
actions.volume_up = function ()
actions.set_volume(volume() + 10);
end
--@help Navigate up
actions.up = function ()
input("up");
end
--@help Navigate left
actions.left = function ()
input("left");
end
--@help Select current item
actions.select = function ()
Trace("actions.select");
input("select");
tSelectId = libs.timer.interval(update_status, 1000);
end
--@help Navigate right
actions.right = function ()
input("right");
end
--@help Navigate back
actions.back = function ()
input("back");
end
--@help Navigate down
actions.down = function ()
input("down");
end