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.
This commit is contained in:
Max Kellermann 2009-07-05 08:40:29 +02:00
parent 077b24d62d
commit 46c19b8249
2 changed files with 19 additions and 0 deletions

2
NEWS
View File

@ -1,4 +1,6 @@
ver 0.16 (20??/??/??) ver 0.16 (20??/??/??)
* protocol:
- send song modification time to client
* decoders: * decoders:
- ffmpeg: support multiple tags - ffmpeg: support multiple tags
* mixers: * mixers:

View File

@ -50,6 +50,23 @@ song_print_info(struct client *client, struct song *song)
{ {
song_print_url(client, 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) if (song->tag)
tag_print(client, song->tag); tag_print(client, song->tag);