summaryrefslogtreecommitdiff
path: root/src/lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/include/property.hpp2
-rw-r--r--src/lua/property.cpp23
2 files changed, 12 insertions, 13 deletions
diff --git a/src/lua/include/property.hpp b/src/lua/include/property.hpp
index 7d160fba..f19fdeec 100644
--- a/src/lua/include/property.hpp
+++ b/src/lua/include/property.hpp
@@ -23,7 +23,7 @@ using LuaValue = std::variant<std::monostate,
int,
bool,
std::string,
- audio::Track,
+ audio::TrackInfo,
drivers::bluetooth::Device,
std::vector<drivers::bluetooth::Device>>;
diff --git a/src/lua/property.cpp b/src/lua/property.cpp
index f721f9ce..200f4d5c 100644
--- a/src/lua/property.cpp
+++ b/src/lua/property.cpp
@@ -221,7 +221,7 @@ static auto pushTagValue(lua_State* L, const database::TagValue& val) -> void {
val);
}
-static void pushTrack(lua_State* L, const audio::Track& track) {
+static void pushTrack(lua_State* L, const audio::TrackInfo& track) {
lua_newtable(L);
for (const auto& tag : track.tags->allPresent()) {
@@ -229,19 +229,18 @@ static void pushTrack(lua_State* L, const audio::Track& track) {
pushTagValue(L, track.tags->get(tag));
lua_settable(L, -3);
}
- if (track.db_info) {
- lua_pushliteral(L, "id");
- lua_pushinteger(L, track.db_info->id);
+
+ if (track.duration) {
+ lua_pushliteral(L, "duration");
+ lua_pushinteger(L, track.duration.value());
lua_settable(L, -3);
}
- lua_pushliteral(L, "duration");
- lua_pushinteger(L, track.duration);
- lua_settable(L, -3);
-
- lua_pushliteral(L, "bitrate_kbps");
- lua_pushinteger(L, track.bitrate_kbps);
- lua_settable(L, -3);
+ if (track.bitrate_kbps) {
+ lua_pushliteral(L, "bitrate_kbps");
+ lua_pushinteger(L, track.bitrate_kbps.value());
+ lua_settable(L, -3);
+ }
lua_pushliteral(L, "encoding");
lua_pushstring(L, codecs::StreamTypeToString(track.encoding).c_str());
@@ -289,7 +288,7 @@ auto Property::PushValue(lua_State& s) -> int {
lua_pushboolean(&s, arg);
} else if constexpr (std::is_same_v<T, std::string>) {
lua_pushstring(&s, arg.c_str());
- } else if constexpr (std::is_same_v<T, audio::Track>) {
+ } else if constexpr (std::is_same_v<T, audio::TrackInfo>) {
pushTrack(&s, arg);
} else if constexpr (std::is_same_v<T, drivers::bluetooth::Device>) {
pushDevice(&s, arg);