summaryrefslogtreecommitdiff
path: root/src/tangara/audio/playlist.cpp
diff options
context:
space:
mode:
authorailurux <ailuruxx@gmail.com>2024-07-30 04:36:48 +0000
committercooljqln <cooljqln@noreply.codeberg.org>2024-07-30 04:36:48 +0000
commitb34959917446ac5d47ddec7bb6d98a6397045558 (patch)
treebb71f4e85ed1d4979c508ffa1cb0a74ecba0ba54 /src/tangara/audio/playlist.cpp
parent64c8496a91a166e52b7d77a3189e2696720294b7 (diff)
downloadtangara-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/audio/playlist.cpp')
-rw-r--r--src/tangara/audio/playlist.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/tangara/audio/playlist.cpp b/src/tangara/audio/playlist.cpp
index 506e473f..944ad143 100644
--- a/src/tangara/audio/playlist.cpp
+++ b/src/tangara/audio/playlist.cpp
@@ -15,7 +15,7 @@
namespace audio {
[[maybe_unused]] static constexpr char kTag[] = "playlist";
-Playlist::Playlist(std::string playlistFilepath)
+Playlist::Playlist(const std::string& playlistFilepath)
: filepath_(playlistFilepath),
mutex_(),
total_size_(0),
@@ -49,7 +49,7 @@ auto Playlist::size() const -> size_t {
return total_size_;
}
-auto Playlist::append(Item i) -> void {
+auto MutablePlaylist::append(Item i) -> void {
std::unique_lock<std::mutex> lock(mutex_);
auto offset = f_tell(&file_);
bool first_entry = current_value_.empty();
@@ -126,7 +126,9 @@ auto Playlist::value() const -> std::string {
return current_value_;
}
-auto Playlist::clear() -> bool {
+MutablePlaylist::MutablePlaylist(const std::string& playlistFilepath) : Playlist(playlistFilepath) {}
+
+auto MutablePlaylist::clear() -> bool {
std::unique_lock<std::mutex> lock(mutex_);
auto res = f_close(&file_);
if (res != FR_OK) {