Reset current song on tape removal

Also added quick jump every 5 minutes
This commit is contained in:
Casey 2023-10-20 04:38:41 +03:00
parent 7e94bc4f0a
commit d6d0e42978
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 9 additions and 1 deletions

View File

@ -495,6 +495,7 @@ function()
tw, th = term.getSize() tw, th = term.getSize()
elseif ev == "tape_removed" then elseif ev == "tape_removed" then
mplayer.songs = {} mplayer.songs = {}
mplayer.currentSong = 0
elseif ev == "tape_inserted" then elseif ev == "tape_inserted" then
local seekToAndPlay = nil local seekToAndPlay = nil
if drive.getState() == "PLAYING" then if drive.getState() == "PLAYING" then
@ -515,11 +516,18 @@ function()
length = drive.getSize() - 10 length = drive.getSize() - 10
}, },
{ {
title = "[ !!! ] It's just a regular tape", title = "NOTE: It's just a regular tape",
offset = drive.getSize() - 10, offset = drive.getSize() - 10,
length = 10 length = 10
} }
} }
for t = 1, drive.getSize(), 6000 * 60 * 5 do
table.insert(mplayer.songs, 2, {
title = "Skip to " .. time2str(t),
offset = t,
length = 6000 * 60 * 5
})
end
break break
end end
title = title:sub(1, title:find("\x00")) title = title:sub(1, title:find("\x00"))