diff --git a/tape-playlist.lua b/tape-playlist.lua index 65393f4..802e0d0 100644 --- a/tape-playlist.lua +++ b/tape-playlist.lua @@ -31,6 +31,7 @@ function() while running do for i = 1, math.min(screen_h, 48) do term.setCursorPos(1, i) + term.clearLine() local song = table_of_contents[i] if song then term.write(string.format("#%2d %9s %s", i, bytes2time(song.length), song.title)) @@ -46,6 +47,11 @@ function() if ev == "mouse_click" then local x, y = table.unpack(evd, 1) + if drive.isReady() and y <= #table_of_contents then + drive.seek(-drive.getSize()) + drive.seek(table_of_contents[i].offset) + drive.play() + end elseif ev == "term_resize" then screen_w, screen_h = term.getSize() elseif ev == "tape_present" then