playlist/*: move to playlist/plugins/

This commit is contained in:
Max Kellermann 2014-01-23 23:30:12 +01:00
parent 655ad34414
commit f1f19841bd
45 changed files with 178 additions and 125 deletions

View File

@ -179,11 +179,12 @@ src_mpd_SOURCES = \
src/PlaylistTag.cxx \
src/PlaylistPrint.cxx src/PlaylistPrint.hxx \
src/PlaylistSave.cxx src/PlaylistSave.hxx \
src/PlaylistMapper.cxx src/PlaylistMapper.hxx \
src/PlaylistAny.cxx src/PlaylistAny.hxx \
src/PlaylistSong.cxx src/PlaylistSong.hxx \
src/playlist/PlaylistMapper.cxx src/playlist/PlaylistMapper.hxx \
src/playlist/PlaylistAny.cxx src/playlist/PlaylistAny.hxx \
src/playlist/PlaylistSong.cxx src/playlist/PlaylistSong.hxx \
src/PlaylistState.cxx src/PlaylistState.hxx \
src/PlaylistQueue.cxx src/PlaylistQueue.hxx \
src/playlist/PlaylistQueue.cxx src/playlist/PlaylistQueue.hxx \
src/playlist/Print.cxx src/playlist/Print.hxx \
src/PlaylistVector.cxx src/PlaylistVector.hxx \
src/PlaylistInfo.hxx \
src/PlaylistDatabase.cxx src/PlaylistDatabase.hxx \
@ -1042,18 +1043,19 @@ endif
#
libplaylist_plugins_a_SOURCES = \
src/PlaylistPlugin.hxx \
src/SongEnumerator.hxx \
src/MemorySongEnumerator.cxx src/MemorySongEnumerator.hxx \
src/playlist/ExtM3uPlaylistPlugin.cxx \
src/playlist/ExtM3uPlaylistPlugin.hxx \
src/playlist/M3uPlaylistPlugin.cxx \
src/playlist/M3uPlaylistPlugin.hxx \
src/playlist/CuePlaylistPlugin.cxx \
src/playlist/CuePlaylistPlugin.hxx \
src/playlist/EmbeddedCuePlaylistPlugin.cxx \
src/playlist/EmbeddedCuePlaylistPlugin.hxx \
src/PlaylistRegistry.cxx src/PlaylistRegistry.hxx
src/playlist/PlaylistPlugin.hxx \
src/playlist/SongEnumerator.hxx \
src/playlist/MemorySongEnumerator.cxx \
src/playlist/MemorySongEnumerator.hxx \
src/playlist/plugins/ExtM3uPlaylistPlugin.cxx \
src/playlist/plugins/ExtM3uPlaylistPlugin.hxx \
src/playlist/plugins/M3uPlaylistPlugin.cxx \
src/playlist/plugins/M3uPlaylistPlugin.hxx \
src/playlist/plugins/CuePlaylistPlugin.cxx \
src/playlist/plugins/CuePlaylistPlugin.hxx \
src/playlist/plugins/EmbeddedCuePlaylistPlugin.cxx \
src/playlist/plugins/EmbeddedCuePlaylistPlugin.hxx \
src/playlist/PlaylistRegistry.cxx src/playlist/PlaylistRegistry.hxx
libplaylist_plugins_a_CPPFLAGS = $(AM_CPPFLAGS) \
$(EXPAT_CFLAGS) \
$(YAJL_CFLAGS) \
@ -1066,32 +1068,32 @@ PLAYLIST_LIBS = \
if ENABLE_DESPOTIFY
libplaylist_plugins_a_SOURCES += \
src/playlist/DespotifyPlaylistPlugin.cxx \
src/playlist/DespotifyPlaylistPlugin.hxx
src/playlist/plugins/DespotifyPlaylistPlugin.cxx \
src/playlist/plugins/DespotifyPlaylistPlugin.hxx
endif
if ENABLE_SOUNDCLOUD
libplaylist_plugins_a_SOURCES += \
src/playlist/SoundCloudPlaylistPlugin.cxx \
src/playlist/SoundCloudPlaylistPlugin.hxx
src/playlist/plugins/SoundCloudPlaylistPlugin.cxx \
src/playlist/plugins/SoundCloudPlaylistPlugin.hxx
PLAYLIST_LIBS += $(YAJL_LIBS)
endif
if HAVE_EXPAT
libplaylist_plugins_a_SOURCES += \
src/Expat.cxx src/Expat.hxx \
src/playlist/XspfPlaylistPlugin.cxx \
src/playlist/XspfPlaylistPlugin.hxx \
src/playlist/AsxPlaylistPlugin.cxx \
src/playlist/AsxPlaylistPlugin.hxx \
src/playlist/RssPlaylistPlugin.cxx \
src/playlist/RssPlaylistPlugin.hxx
src/playlist/plugins/XspfPlaylistPlugin.cxx \
src/playlist/plugins/XspfPlaylistPlugin.hxx \
src/playlist/plugins/AsxPlaylistPlugin.cxx \
src/playlist/plugins/AsxPlaylistPlugin.hxx \
src/playlist/plugins/RssPlaylistPlugin.cxx \
src/playlist/plugins/RssPlaylistPlugin.hxx
endif
if HAVE_GLIB
libplaylist_plugins_a_SOURCES += \
src/playlist/PlsPlaylistPlugin.cxx \
src/playlist/PlsPlaylistPlugin.hxx
src/playlist/plugins/PlsPlaylistPlugin.cxx \
src/playlist/plugins/PlsPlaylistPlugin.hxx
endif
#
@ -1634,7 +1636,7 @@ test_test_archive_LDADD = \
$(CPPUNIT_LIBS)
test_test_translate_song_SOURCES = \
src/PlaylistSong.cxx \
src/playlist/PlaylistSong.cxx \
src/DetachedSong.cxx \
src/Log.cxx \
test/test_translate_song.cxx

View File

@ -31,8 +31,8 @@
#include "OutputPlugin.hxx"
#include "InputRegistry.hxx"
#include "InputPlugin.hxx"
#include "PlaylistRegistry.hxx"
#include "PlaylistPlugin.hxx"
#include "playlist/PlaylistRegistry.hxx"
#include "playlist/PlaylistPlugin.hxx"
#include "fs/AllocatedPath.hxx"
#include "fs/Traits.hxx"
#include "fs/FileSystem.hxx"

View File

@ -51,7 +51,7 @@
#include "fs/AllocatedPath.hxx"
#include "fs/Config.hxx"
#include "fs/StandardDirectory.hxx"
#include "PlaylistRegistry.hxx"
#include "playlist/PlaylistRegistry.hxx"
#include "ZeroconfGlue.hxx"
#include "DecoderList.hxx"
#include "AudioConfig.hxx"

View File

@ -20,11 +20,8 @@
#include "config.h"
#include "PlaylistPrint.hxx"
#include "PlaylistFile.hxx"
#include "PlaylistAny.hxx"
#include "PlaylistSong.hxx"
#include "Playlist.hxx"
#include "QueuePrint.hxx"
#include "SongEnumerator.hxx"
#include "SongPrint.hxx"
#include "DatabaseGlue.hxx"
#include "DatabasePlugin.hxx"
@ -145,45 +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
? PathTraitsUTF8::GetParent(uri)
: std::string(".");
DetachedSong *song;
while ((song = e.NextSong()) != nullptr) {
if (playlist_check_translate_song(*song, base_uri.c_str(),
false)) {
if (detail)
song_print_info(client, *song);
else
song_print_uri(client, *song);
}
delete song;
}
}
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;
}

View File

@ -1,4 +1,3 @@
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
@ -96,15 +95,4 @@ bool
spl_print(Client &client, const char *name_utf8, bool detail,
Error &error);
/**
* Send the playlist file to the client.
*
* @param client the client which requested the playlist
* @param uri the URI of the playlist file in UTF-8 encoding
* @param detail true if all details should be printed
* @return true on success, false if the playlist does not exist
*/
bool
playlist_file_print(Client &client, const char *uri, bool detail);
#endif

