Proper drive state handling
This commit is contained in:
parent
eece2153e4
commit
18de04bfc1
|
@ -378,10 +378,19 @@ function()
|
|||
term.clearLine()
|
||||
|
||||
local timeString = string.format("[%s:%s]", time2str(time), time2str(duration))
|
||||
if drive.getState() == "PLAYING" then
|
||||
if drive.getState() ~= "STOPPED" then
|
||||
term.setTextColor(mplayer.colors.status)
|
||||
local speen = spinner[(math.floor(drive.getPosition() / 600) % #spinner) + 1]
|
||||
term.write(speen .. " Playing: ") -- 11 characters
|
||||
local action = ""
|
||||
if drive.getState() == "PLAYING" then action = "Playing:"
|
||||
elseif drive.getState() == "REWINDING" then action = "Rewinding"
|
||||
elseif drive.getState() == "FORWARDING" then action = "Forwarding"
|
||||
else
|
||||
printError("Unknown drive state: "..tostring(drive.getState()))
|
||||
return
|
||||
end
|
||||
action = speen .. " " .. action
|
||||
term.write(action)
|
||||
|
||||
-- Progressbar
|
||||
local lw = math.floor(tw * time / duration)
|
||||
|
@ -394,8 +403,8 @@ function()
|
|||
term.write(string.rep("\xad", tw - lw - 1))
|
||||
|
||||
-- Statusline text
|
||||
term.setCursorPos(12, th)
|
||||
local w = tw - #timeString - 12 -- "Playing: " plus extra space
|
||||
term.setCursorPos(#action + 2, th)
|
||||
local w = tw - #timeString - #action - 2 -- "Playing: ", spinner plus spacing
|
||||
|
||||
term.setTextColor(mplayer.colors.current)
|
||||
if #title <= w then
|
||||
|
|
Loading…
Reference in New Issue