aboutsummaryrefslogtreecommitdiffstats
path: root/src/DatabasePrint.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/DatabasePrint.cxx')
-rw-r--r--src/DatabasePrint.cxx46
1 files changed, 26 insertions, 20 deletions
diff --git a/src/DatabasePrint.cxx b/src/DatabasePrint.cxx
index 3732e98f3..7b5975275 100644
--- a/src/DatabasePrint.cxx
+++ b/src/DatabasePrint.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2013 The Music Player Daemon Project
+ * Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -21,13 +21,12 @@
#include "DatabasePrint.hxx"
#include "DatabaseSelection.hxx"
#include "SongFilter.hxx"
-#include "PlaylistVector.hxx"
#include "SongPrint.hxx"
#include "TimePrint.hxx"
#include "Directory.hxx"
#include "Client.hxx"
#include "tag/Tag.hxx"
-#include "Song.hxx"
+#include "LightSong.hxx"
#include "DatabaseGlue.hxx"
#include "DatabasePlugin.hxx"
@@ -53,43 +52,50 @@ PrintDirectoryFull(Client &client, const Directory &directory)
return true;
}
+static void
+print_playlist_in_directory(Client &client,
+ const char *directory,
+ const char *name_utf8)
+{
+ if (directory == nullptr)
+ client_printf(client, "playlist: %s\n", name_utf8);
+ else
+ client_printf(client, "playlist: %s/%s\n",
+ directory, name_utf8);
+}
static void
print_playlist_in_directory(Client &client,
- const Directory &directory,
+ const Directory *directory,
const char *name_utf8)
{
- if (directory.IsRoot())
+ if (directory == nullptr || directory->IsRoot())
client_printf(client, "playlist: %s\n", name_utf8);
else
client_printf(client, "playlist: %s/%s\n",
- directory.GetPath(), name_utf8);
+ directory->GetPath(), name_utf8);
}
static bool
-PrintSongBrief(Client &client, const Song &song)
+PrintSongBrief(Client &client, const LightSong &song)
{
- assert(song.parent != nullptr);
-
song_print_uri(client, song);
- if (song.tag != nullptr && song.tag->has_playlist)
+ if (song.tag->has_playlist)
/* this song file has an embedded CUE sheet */
- print_playlist_in_directory(client, *song.parent, song.uri);
+ print_playlist_in_directory(client, song.directory, song.uri);
return true;
}
static bool
-PrintSongFull(Client &client, const Song &song)
+PrintSongFull(Client &client, const LightSong &song)
{
- assert(song.parent != nullptr);
-
song_print_info(client, song);
- if (song.tag != nullptr && song.tag->has_playlist)
+ if (song.tag->has_playlist)
/* this song file has an embedded CUE sheet */
- print_playlist_in_directory(client, *song.parent, song.uri);
+ print_playlist_in_directory(client, song.directory, song.uri);
return true;
}
@@ -99,7 +105,7 @@ PrintPlaylistBrief(Client &client,
const PlaylistInfo &playlist,
const Directory &directory)
{
- print_playlist_in_directory(client, directory, playlist.name.c_str());
+ print_playlist_in_directory(client, &directory, playlist.name.c_str());
return true;
}
@@ -108,7 +114,7 @@ PrintPlaylistFull(Client &client,
const PlaylistInfo &playlist,
const Directory &directory)
{
- print_playlist_in_directory(client, directory, playlist.name.c_str());
+ print_playlist_in_directory(client, &directory, playlist.name.c_str());
if (playlist.mtime > 0)
time_print(client, "Last-Modified", playlist.mtime);
@@ -151,7 +157,7 @@ static void printSearchStats(Client &client, SearchStats *stats)
}
static bool
-stats_visitor_song(SearchStats &stats, Song &song)
+stats_visitor_song(SearchStats &stats, const LightSong &song)
{
stats.numberOfSongs++;
stats.playTime += song.GetDuration();
@@ -200,7 +206,7 @@ printInfoForAllIn(Client &client, const char *uri_utf8,
}
static bool
-PrintSongURIVisitor(Client &client, Song &song)
+PrintSongURIVisitor(Client &client, const LightSong &song)
{
song_print_uri(client, song);