playlist/pls: use class TagBuilder
This commit is contained in:
parent
d91f6dc1b5
commit
85e587a882
@ -23,7 +23,7 @@
|
|||||||
#include "MemorySongEnumerator.hxx"
|
#include "MemorySongEnumerator.hxx"
|
||||||
#include "InputStream.hxx"
|
#include "InputStream.hxx"
|
||||||
#include "Song.hxx"
|
#include "Song.hxx"
|
||||||
#include "tag/Tag.hxx"
|
#include "tag/TagBuilder.hxx"
|
||||||
#include "util/Error.hxx"
|
#include "util/Error.hxx"
|
||||||
#include "util/Domain.hxx"
|
#include "util/Domain.hxx"
|
||||||
#include "Log.hxx"
|
#include "Log.hxx"
|
||||||
@ -32,6 +32,8 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
static constexpr Domain pls_domain("pls");
|
static constexpr Domain pls_domain("pls");
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -75,14 +77,14 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs)
|
|||||||
song = Song::NewRemote(value);
|
song = Song::NewRemote(value);
|
||||||
g_free(value);
|
g_free(value);
|
||||||
|
|
||||||
|
TagBuilder tag;
|
||||||
|
|
||||||
sprintf(key, "Title%u", num_entries);
|
sprintf(key, "Title%u", num_entries);
|
||||||
value = g_key_file_get_string(keyfile, "playlist", key,
|
value = g_key_file_get_string(keyfile, "playlist", key,
|
||||||
&error);
|
&error);
|
||||||
if(error == nullptr && value){
|
if (error == nullptr && value != nullptr)
|
||||||
if (song->tag == nullptr)
|
tag.AddItem(TAG_TITLE, value);
|
||||||
song->tag = new Tag();
|
|
||||||
song->tag->AddItem(TAG_TITLE, value);
|
|
||||||
}
|
|
||||||
/* Ignore errors? Most likely value not present */
|
/* Ignore errors? Most likely value not present */
|
||||||
if(error) g_error_free(error);
|
if(error) g_error_free(error);
|
||||||
error = nullptr;
|
error = nullptr;
|
||||||
@ -91,15 +93,14 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs)
|
|||||||
sprintf(key, "Length%u", num_entries);
|
sprintf(key, "Length%u", num_entries);
|
||||||
length = g_key_file_get_integer(keyfile, "playlist", key,
|
length = g_key_file_get_integer(keyfile, "playlist", key,
|
||||||
&error);
|
&error);
|
||||||
if(error == nullptr && length > 0){
|
if (error == nullptr && length > 0)
|
||||||
if (song->tag == nullptr)
|
tag.SetTime(length);
|
||||||
song->tag = new Tag();
|
|
||||||
song->tag->time = length;
|
|
||||||
}
|
|
||||||
/* Ignore errors? Most likely value not present */
|
/* Ignore errors? Most likely value not present */
|
||||||
if(error) g_error_free(error);
|
if(error) g_error_free(error);
|
||||||
error = nullptr;
|
error = nullptr;
|
||||||
|
|
||||||
|
song->tag = tag.Commit();
|
||||||
songs.emplace_front(song);
|
songs.emplace_front(song);
|
||||||
num_entries--;
|
num_entries--;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user