diff options
| author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2026-02-04 23:06:15 -0800 |
|---|---|---|
| committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2026-02-04 23:06:15 -0800 |
| commit | ca004728498a71afd401cf6b8cdc949742b7ea0f (patch) | |
| tree | 64a08975359c0116b2be1bcd2a23b55ff20d1e68 /rt.lua | |
| parent | 2fbe621881f0ac3d7f74d117bc7f6de404a9a882 (diff) | |
| download | mpv-iptv-menu-ca004728498a71afd401cf6b8cdc949742b7ea0f.tar.gz mpv-iptv-menu-ca004728498a71afd401cf6b8cdc949742b7ea0f.tar.xz | |
allow filtering search results by type
Diffstat (limited to 'rt.lua')
| -rw-r--r-- | rt.lua | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -628,7 +628,32 @@ local function search_text_transform(f, ...) return end - menu:set_search_text(str, pos) + local term + local filter + local prefix + if str:sub(1,1) == '\\' then + term = str:sub(2) + else + prefix, term = str:match('^(.-)//(.*)') + term = term or str + end + if prefix then + local fc = prefix:find('c') + local fm = prefix:find('m') + local fs = prefix:find('s') + local fg = prefix:find('g') + + filter = function(v) + return fc and (v.stream_type == 'live' or + v.stream_type == 'radio_streams') or + fm and v.stream_type == 'movie' or + fs and v.group_type == 'series' or + fg and v.type == 'group' and + v.group_type ~= 'series' + end + end + + menu:set_search_text(str, pos, term, filter) osd:dirty() end |
