aboutsummaryrefslogtreecommitdiffstats
path: root/src/song_save.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-07-25 12:21:47 +0200
committerMax Kellermann <max@duempel.org>2010-07-25 13:28:54 +0200
commitcbb1ab58cdf18b59488d543427cd4ec238426bf8 (patch)
tree06049f1f6ea443d5aeacfc7cbc84a1836aeca1f9 /src/song_save.c
parentb01235e3307ae9908c3cc08f34a08a13a1b18029 (diff)
downloadmpd-cbb1ab58cdf18b59488d543427cd4ec238426bf8.tar.gz
mpd-cbb1ab58cdf18b59488d543427cd4ec238426bf8.tar.xz
mpd-cbb1ab58cdf18b59488d543427cd4ec238426bf8.zip
queue_save: save tags and range of non-database songs
Use the functions song_save() and song_load() to use the same format as in the database file for those songs which need the tags.
Diffstat (limited to '')
-rw-r--r--src/song_save.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/song_save.c b/src/song_save.c
index d52f7f51c..a1a573298 100644
--- a/src/song_save.c
+++ b/src/song_save.c
@@ -41,11 +41,9 @@ song_save_quark(void)
return g_quark_from_static_string("song_save");
}
-static int
-song_save(struct song *song, void *data)
+void
+song_save(FILE *fp, const struct song *song)
{
- FILE *fp = data;
-
fprintf(fp, SONG_BEGIN "%s\n", song->uri);
if (song->end_ms > 0)
@@ -58,20 +56,28 @@ song_save(struct song *song, void *data)
fprintf(fp, SONG_MTIME ": %li\n", (long)song->mtime);
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, fp);
+ 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)
{
- struct song *song = song_file_new(uri, parent);
+ struct song *song = parent != NULL
+ ? song_file_new(uri, parent)
+ : song_remote_new(uri);
char *line, *colon;
enum tag_type type;
const char *value;