From 3421bd652c39b253872e43d3b6e43664bd0b66e2 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 28 Aug 2024 15:30:53 +1000 Subject: When clicking a track in the file browser, play it Includes adding a `playback.is_playable` for working out whether or not a particular file is able to be played --- src/tangara/lua/file_iterator.cpp | 1 - src/tangara/lua/file_iterator.hpp | 3 +-- src/tangara/lua/lua_filesystem.cpp | 7 ------- 3 files changed, 1 insertion(+), 10 deletions(-) (limited to 'src/tangara/lua') diff --git a/src/tangara/lua/file_iterator.cpp b/src/tangara/lua/file_iterator.cpp index 823775e8..71daf2d8 100644 --- a/src/tangara/lua/file_iterator.cpp +++ b/src/tangara/lua/file_iterator.cpp @@ -79,7 +79,6 @@ auto FileIterator::iterate(bool show_hidden) -> bool { .index = offset_, .isHidden = hidden, .isDirectory = (info.fattrib & AM_DIR) > 0, - .isTrack = false, // TODO .filepath = original_path_ + (original_path_.size() > 0 ? "/" : "") + info.fname, .name = info.fname, diff --git a/src/tangara/lua/file_iterator.hpp b/src/tangara/lua/file_iterator.hpp index c4071445..2d5c2d7d 100644 --- a/src/tangara/lua/file_iterator.hpp +++ b/src/tangara/lua/file_iterator.hpp @@ -19,7 +19,6 @@ struct FileEntry { int index; bool isHidden; bool isDirectory; - bool isTrack; std::string filepath; std::string name; }; @@ -44,4 +43,4 @@ class FileIterator { auto iterate(bool reverse = false) -> bool; }; -} // namespace lua \ No newline at end of file +} // namespace lua diff --git a/src/tangara/lua/lua_filesystem.cpp b/src/tangara/lua/lua_filesystem.cpp index e3a3018d..9c2ea880 100644 --- a/src/tangara/lua/lua_filesystem.cpp +++ b/src/tangara/lua/lua_filesystem.cpp @@ -117,12 +117,6 @@ static auto file_entry_is_hidden(lua_State* state) -> int { return 1; } -static auto file_entry_is_track(lua_State* state) -> int { - lua::FileEntry* entry = check_file_entry(state, 1); - lua_pushboolean(state, entry->isTrack); - return 1; -} - static auto file_entry_name(lua_State* state) -> int { lua::FileEntry* entry = check_file_entry(state, 1); lua_pushlstring(state, entry->name.c_str(), entry->name.size()); @@ -139,7 +133,6 @@ static const struct luaL_Reg kFileEntryFuncs[] = {{"filepath", file_entry_path}, {"name", file_entry_name}, {"is_directory", file_entry_is_dir}, {"is_hidden", file_entry_is_hidden}, - {"is_track", file_entry_is_track}, {"__tostring", file_entry_name}, {"__gc", file_entry_gc}, {NULL, NULL}}; -- cgit v1.2.3