diff options
author | Max Kellermann <max@duempel.org> | 2014-01-07 21:39:47 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-09 09:05:58 +0100 |
commit | 322b0616322760dc162447563d8f4da7e024ca90 (patch) | |
tree | 2f87cb3ce061556161797aba9f57ee08de5b9e21 /src/playlist/PlsPlaylistPlugin.cxx | |
parent | 43847f2244a34064af24704aac4cfad4a3c76f7d (diff) | |
download | mpd-322b0616322760dc162447563d8f4da7e024ca90.tar.gz mpd-322b0616322760dc162447563d8f4da7e024ca90.tar.xz mpd-322b0616322760dc162447563d8f4da7e024ca90.zip |
DetachedSong: fork of struct Song
From now on, struct Song will be used by the database only, and
DetachedSong will be used by everybody else. DetachedSong is easier
to use, but Song has lower overhead.
Diffstat (limited to 'src/playlist/PlsPlaylistPlugin.cxx')
-rw-r--r-- | src/playlist/PlsPlaylistPlugin.cxx | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/playlist/PlsPlaylistPlugin.cxx b/src/playlist/PlsPlaylistPlugin.cxx index 3fd420d89..103451dfe 100644 --- a/src/playlist/PlsPlaylistPlugin.cxx +++ b/src/playlist/PlsPlaylistPlugin.cxx @@ -22,7 +22,7 @@ #include "PlaylistPlugin.hxx" #include "MemorySongEnumerator.hxx" #include "InputStream.hxx" -#include "Song.hxx" +#include "DetachedSong.hxx" #include "tag/TagBuilder.hxx" #include "util/Error.hxx" #include "util/Domain.hxx" @@ -37,7 +37,7 @@ static constexpr Domain pls_domain("pls"); static void -pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs) +pls_parser(GKeyFile *keyfile, std::forward_list<DetachedSong> &songs) { gchar *value; GError *error = nullptr; @@ -61,8 +61,8 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs) for (; num_entries > 0; --num_entries) { char key[64]; sprintf(key, "File%u", num_entries); - value = g_key_file_get_string(keyfile, "playlist", key, - &error); + char *uri = g_key_file_get_string(keyfile, "playlist", key, + &error); if(error) { FormatError(pls_domain, "Invalid PLS entry %s: '%s'", key, error->message); @@ -70,9 +70,6 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs) return; } - Song *song = Song::NewRemote(value); - g_free(value); - TagBuilder tag; sprintf(key, "Title%u", num_entries); @@ -89,8 +86,8 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs) if (length > 0) tag.SetTime(length); - song->tag = tag.CommitNew(); - songs.emplace_front(song); + songs.emplace_front(uri, tag.Commit()); + g_free(uri); } } @@ -135,7 +132,7 @@ pls_open_stream(InputStream &is) return nullptr; } - std::forward_list<SongPointer> songs; + std::forward_list<DetachedSong> songs; pls_parser(keyfile, songs); g_key_file_free(keyfile); |