View File

@ -29,7 +29,7 @@
#include "Directory.hxx"
#include "Song.hxx"
#include "PlaylistVector.hxx"
#include "PlaylistRegistry.hxx"
#include "playlist/PlaylistRegistry.hxx"
#include "Mapper.hxx"
#include "ExcludeList.hxx"
#include "ConfigGlobal.hxx"

View File

@ -25,7 +25,8 @@
#include "PlaylistSave.hxx"
#include "PlaylistFile.hxx"
#include "PlaylistVector.hxx"
#include "PlaylistQueue.hxx"
#include "playlist/PlaylistQueue.hxx"
#include "playlist/Print.hxx"
#include "TimePrint.hxx"
#include "Client.hxx"
#include "protocol/ArgParser.hxx"

View File

@ -20,16 +20,16 @@
#include "config.h"
#include "PlaylistRegistry.hxx"
#include "PlaylistPlugin.hxx"
#include "playlist/ExtM3uPlaylistPlugin.hxx"
#include "playlist/M3uPlaylistPlugin.hxx"
#include "playlist/XspfPlaylistPlugin.hxx"
#include "playlist/DespotifyPlaylistPlugin.hxx"
#include "playlist/SoundCloudPlaylistPlugin.hxx"
#include "playlist/PlsPlaylistPlugin.hxx"
#include "playlist/AsxPlaylistPlugin.hxx"
#include "playlist/RssPlaylistPlugin.hxx"
#include "playlist/CuePlaylistPlugin.hxx"
#include "playlist/EmbeddedCuePlaylistPlugin.hxx"
#include "plugins/ExtM3uPlaylistPlugin.hxx"
#include "plugins/M3uPlaylistPlugin.hxx"
#include "plugins/XspfPlaylistPlugin.hxx"
#include "plugins/DespotifyPlaylistPlugin.hxx"
#include "plugins/SoundCloudPlaylistPlugin.hxx"
#include "plugins/PlsPlaylistPlugin.hxx"
#include "plugins/AsxPlaylistPlugin.hxx"
#include "plugins/RssPlaylistPlugin.hxx"
#include "plugins/CuePlaylistPlugin.hxx"
#include "plugins/EmbeddedCuePlaylistPlugin.hxx"
#include "InputStream.hxx"
#include "util/UriUtil.hxx"
#include "util/StringUtil.hxx"

