summaryrefslogtreecommitdiff
path: root/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua32
1 files changed, 32 insertions, 0 deletions
diff --git a/main.lua b/main.lua
index a9d3cfb..8e8f3e1 100644
--- a/main.lua
+++ b/main.lua
@@ -21,6 +21,7 @@ osd_bg.data = '{\\alpha&H44&\\c&H&\\pos(0,0)}' ..
local categories = {}
local streams = {}
+local favourites = {}
local playing_stream_id
local depth = 0
@@ -86,6 +87,16 @@ local function update_osd()
col = '{\\c&H99DDFF&}'
end
+ local id
+ if opt.type == 'category' then
+ id = opt.category_id
+ else
+ id = opt.stream_id
+ end
+ if favourites[opt.type .. ':' .. id] then
+ icons = icons .. '{\\c&HFF00FF&&}★ '
+ end
+
if opt.hl then
local buf = ''
local n = 0
@@ -233,6 +244,26 @@ local function select_option()
end
end
+local function favourite_option()
+ local menu = menus[depth]
+ local opt = menu.options[menu.cursor_pos]
+
+ local id
+ if opt.type == 'category' then
+ id = opt.category_id
+ else
+ id = opt.stream_id
+ end
+ local key = opt.type .. ':' .. id
+ if favourites[key] then
+ favourites[key] = nil
+ else
+ favourites[key] = true
+ end
+
+ update_osd()
+end
+
local function prev_menu()
if depth > 1 then
depth = depth - 1
@@ -475,6 +506,7 @@ function bind_menu_keys()
bind_key('HOME', 'first-option', first_option)
bind_key('END', 'last-option', last_option)
bind_key('ENTER', 'select-option', select_option)
+ bind_key('Ctrl+f', 'favourite-option', favourite_option)
bind_key('BS', 'prev-menu', prev_menu)
bind_key('/', 'start-search', search_start)
end