aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-07-05 08:40:29 +0200
committerMax Kellermann <max@duempel.org>2009-07-05 08:40:29 +0200
commit46c19b82494c9954fd6dafb955a1a5851e20d44d (patch)
tree2d13ec99815fb1a6d9ec3c10a175403a36b2fc36
parent077b24d62d03e0dc0b1fcad64b38433c2b76d1ce (diff)
downloadmpd-46c19b82494c9954fd6dafb955a1a5851e20d44d.tar.gz
mpd-46c19b82494c9954fd6dafb955a1a5851e20d44d.tar.xz
mpd-46c19b82494c9954fd6dafb955a1a5851e20d44d.zip
song_print: send song modification time to client
Added the response line "Last-Modified", which sends the modification time in ISO 8601. The same was already implemented for playlists.
Diffstat (limited to '')
-rw-r--r--NEWS2
-rw-r--r--src/song_print.c17
2 files changed, 19 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index fc702032a..a8828d345 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,6 @@
ver 0.16 (20??/??/??)
+* protocol:
+ - send song modification time to client
* decoders:
- ffmpeg: support multiple tags
* mixers:
diff --git a/src/song_print.c b/src/song_print.c
index 64ab9f6b1..2efae9b89 100644
--- a/src/song_print.c
+++ b/src/song_print.c
@@ -50,6 +50,23 @@ song_print_info(struct client *client, struct song *song)
{
song_print_url(client, song);
+ if (song->mtime > 0) {
+ time_t t = song->mtime;
+#ifndef G_OS_WIN32
+ struct tm tm;
+#endif
+ char timestamp[32];
+
+ strftime(timestamp, sizeof(timestamp), "%FT%TZ",
+#ifdef G_OS_WIN32
+ gmtime(&t)
+#else
+ gmtime_r(&t, &tm)
+#endif
+ );
+ client_printf(client, "Last-Modified: %s\n", timestamp);
+ }
+
if (song->tag)
tag_print(client, song->tag);