diff options
Diffstat (limited to 'src/song_save.c')
-rw-r--r-- | src/song_save.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/song_save.c b/src/song_save.c index a1a573298..4fcb46e22 100644 --- a/src/song_save.c +++ b/src/song_save.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2010 The Music Player Daemon Project + * Copyright (C) 2003-2011 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -24,6 +24,7 @@ #include "directory.h" #include "tag.h" #include "text_file.h" +#include "string_util.h" #include <glib.h> @@ -58,19 +59,6 @@ song_save(FILE *fp, const struct song *song) fprintf(fp, SONG_END "\n"); } -static int -song_save_callback(struct song *song, void *data) -{ - FILE *fp = data; - song_save(fp, song); - return 0; -} - -void songvec_save(FILE *fp, const struct songvec *sv) -{ - songvec_for_each(sv, song_save_callback, fp); -} - struct song * song_load(FILE *fp, struct directory *parent, const char *uri, GString *buffer, GError **error_r) @@ -96,7 +84,7 @@ song_load(FILE *fp, struct directory *parent, const char *uri, } *colon++ = 0; - value = g_strchug(colon); + value = strchug_fast_c(colon); if ((type = tag_name_parse(line)) != TAG_NUM_OF_ITEM_TYPES) { if (!song->tag) { @@ -112,6 +100,13 @@ song_load(FILE *fp, struct directory *parent, const char *uri, } song->tag->time = atoi(value); + } else if (strcmp(line, "Playlist") == 0) { + if (!song->tag) { + song->tag = tag_new(); + tag_begin_add(song->tag); + } + + song->tag->has_playlist = strcmp(value, "yes") == 0; } else if (strcmp(line, SONG_MTIME) == 0) { song->mtime = atoi(value); } else if (strcmp(line, "Range") == 0) { |