aboutsummaryrefslogtreecommitdiffstats
path: root/src/SongPrint.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/SongPrint.cxx (renamed from src/song_print.c)52
1 files changed, 16 insertions, 36 deletions
diff --git a/src/song_print.c b/src/SongPrint.cxx
index fb608a8b2..c56e54d8b 100644
--- a/src/song_print.c
+++ b/src/SongPrint.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -18,20 +18,24 @@
*/
#include "config.h"
-#include "song_print.h"
+#include "SongPrint.hxx"
#include "song.h"
-#include "directory.h"
-#include "tag_print.h"
-#include "client.h"
+#include "Directory.hxx"
+#include "TimePrint.hxx"
+#include "TagPrint.hxx"
+#include "Mapper.hxx"
+#include "Client.hxx"
+
+extern "C" {
#include "uri.h"
-#include "mapper.h"
+}
void
-song_print_uri(struct client *client, struct song *song)
+song_print_uri(Client *client, struct song *song)
{
- if (song_in_database(song) && !directory_is_root(song->parent)) {
+ if (song_in_database(song) && !song->parent->IsRoot()) {
client_printf(client, "%s%s/%s\n", SONG_FILE,
- directory_get_path(song->parent), song->uri);
+ song->parent->GetPath(), song->uri);
} else {
char *allocated;
const char *uri;
@@ -48,7 +52,7 @@ song_print_uri(struct client *client, struct song *song)
}
void
-song_print_info(struct client *client, struct song *song)
+song_print_info(Client *client, struct song *song)
{
song_print_uri(client, song);
@@ -63,32 +67,8 @@ song_print_info(struct client *client, struct song *song)
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->mtime > 0)
+ time_print(client, "Last-Modified", song->mtime);
if (song->tag)
tag_print(client, song->tag);