From ed408fb7e9c7e061c93ccaa38ca3daa4908c2090 Mon Sep 17 00:00:00 2001 From: wood Date: Wed, 15 Jan 2020 14:38:41 +0300 Subject: [PATCH] better(probably) playlist display --- iptv.lua | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/iptv.lua b/iptv.lua index 7c69b0e..b86abc1 100644 --- a/iptv.lua +++ b/iptv.lua @@ -310,15 +310,6 @@ function filterpls() cursor=0 end -function formatentry(v) - local t - t=v.title or "" - if v.current then - t = "*"..t - end - return t -end - function play() -- mp.commandv("playlist-move", wndstart+cursor, 1) -- mp.commandv("playlist-clear") @@ -359,12 +350,17 @@ function showplaylist() msg="" i = wndstart + local prefix while plsfiltered[i] and i<=wndstart+window-1 do - if i==wndstart+cursor then - msg = msg..">" + if pls[plsfiltered[i]].current then + prefix="*" + elseif i==wndstart+cursor then + prefix=">" + else + prefix=" " end - msg = msg..formatentry(pls[plsfiltered[i]]).."\n" - i = i+1 + msg = msg..prefix..(pls[plsfiltered[i]].title or "").."\n" + i=i+1 end if wndstart>1 then msg = "...\n"..msg