71
src/playlist/Print.cxx Normal file
View File

@ -0,0 +1,71 @@
/*
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "Print.hxx"
#include "PlaylistAny.hxx"
#include "PlaylistSong.hxx"
#include "SongEnumerator.hxx"
#include "SongPrint.hxx"
#include "InputStream.hxx"
#include "DetachedSong.hxx"
#include "fs/Traits.hxx"
#include "thread/Cond.hxx"
static void
playlist_provider_print(Client &client, const char *uri,
SongEnumerator &e, bool detail)
{
const std::string base_uri = uri != nullptr
? PathTraitsUTF8::GetParent(uri)
: std::string(".");
DetachedSong *song;
while ((song = e.NextSong()) != nullptr) {
if (playlist_check_translate_song(*song, base_uri.c_str(),
false)) {
if (detail)
song_print_info(client, *song);
else
song_print_uri(client, *song);
}
delete song;
}
}
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;
}

36
src/playlist/Print.hxx Normal file
View File

@ -0,0 +1,36 @@
/*
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_PLAYLIST__PRINT_HXX
#define MPD_PLAYLIST__PRINT_HXX
class Client;
/**
* Send the playlist file to the client.
*
* @param client the client which requested the playlist
* @param uri the URI of the playlist file in UTF-8 encoding
* @param detail true if all details should be printed
* @return true on success, false if the playlist does not exist
*/
bool
playlist_file_print(Client &client, const char *uri, bool detail);
#endif

View File

@ -19,8 +19,8 @@
#include "config.h"
#include "AsxPlaylistPlugin.hxx"
#include "PlaylistPlugin.hxx"
#include "MemorySongEnumerator.hxx"
#include "../PlaylistPlugin.hxx"
#include "../MemorySongEnumerator.hxx"
#include "tag/TagBuilder.hxx"
#include "util/ASCII.hxx"
#include "util/Error.hxx"

View File

@ -19,8 +19,8 @@
#include "config.h"
#include "CuePlaylistPlugin.hxx"
#include "PlaylistPlugin.hxx"
#include "SongEnumerator.hxx"
#include "../PlaylistPlugin.hxx"
#include "../SongEnumerator.hxx"
#include "cue/CueParser.hxx"
#include "TextInputStream.hxx"

View File

