aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-07-25 12:09:28 +0200
committerMax Kellermann <max@duempel.org>2010-07-25 13:28:52 +0200
commitb01235e3307ae9908c3cc08f34a08a13a1b18029 (patch)
tree86f75112300158bc46ca97bcf51dabdc35db4d4e /src
parent8341a9f7b24bfc10879eb5ec68a6d531738a2cc2 (diff)
downloadmpd-b01235e3307ae9908c3cc08f34a08a13a1b18029.tar.gz
mpd-b01235e3307ae9908c3cc08f34a08a13a1b18029.tar.xz
mpd-b01235e3307ae9908c3cc08f34a08a13a1b18029.zip
song_save: save start_ms and end_ms
While this is not useful for the database, it may become useful for reusing this code for the state file.
Diffstat (limited to 'src')
-rw-r--r--src/song_save.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/song_save.c b/src/song_save.c
index ac01877cf..d52f7f51c 100644
--- a/src/song_save.c
+++ b/src/song_save.c
@@ -48,6 +48,11 @@ song_save(struct song *song, void *data)
fprintf(fp, SONG_BEGIN "%s\n", song->uri);
+ if (song->end_ms > 0)
+ fprintf(fp, "Range: %u-%u\n", song->start_ms, song->end_ms);
+ else if (song->start_ms > 0)
+ fprintf(fp, "Range: %u-\n", song->start_ms);
+
if (song->tag != NULL)
tag_save(fp, song->tag);
@@ -103,6 +108,12 @@ song_load(FILE *fp, struct directory *parent, const char *uri,
song->tag->time = atoi(value);
} else if (strcmp(line, SONG_MTIME) == 0) {
song->mtime = atoi(value);
+ } else if (strcmp(line, "Range") == 0) {
+ char *endptr;
+
+ song->start_ms = strtoul(value, &endptr, 10);
+ if (*endptr == '-')
+ song->end_ms = strtoul(endptr + 1, NULL, 10);
} else {
if (song->tag != NULL)
tag_end_add(song->tag);