stored_playlist: send timestamps
Send last modification timestamps to the client. This allows the client to see when another client modifies a stored playlist.
This commit is contained in:
parent
9c983c442c
commit
7aca4cd194
@ -191,6 +191,12 @@ repeat <int state>
|
|||||||
listplaylists
|
listplaylists
|
||||||
prints a list of the playlist directory
|
prints a list of the playlist directory
|
||||||
|
|
||||||
|
After each playlist name, the server sends its last
|
||||||
|
modification time as attribute "Last-Modified" in ISO 8601
|
||||||
|
format. To avoid problems due to clock differences between
|
||||||
|
clients and the server, clients should not compare this value
|
||||||
|
with their local clock.
|
||||||
|
|
||||||
rm <string name>
|
rm <string name>
|
||||||
removes the playlist <name>.m3u from the playlist directory
|
removes the playlist <name>.m3u from the playlist directory
|
||||||
|
|
||||||
|
@ -208,8 +208,16 @@ print_spl_list(struct client *client, GPtrArray *list)
|
|||||||
for (unsigned i = 0; i < list->len; ++i) {
|
for (unsigned i = 0; i < list->len; ++i) {
|
||||||
struct stored_playlist_info *playlist =
|
struct stored_playlist_info *playlist =
|
||||||
g_ptr_array_index(list, i);
|
g_ptr_array_index(list, i);
|
||||||
|
time_t t;
|
||||||
|
struct tm tm;
|
||||||
|
char timestamp[32];
|
||||||
|
|
||||||
client_printf(client, "playlist: %s\n", playlist->name);
|
client_printf(client, "playlist: %s\n", playlist->name);
|
||||||
|
|
||||||
|
t = playlist->mtime;
|
||||||
|
strftime(timestamp, sizeof(timestamp), "%FT%TZ",
|
||||||
|
gmtime_r(&t, &tm));
|
||||||
|
client_printf(client, "Last-Modified: %s\n", timestamp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user