diff options
Diffstat (limited to 'src/PlaylistPrint.cxx')
-rw-r--r-- | src/PlaylistPrint.cxx | 68 |
1 files changed, 11 insertions, 57 deletions
diff --git a/src/PlaylistPrint.cxx b/src/PlaylistPrint.cxx index e3d500be3..faf373be7 100644 --- a/src/PlaylistPrint.cxx +++ b/src/PlaylistPrint.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 @@ -20,23 +20,21 @@ #include "config.h" #include "PlaylistPrint.hxx" #include "PlaylistFile.hxx" -#include "PlaylistAny.hxx" -#include "PlaylistSong.hxx" #include "Playlist.hxx" -#include "PlaylistRegistry.hxx" -#include "PlaylistPlugin.hxx" -#include "QueuePrint.hxx" -#include "SongEnumerator.hxx" +#include "queue/QueuePrint.hxx" #include "SongPrint.hxx" -#include "DatabaseGlue.hxx" -#include "DatabasePlugin.hxx" -#include "Client.hxx" -#include "InputStream.hxx" -#include "Song.hxx" +#include "db/DatabaseGlue.hxx" +#include "db/DatabasePlugin.hxx" +#include "client/Client.hxx" +#include "input/InputStream.hxx" +#include "DetachedSong.hxx" #include "fs/Traits.hxx" #include "util/Error.hxx" #include "thread/Cond.hxx" +#define SONG_FILE "file: " +#define SONG_TIME "Time: " + void playlist_print_uris(Client &client, const playlist &playlist) { @@ -119,7 +117,7 @@ PrintSongDetails(Client &client, const char *uri_utf8) if (db == nullptr) return false; - Song *song = db->GetSong(uri_utf8, IgnoreError()); + auto *song = db->GetSong(uri_utf8, IgnoreError()); if (song == nullptr) return false; @@ -144,47 +142,3 @@ spl_print(Client &client, const char *name_utf8, bool detail, return true; } - -static void -playlist_provider_print(Client &client, const char *uri, - SongEnumerator &e, bool detail) -{ - const std::string base_uri = uri != nullptr - ? PathTraits::GetParentUTF8(uri) - : std::string("."); - - Song *song; - while ((song = e.NextSong()) != nullptr) { - song = playlist_check_translate_song(song, base_uri.c_str(), - false); - if (song == nullptr) - continue; - - if (detail) - song_print_info(client, *song); - else - song_print_uri(client, *song); - - song->Free(); - } -} - -bool -playlist_file_print(Client &client, const char *uri, bool detail) -{ - Mutex mutex; - Cond cond; - - InputStream *is; - SongEnumerator *playlist = playlist_open_any(uri, mutex, cond, &is); - if (playlist == nullptr) - return false; - - playlist_provider_print(client, uri, *playlist, detail); - delete playlist; - - if (is != nullptr) - is->Close(); - - return true; -} |