Commit graph

22 commits

Author SHA1 Message Date
William Wilgus
5433ea5405 random_playlist.lua make index more sparse
The name of the game here is to load the database file without taking over the
audio buffer.

5mb database file will now successfully load

added an option to save playlist directly to disk and bypass the rb builtin function completely
however if you choose play the playlist will be loaded back from the disk into the inram dynamic playlist

Change-Id: I43e76f63379721f36ed082c0ad47a6f2539fb15f
2021-12-08 22:09:16 -05:00
William Wilgus
221e8752cc plugin.h & lua add playlist_insert_playlist
having issues running lua and loading a playlist

Change-Id: I72d32d77e6567ceed7e8e5fd492eebf0ee44561a
2021-12-05 23:10:19 -05:00
William Wilgus
8a8dfa0e52 random_playlist.lua bugfix
removing trackks after create appears to cause crashes
removing the playlist appears to be sufficient to prevent
append to the currently saved random_playlist.m3u8

added yield on screent update, since we have no sleep this could be an issue

Change-Id: If04517f852e329088e30885d964f2407a2ebf318
2021-12-05 15:03:02 -05:00
William Wilgus
7200b738a5 lua random_playlist generator
uses the database to create random playlists of specified size

with the advanced GUI you can..
set the number of songs (up to max playlist buffer)
set the number of tracks before a repeat is allowed
play the tracks when finished

-- fix a parsing bug where first and last entry in database
   were corrupted

-- Incremental loading for very large databases, allows decent speed and lower ram usage

Change-Id: Ia95469b6a04625b621129ec61e5db4b2b00adc5e
2021-12-03 16:56:12 -05:00
William Wilgus
f4c7dc933d lua add ability to pass PLUGIN_ ret vals with os.exit() + add defines
Change-Id: I45998245271fbd8fee4534f8497b014025e4dcc7
2021-10-21 22:28:05 -04:00
William Wilgus
adff45ca21 lua -- temp loader
fix a few bugs, improve memory usage

Change-Id: I6ceefd033000a6178eab0dd513679b5d72cec81c
2021-05-06 21:36:55 -04:00
William Wilgus
489a5f3ff7 lua add ability to use custom kbd layouts
bring custom keyboard layouts to lua
conversion to the proper format requires create_kbd_layout.lua
just pass a lua string with your desired layout

Change-Id: I14a392410846311a4f3cf8dda0e88d39834d0418
2021-05-04 01:52:08 +00:00
William Wilgus
20cd89908d lua submenus add a way to dynamically add items
updated example script and renamed some functions as well

fixed bug in printtable cursor position if greater than maxlines for the
screen would reset to item 1

now we move the list start and select it
(and try to center it on the screen)

fixed a few bugs in the add_menu code

Change-Id: I01dead0481ef2e925af8b4cc6c14e36c2859dbba
2021-04-30 13:38:54 +00:00
William Wilgus
63b6281505 lua add submenu module + cleanup
allows menus + submenus + context menus all with simple tables
menu_t which is a table of strings
func_t which are the corresponding functions to go with those strings

see lua_scripts/submenu_demo.lua

Change-Id: I907b74b4abef0ecbe49f181d0ced6e6d20e94de5
2021-04-28 04:37:16 +00:00
William Wilgus
557ff6a981 lua print_button script
also allow splash_scroller to be used as static text display

Change-Id: Idc8c9e60ada920e2d1abd5301b59bd235e21a1c2
2021-04-24 00:00:44 -04:00
William Wilgus
acda37edd1 lua print table put_line a do_menu alternative
add stylized lines to lua

the exported do_menu has a severe limitation of 64 items
it also requires double the memory

put_line is the way rockbox builds menus

update printtable

user config from core -- done
code cleanup
fixed for 1-bit screens
changed button behavior
fixed for 2-bit screens

Change-Id: I4de55e42685aa1d2f53a33bc8e980827864e810b
2021-04-20 03:30:41 +00:00
William Wilgus
ef34126913 lua add better memory stats
lua gives you a memory used number that only reflects the current allocations
if fact it doesn't even give you a way to get the amount of ram free

