Resume playback whenever needed
This commit is contained in:
parent
2e64a3200f
commit
7d7b03474d
|
@ -282,17 +282,13 @@ local mplayer = {
|
|||
currentScreen = 2,
|
||||
}
|
||||
|
||||
local function setupTerminal()
|
||||
for k, v in pairs(mplayer.colors) do
|
||||
for k, v in pairs(mplayer.colors) do
|
||||
term.setPaletteColor(v, settings.get("mplayer.colors." .. k))
|
||||
end
|
||||
term.setCursorPos(1, 1)
|
||||
term.setBackgroundColor(mplayer.colors.bg)
|
||||
term.setTextColor(mplayer.colors.fg)
|
||||
term.clear()
|
||||
end
|
||||
|
||||
setupTerminal()
|
||||
term.setCursorPos(1, 1)
|
||||
term.setBackgroundColor(mplayer.colors.bg)
|
||||
term.setTextColor(mplayer.colors.fg)
|
||||
term.clear()
|
||||
|
||||
local tw, th = term.getSize()
|
||||
parallel.waitForAny(
|
||||
|
@ -416,6 +412,11 @@ function()
|
|||
elseif ev == "tape_removed" then
|
||||
mplayer.songs = {}
|
||||
elseif ev == "tape_inserted" then
|
||||
local seekToAndPlay = nil
|
||||
if drive.getState() == "PLAYING" then
|
||||
seekToAndPlay = drive.getPosition()
|
||||
end
|
||||
|
||||
drive.stop()
|
||||
drive.seek(-drive.getSize())
|
||||
for i = 1, 48 do
|
||||
|
@ -431,6 +432,12 @@ function()
|
|||
}
|
||||
end
|
||||
end
|
||||
|
||||
if seekToAndPlay ~= nil then
|
||||
drive.seek(-drive.getSize())
|
||||
drive.seek(seekToAndPlay)
|
||||
drive.play()
|
||||
end
|
||||
elseif ev ~= "timer" then
|
||||
if drive.isDummy then
|
||||
local m = term.redirect(peripheral.wrap("right"))
|
||||
|
|
Loading…
Reference in New Issue