diff options
| -rw-r--r-- | rt.lua | 40 |
1 files changed, 22 insertions, 18 deletions
@@ -578,6 +578,24 @@ function rt.open_option_info(opt) end end +local function goto_path(path, opt, reverse) + local start, stop, step = 1, #path, 1 + if reverse then + start, stop, step = stop, start, -1 + end + + for i = start, stop, step do + cursor_to_id(path[i].id) + if i == stop and opt.type == 'programme' then + open_option_channel_epg(path[i]) + else + rt.push_group_menu(path[i]) + end + end + + cursor_to_id(opt.id) +end + function rt.goto_option() local menu = state:menu() local opt = menu.options[menu.cursor] @@ -594,34 +612,20 @@ function rt.goto_option() end end - for i = 1, #opt.path do - cursor_to_id(opt.path[i].id) - if i == #opt.path and opt.type == 'programme' then - open_option_channel_epg(opt.path[i]) - else - rt.push_group_menu(opt.path[i]) - end - end - cursor_to_id(opt.id) - + goto_path(opt.path, opt) osd:dirty() end function rt.goto_playing() local id = state.playing_id - local obj = id and ctx.catalogue:get(id) - local path = obj and ctx.catalogue:path_to_root(obj) + local opt = id and ctx.catalogue:get(id) + local path = opt and ctx.catalogue:path_to_root(opt) if not path then return end state.depth = 1 - for i = #path, 1, -1 do - cursor_to_id(path[i].id) - rt.push_group_menu(path[i]) - end - cursor_to_id(id) - + goto_path(path, opt, true) osd:dirty() end |