rb.mem_stats() seeks to fill this gap by marking the memory allocated for lua
with a sentinel value which can later be checked to get a high water mark
of the ram used by lua and a pretty good idea of how much ram is available

Also includes an example script
usage:
used, allocd, free = rb.mem_stats()

Change-Id: Ia282869f989848324d7d88c7df4827fdbce4fb4e
2020-10-05 11:53:27 -04:00
William Wilgus
1aa739e3c3 lua misc tweaks and cleanup
checks button_status in rockev
strpbrk_n custom implementation allows setting max search len in source string
add some branch prediction where appropriate
fix formatting in splash_scroller script

Change-Id: Id5d8e9d83f4b3e361ccb67b403af8f9a8a31b8f0
2020-10-04 04:00:54 -04:00
William Wilgus
80c3b84e08 lua Add scrollable stack traceback WIP
lua currently splashes a stack traceback on error
for deep tracebacks and especially on devices with smaller screens
this leaves out a lot of vital information

in the past I have resorted to splitting the traceback string or
even saving the return to a file

This patch provides a scrollable buffer with rudimentary text reflow
to allow you to read the whole traceback string

Upon traceback if you press nothing the screen will display for 5 seconds
If you press OK or CANCEL it will quit immediately
PREV/NEXT scrolls the list on button press timeout is disabled

lua now provides rb.splash_scroller(timeout, str)

example script provided too

Change-Id: Idbc8ce0c514196f0fae48c43aeaea8b60d6da1a5
2020-10-03 22:09:52 +00:00
William Wilgus
1c0648c603 lua rockevents reduce context switching for action and buttons
check if any buttons are waiting in the queue before triggering
the event thread for action & button events

makes button events quicker and also spend less time interrupting lua
both wins

Change-Id: I38346c084afdd99e4608f40b52053ee39730fb40
2020-09-30 16:33:38 +00:00
William Wilgus
018e0051bc lua playback example
cool little lua based audio player
creates dynamic playlist of 10 mp3s found on device if no music loaded

I had to limit the depth of search to 3 levels due to the recursive
nature of the current dirbrowser functions this could be rectified with a
bit more code

fixed a bug in print.lua that kept scrolling text even after screen clear

Change-Id: Ifd285332df41a409ecaeb1ea447ad15537b5d04c
2020-09-27 15:57:34 +00:00
William Wilgus
0f23cadbca lua -- add sort by name, size, date to filebrowse include
I had previously added the fuctionality to luadir but I didn't update
the examples

also breaks out the file_browser function to be a bit more accessible

Change-Id: I14067256b9d76a757f732840cbee1cf84d775b1b
2020-09-25 23:07:30 -04:00
William Wilgus
267d04d2bd Lua add metadata and settings reading helper module
Adds example scripts for reading track metadata + dumping albumart
and rockbox settings

settings are now stored as a table of strings rather than a table of tables
as it saves ~15 kb of ram without adding much complexity

Change-Id: I611c312b2a60ab96e595e4710b17aedbd6c0689b
2019-09-07 03:10:59 +02:00
William Wilgus
d1f349bf77 lua optimize print include, fix draw_poly
Change-Id: Ibb530cfa63681727be518173404952e897c9d297
2019-08-04 17:54:03 +02:00
William Wilgus
f85df30e3e lua add rlimg.lua example script split large includes to separate files
Change-Id: I67cac5bc4ce5525ab30abf9443f6cc1a33190512
2019-08-04 16:57:02 +02:00
William Wilgus
9d2af8777f lua update tagnav.lua with reload menu and bug fixes
Change-Id: I0e7364a3432bf867cb368c131bf83643115f9d0b
2019-08-02 05:16:43 +02:00
William Wilgus
90118f14cf lua add demo scripts, atexit handler, gui_scrollbar_draw
Change-Id: Ie8794e8a487f73952dae43e036787b6972fdbbee
2019-07-29 02:51:29 -05:00