Exemple #1
0
int
song_print_info(struct client *client, struct song *song)
{
	song_print_url(client, song);

	if (song->tag)
		tag_print(client, song->tag);

	return 0;
}
void
song_print_info(struct client *client, struct song *song)
{
	song_print_uri(client, song);

	if (song->end_ms > 0)
		client_printf(client, "Range: %u.%03u-%u.%03u\n",
			      song->start_ms / 1000,
			      song->start_ms % 1000,
			      song->end_ms / 1000,
			      song->end_ms % 1000);
	else if (song->start_ms > 0)
		client_printf(client, "Range: %u.%03u-\n",
			      song->start_ms / 1000,
			      song->start_ms % 1000);

	if (song->mtime > 0) {
#ifndef G_OS_WIN32
		struct tm tm;
#endif
		const struct tm *tm2;

#ifdef G_OS_WIN32
		tm2 = gmtime(&song->mtime);
#else
		tm2 = gmtime_r(&song->mtime, &tm);
#endif

		if (tm2 != NULL) {
			char timestamp[32];

			strftime(timestamp, sizeof(timestamp),
#ifdef G_OS_WIN32
				 "%Y-%m-%dT%H:%M:%SZ",
#else
				 "%FT%TZ",
#endif
				 tm2);
			client_printf(client, "Last-Modified: %s\n",
				      timestamp);
		}
	}

	if (song->tag)
		tag_print(client, song->tag);
}