From 200a43fad309813c3ebbc3da35dbb97367bde7ac Mon Sep 17 00:00:00 2001
From: jacqueline <me@jacqueline.id.au>
Date: Thu, 18 Jan 2024 14:49:07 +1100
Subject: [PATCH] fix issues with some song info not appearing

---
 src/audio/audio_decoder.cpp | 18 +++++++-----------
 src/lua/property.cpp        |  2 +-
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/audio/audio_decoder.cpp b/src/audio/audio_decoder.cpp
index fd011c51..5b057240 100644
--- a/src/audio/audio_decoder.cpp
+++ b/src/audio/audio_decoder.cpp
@@ -139,17 +139,13 @@ auto Decoder::BeginDecoding(std::shared_ptr<TaggedStream> stream) -> bool {
   }
   stream->SetPreambleFinished();
 
-  if (open_res->total_samples) {
-    timer_.reset(new Timer(std::shared_ptr<Track>{new Track{
-                               .tags = stream->tags(),
-                               .db_info = {},
-                               .bitrate_kbps = 0,
-                               .encoding = stream->type(),
-                           }},
-                           open_res.value()));
-  } else {
-    timer_.reset();
-  }
+  timer_.reset(new Timer(std::shared_ptr<Track>{new Track{
+                             .tags = stream->tags(),
+                             .db_info = {},
+                             .bitrate_kbps = open_res->sample_rate_hz,
+                             .encoding = stream->type(),
+                         }},
+                         open_res.value()));
 
   current_sink_format_ = IAudioOutput::Format{
       .sample_rate = open_res->sample_rate_hz,
diff --git a/src/lua/property.cpp b/src/lua/property.cpp
index c16434fa..33600ee8 100644
--- a/src/lua/property.cpp
+++ b/src/lua/property.cpp
@@ -183,7 +183,7 @@ static auto pushTagValue(lua_State* L, const database::TagValue& val) -> void {
           for (const auto& i : arg) {
             lua_pushlstring(L, i.data(), i.size());
             lua_pushboolean(L, true);
-            lua_rawset(L, -2);
+            lua_rawset(L, -3);
           }
         } else if constexpr (std::is_same_v<T, uint32_t>) {
           lua_pushinteger(L, arg);