summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorailurux <ailuruxx@gmail.com>2024-10-04 14:19:13 +1000
committerailurux <ailuruxx@gmail.com>2024-10-04 14:19:13 +1000
commit39a5d062fc13ad81e91968e1c30b729ec606d934 (patch)
tree5d86996d0d5214a2d34c43bde192a80f415b99f8 /src
parent6318b272842f5447c90d55123a60fdde2202993d (diff)
downloadtangara-fw-39a5d062fc13ad81e91968e1c30b729ec606d934.tar.gz
Fix issues with deserialising queue when queue exists already
Diffstat (limited to 'src')
-rw-r--r--src/tangara/audio/playlist.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/tangara/audio/playlist.cpp b/src/tangara/audio/playlist.cpp
index 805b0953..db712252 100644
--- a/src/tangara/audio/playlist.cpp
+++ b/src/tangara/audio/playlist.cpp
@@ -32,9 +32,6 @@ Playlist::Playlist(const std::string& playlistFilepath)
auto Playlist::open() -> bool {
std::unique_lock<std::mutex> lock(mutex_);
- if (file_open_) {
- return true;
- }
FRESULT res =
f_open(&file_, filepath_.c_str(), FA_READ | FA_WRITE | FA_OPEN_ALWAYS);
@@ -185,6 +182,9 @@ auto Playlist::deserialiseCache() -> bool {
total_size_ = entries->get(1)->asUint()->unsignedValue();
+ // In case we have existing entries
+ offset_cache_.clear();
+
// Read in the cache
for (size_t i = 2; i < entries->size(); i++) {
offset_cache_.push_back(entries->get(i)->asUint()->unsignedValue());
@@ -306,10 +306,7 @@ MutablePlaylist::MutablePlaylist(const std::string& playlistFilepath)
auto MutablePlaylist::open() -> bool {
std::unique_lock<std::mutex> lock(mutex_);
- if (file_open_) {
- return true;
- }
-
+
FRESULT res =
f_open(&file_, filepath_.c_str(), FA_READ | FA_WRITE | FA_OPEN_ALWAYS);
if (res != FR_OK) {