@ -20,8 +20,8 @@
#include "config.h"
#include "DespotifyPlaylistPlugin.hxx"
#include "DespotifyUtils.hxx"
#include "PlaylistPlugin.hxx"
#include "MemorySongEnumerator.hxx"
#include "../PlaylistPlugin.hxx"
#include "../MemorySongEnumerator.hxx"
#include "tag/Tag.hxx"
#include "DetachedSong.hxx"
#include "Log.hxx"

View File

@ -25,8 +25,8 @@
#include "config.h"
#include "EmbeddedCuePlaylistPlugin.hxx"
#include "PlaylistPlugin.hxx"
#include "SongEnumerator.hxx"
#include "../PlaylistPlugin.hxx"
#include "../SongEnumerator.hxx"
#include "tag/TagHandler.hxx"
#include "tag/TagId3.hxx"
#include "tag/ApeTag.hxx"

View File

@ -19,8 +19,8 @@
#include "config.h"
#include "ExtM3uPlaylistPlugin.hxx"
#include "PlaylistPlugin.hxx"
#include "SongEnumerator.hxx"
#include "../PlaylistPlugin.hxx"
#include "../SongEnumerator.hxx"
#include "DetachedSong.hxx"
#include "tag/Tag.hxx"
#include "tag/TagBuilder.hxx"

View File

@ -19,8 +19,8 @@
#include "config.h"
#include "M3uPlaylistPlugin.hxx"
#include "PlaylistPlugin.hxx"
#include "SongEnumerator.hxx"
#include "../PlaylistPlugin.hxx"
#include "../SongEnumerator.hxx"
#include "DetachedSong.hxx"
#include "util/StringUtil.hxx"
#include "TextInputStream.hxx"

View File

@ -19,8 +19,8 @@
#include "config.h"
#include "PlsPlaylistPlugin.hxx"
#include "PlaylistPlugin.hxx"
#include "MemorySongEnumerator.hxx"
#include "../PlaylistPlugin.hxx"
#include "../MemorySongEnumerator.hxx"
#include "InputStream.hxx"
#include "DetachedSong.hxx"
#include "tag/TagBuilder.hxx"

View File

@ -19,8 +19,8 @@
#include "config.h"
#include "RssPlaylistPlugin.hxx"
#include "PlaylistPlugin.hxx"
#include "MemorySongEnumerator.hxx"
#include "../PlaylistPlugin.hxx"
#include "../MemorySongEnumerator.hxx"
#include "tag/TagBuilder.hxx"
#include "util/ASCII.hxx"
#include "util/Error.hxx"

View File

@ -19,8 +19,8 @@
#include "config.h"
#include "SoundCloudPlaylistPlugin.hxx"
#include "PlaylistPlugin.hxx"
#include "MemorySongEnumerator.hxx"
#include "../PlaylistPlugin.hxx"
#include "../MemorySongEnumerator.hxx"
#include "ConfigData.hxx"
#include "InputStream.hxx"
#include "tag/TagBuilder.hxx"

View File

@ -19,8 +19,8 @@
#include "config.h"
#include "XspfPlaylistPlugin.hxx"
#include "PlaylistPlugin.hxx"
#include "MemorySongEnumerator.hxx"
#include "../PlaylistPlugin.hxx"
#include "../MemorySongEnumerator.hxx"
#include "DetachedSong.hxx"
#include "InputStream.hxx"
#include "tag/TagBuilder.hxx"

View File

@ -20,14 +20,14 @@
#include "config.h"
#include "TagSave.hxx"
#include "DetachedSong.hxx"
#include "SongEnumerator.hxx"
#include "playlist/SongEnumerator.hxx"
#include "InputStream.hxx"
#include "ConfigGlobal.hxx"
#include "DecoderList.hxx"
#include "InputInit.hxx"
#include "IOThread.hxx"
#include "PlaylistRegistry.hxx"
#include "PlaylistPlugin.hxx"
#include "playlist/PlaylistRegistry.hxx"
#include "playlist/PlaylistPlugin.hxx"
#include "fs/Path.hxx"
#include "util/Error.hxx"
#include "thread/Cond.hxx"

View File

@ -3,7 +3,7 @@
*/
#include "config.h"
#include "PlaylistSong.hxx"
#include "playlist/PlaylistSong.hxx"
#include "DetachedSong.hxx"
#include "tag/TagBuilder.hxx"
#include "tag/Tag.hxx"