diff options
| author | ailurux <ailuruxx@gmail.com> | 2024-07-30 04:36:48 +0000 |
|---|---|---|
| committer | cooljqln <cooljqln@noreply.codeberg.org> | 2024-07-30 04:36:48 +0000 |
| commit | b34959917446ac5d47ddec7bb6d98a6397045558 (patch) | |
| tree | bb71f4e85ed1d4979c508ffa1cb0a74ecba0ba54 /src/tangara/lua/lua_queue.cpp | |
| parent | 64c8496a91a166e52b7d77a3189e2696720294b7 (diff) | |
| download | tangara-fw-b34959917446ac5d47ddec7bb6d98a6397045558.tar.gz | |
daniel/playlist-queue (#84)
Support for playlist files being opened along side the queue's own playlist. Playlists can be opened from the file browser, if the file ends in ".playlist" (will add support for .m3u as well eventually)
Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/84
Co-authored-by: ailurux <ailuruxx@gmail.com>
Co-committed-by: ailurux <ailuruxx@gmail.com>
Diffstat (limited to 'src/tangara/lua/lua_queue.cpp')
| -rw-r--r-- | src/tangara/lua/lua_queue.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/tangara/lua/lua_queue.cpp b/src/tangara/lua/lua_queue.cpp index bc393aa5..9e2002e6 100644 --- a/src/tangara/lua/lua_queue.cpp +++ b/src/tangara/lua/lua_queue.cpp @@ -57,8 +57,22 @@ static auto queue_clear(lua_State* state) -> int { return 0; } +static auto queue_open_playlist(lua_State* state) -> int { + Bridge* instance = Bridge::Get(state); + audio::TrackQueue& queue = instance->services().track_queue(); + size_t len = 0; + const char* str = luaL_checklstring(state, 1, &len); + if (!str) { + return 0; + } + queue.clear(); + queue.openPlaylist(str); + return 0; +} + static const struct luaL_Reg kQueueFuncs[] = {{"add", queue_add}, {"clear", queue_clear}, + {"open_playlist", queue_open_playlist}, {NULL, NULL}}; static auto lua_queue(lua_State* state) -> int { |
