PlaylistPlugin: add interface SongEnumerator
Replaces struct playlist_provider.
This commit is contained in:
@@ -19,7 +19,8 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "AsxPlaylistPlugin.hxx"
|
||||
#include "MemoryPlaylistProvider.hxx"
|
||||
#include "PlaylistPlugin.hxx"
|
||||
#include "MemorySongEnumerator.hxx"
|
||||
#include "InputStream.hxx"
|
||||
#include "Song.hxx"
|
||||
#include "Tag.hxx"
|
||||
@@ -201,7 +202,7 @@ asx_parser_destroy(gpointer data)
|
||||
*
|
||||
*/
|
||||
|
||||
static struct playlist_provider *
|
||||
static SongEnumerator *
|
||||
asx_open_stream(struct input_stream *is)
|
||||
{
|
||||
AsxParser parser;
|
||||
@@ -249,8 +250,8 @@ asx_open_stream(struct input_stream *is)
|
||||
}
|
||||
|
||||
parser.songs.reverse();
|
||||
MemoryPlaylistProvider *playlist =
|
||||
new MemoryPlaylistProvider(std::move(parser.songs));
|
||||
MemorySongEnumerator *playlist =
|
||||
new MemorySongEnumerator(std::move(parser.songs));
|
||||
|
||||
g_markup_parse_context_free(context);
|
||||
|
||||
@@ -274,8 +275,6 @@ const struct playlist_plugin asx_playlist_plugin = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
asx_open_stream,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
nullptr,
|
||||
asx_suffixes,
|
||||
|
@@ -20,67 +20,54 @@
|
||||
#include "config.h"
|
||||
#include "CuePlaylistPlugin.hxx"
|
||||
#include "PlaylistPlugin.hxx"
|
||||
#include "SongEnumerator.hxx"
|
||||
#include "Tag.hxx"
|
||||
#include "Song.hxx"
|
||||
#include "cue/CueParser.hxx"
|
||||
#include "TextInputStream.hxx"
|
||||
|
||||
#include <glib.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#undef G_LOG_DOMAIN
|
||||
#define G_LOG_DOMAIN "cue"
|
||||
|
||||
struct CuePlaylist {
|
||||
struct playlist_provider base;
|
||||
|
||||
class CuePlaylist final : public SongEnumerator {
|
||||
struct input_stream *is;
|
||||
TextInputStream tis;
|
||||
CueParser parser;
|
||||
|
||||
public:
|
||||
CuePlaylist(struct input_stream *_is)
|
||||
:is(_is), tis(is) {
|
||||
playlist_provider_init(&base, &cue_playlist_plugin);
|
||||
}
|
||||
|
||||
~CuePlaylist() {
|
||||
}
|
||||
virtual Song *NextSong() override;
|
||||
};
|
||||
|
||||
static struct playlist_provider *
|
||||
static SongEnumerator *
|
||||
cue_playlist_open_stream(struct input_stream *is)
|
||||
{
|
||||
CuePlaylist *playlist = new CuePlaylist(is);
|
||||
return &playlist->base;
|
||||
return new CuePlaylist(is);
|
||||
}
|
||||
|
||||
static void
|
||||
cue_playlist_close(struct playlist_provider *_playlist)
|
||||
Song *
|
||||
CuePlaylist::NextSong()
|
||||
{
|
||||
CuePlaylist *playlist = (CuePlaylist *)_playlist;
|
||||
delete playlist;
|
||||
}
|
||||
|
||||
static Song *
|
||||
cue_playlist_read(struct playlist_provider *_playlist)
|
||||
{
|
||||
CuePlaylist *playlist = (CuePlaylist *)_playlist;
|
||||
|
||||
Song *song = playlist->parser.Get();
|
||||
Song *song = parser.Get();
|
||||
if (song != NULL)
|
||||
return song;
|
||||
|
||||
std::string line;
|
||||
while (playlist->tis.ReadLine(line)) {
|
||||
playlist->parser.Feed(line.c_str());
|
||||
song = playlist->parser.Get();
|
||||
while (tis.ReadLine(line)) {
|
||||
parser.Feed(line.c_str());
|
||||
song = parser.Get();
|
||||
if (song != NULL)
|
||||
return song;
|
||||
}
|
||||
|
||||
playlist->parser.Finish();
|
||||
return playlist->parser.Get();
|
||||
parser.Finish();
|
||||
return parser.Get();
|
||||
}
|
||||
|
||||
static const char *const cue_playlist_suffixes[] = {
|
||||
@@ -100,8 +87,6 @@ const struct playlist_plugin cue_playlist_plugin = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
cue_playlist_open_stream,
|
||||
cue_playlist_close,
|
||||
cue_playlist_read,
|
||||
|
||||
nullptr,
|
||||
cue_playlist_suffixes,
|
||||
|
@@ -20,7 +20,8 @@
|
||||
#include "config.h"
|
||||
#include "DespotifyPlaylistPlugin.hxx"
|
||||
#include "DespotifyUtils.hxx"
|
||||
#include "MemoryPlaylistProvider.hxx"
|
||||
#include "PlaylistPlugin.hxx"
|
||||
#include "MemorySongEnumerator.hxx"
|
||||
#include "Tag.hxx"
|
||||
#include "Song.hxx"
|
||||
|
||||
@@ -86,7 +87,7 @@ parse_playlist(struct despotify_session *session,
|
||||
return true;
|
||||
}
|
||||
|
||||
static struct playlist_provider *
|
||||
static SongEnumerator *
|
||||
despotify_playlist_open_uri(const char *url,
|
||||
gcc_unused Mutex &mutex, gcc_unused Cond &cond)
|
||||
{
|
||||
@@ -122,7 +123,7 @@ despotify_playlist_open_uri(const char *url,
|
||||
return nullptr;
|
||||
|
||||
songs.reverse();
|
||||
return new MemoryPlaylistProvider(std::move(songs));
|
||||
return new MemorySongEnumerator(std::move(songs));
|
||||
}
|
||||
|
||||
static const char *const despotify_schemes[] = {
|
||||
@@ -137,8 +138,6 @@ const struct playlist_plugin despotify_playlist_plugin = {
|
||||
nullptr,
|
||||
despotify_playlist_open_uri,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
despotify_schemes,
|
||||
nullptr,
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include "config.h"
|
||||
#include "EmbeddedCuePlaylistPlugin.hxx"
|
||||
#include "PlaylistPlugin.hxx"
|
||||
#include "SongEnumerator.hxx"
|
||||
#include "Tag.hxx"
|
||||
#include "TagHandler.hxx"
|
||||
#include "tag/TagId3.hxx"
|
||||
@@ -41,9 +42,8 @@
|
||||
#undef G_LOG_DOMAIN
|
||||
#define G_LOG_DOMAIN "cue"
|
||||
|
||||
struct EmbeddedCuePlaylist {
|
||||
struct playlist_provider base;
|
||||
|
||||
class EmbeddedCuePlaylist final : public SongEnumerator {
|
||||
public:
|
||||
/**
|
||||
* This is an override for the CUE's "FILE". An embedded CUE
|
||||
* sheet must always point to the song file it is contained
|
||||
@@ -63,18 +63,18 @@ struct EmbeddedCuePlaylist {
|
||||
|
||||
CueParser *parser;
|
||||
|
||||
public:
|
||||
EmbeddedCuePlaylist()
|
||||
:filename(nullptr), cuesheet(nullptr), parser(nullptr) {
|
||||
playlist_provider_init(&base, &embcue_playlist_plugin);
|
||||
}
|
||||
|
||||
~EmbeddedCuePlaylist() {
|
||||
virtual ~EmbeddedCuePlaylist() {
|
||||
delete parser;
|
||||
g_free(cuesheet);
|
||||
g_free(filename);
|
||||
}
|
||||
|
||||
Song *Read();
|
||||
virtual Song *NextSong() override;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -93,7 +93,7 @@ static const struct tag_handler embcue_tag_handler = {
|
||||
embcue_tag_pair,
|
||||
};
|
||||
|
||||
static struct playlist_provider *
|
||||
static SongEnumerator *
|
||||
embcue_playlist_open_uri(const char *uri,
|
||||
gcc_unused Mutex &mutex,
|
||||
gcc_unused Cond &cond)
|
||||
@@ -122,19 +122,11 @@ embcue_playlist_open_uri(const char *uri,
|
||||
playlist->next = playlist->cuesheet;
|
||||
playlist->parser = new CueParser();
|
||||
|
||||
return &playlist->base;
|
||||
return playlist;
|
||||
}
|
||||
|
||||
static void
|
||||
embcue_playlist_close(struct playlist_provider *_playlist)
|
||||
{
|
||||
EmbeddedCuePlaylist *playlist = (EmbeddedCuePlaylist *)_playlist;
|
||||
|
||||
delete playlist;
|
||||
}
|
||||
|
||||
inline Song *
|
||||
EmbeddedCuePlaylist::Read()
|
||||
Song *
|
||||
EmbeddedCuePlaylist::NextSong()
|
||||
{
|
||||
Song *song = parser->Get();
|
||||
if (song != NULL)
|
||||
@@ -165,14 +157,6 @@ EmbeddedCuePlaylist::Read()
|
||||
return song;
|
||||
}
|
||||
|
||||
static Song *
|
||||
embcue_playlist_read(struct playlist_provider *_playlist)
|
||||
{
|
||||
EmbeddedCuePlaylist *playlist = (EmbeddedCuePlaylist *)_playlist;
|
||||
|
||||
return playlist->Read();
|
||||
}
|
||||
|
||||
static const char *const embcue_playlist_suffixes[] = {
|
||||
/* a few codecs that are known to be supported; there are
|
||||
probably many more */
|
||||
@@ -192,8 +176,6 @@ const struct playlist_plugin embcue_playlist_plugin = {
|
||||
nullptr,
|
||||
embcue_playlist_open_uri,
|
||||
nullptr,
|
||||
embcue_playlist_close,
|
||||
embcue_playlist_read,
|
||||
|
||||
embcue_playlist_suffixes,
|
||||
nullptr,
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include "config.h"
|
||||
#include "ExtM3uPlaylistPlugin.hxx"
|
||||
#include "PlaylistPlugin.hxx"
|
||||
#include "SongEnumerator.hxx"
|
||||
#include "Song.hxx"
|
||||
#include "Tag.hxx"
|
||||
#include "util/StringUtil.hxx"
|
||||
@@ -30,40 +31,36 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
struct ExtM3uPlaylist {
|
||||
struct playlist_provider base;
|
||||
|
||||
class ExtM3uPlaylist final : public SongEnumerator {
|
||||
TextInputStream tis;
|
||||
|
||||
public:
|
||||
ExtM3uPlaylist(input_stream *is)
|
||||
:tis(is) {
|
||||
playlist_provider_init(&base, &extm3u_playlist_plugin);
|
||||
}
|
||||
|
||||
bool CheckFirstLine() {
|
||||
std::string line;
|
||||
return tis.ReadLine(line) &&
|
||||
strcmp(line.c_str(), "#EXTM3U") == 0;
|
||||
}
|
||||
|
||||
virtual Song *NextSong() override;
|
||||
};
|
||||
|
||||
static struct playlist_provider *
|
||||
static SongEnumerator *
|
||||
extm3u_open_stream(struct input_stream *is)
|
||||
{
|
||||
ExtM3uPlaylist *playlist = new ExtM3uPlaylist(is);
|
||||
|
||||
std::string line;
|
||||
if (!playlist->tis.ReadLine(line)
|
||||
|| strcmp(line.c_str(), "#EXTM3U") != 0) {
|
||||
if (!playlist->CheckFirstLine()) {
|
||||
/* no EXTM3U header: fall back to the plain m3u
|
||||
plugin */
|
||||
delete playlist;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &playlist->base;
|
||||
}
|
||||
|
||||
static void
|
||||
extm3u_close(struct playlist_provider *_playlist)
|
||||
{
|
||||
ExtM3uPlaylist *playlist = (ExtM3uPlaylist *)_playlist;
|
||||
|
||||
delete playlist;
|
||||
return playlist;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,17 +103,16 @@ extm3u_parse_tag(const char *line)
|
||||
return tag;
|
||||
}
|
||||
|
||||
static Song *
|
||||
extm3u_read(struct playlist_provider *_playlist)
|
||||
Song *
|
||||
ExtM3uPlaylist::NextSong()
|
||||
{
|
||||
ExtM3uPlaylist *playlist = (ExtM3uPlaylist *)_playlist;
|
||||
Tag *tag = NULL;
|
||||
std::string line;
|
||||
const char *line_s;
|
||||
Song *song;
|
||||
|
||||
do {
|
||||
if (!playlist->tis.ReadLine(line)) {
|
||||
if (!tis.ReadLine(line)) {
|
||||
delete tag;
|
||||
return NULL;
|
||||
}
|
||||
@@ -155,8 +151,6 @@ const struct playlist_plugin extm3u_playlist_plugin = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
extm3u_open_stream,
|
||||
extm3u_close,
|
||||
extm3u_read,
|
||||
|
||||
nullptr,
|
||||
extm3u_suffixes,
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include "LastFMPlaylistPlugin.hxx"
|
||||
#include "PlaylistPlugin.hxx"
|
||||
#include "PlaylistRegistry.hxx"
|
||||
#include "SongEnumerator.hxx"
|
||||
#include "ConfigData.hxx"
|
||||
#include "Song.hxx"
|
||||
#include "InputStream.hxx"
|
||||
@@ -31,22 +32,24 @@
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
struct LastfmPlaylist {
|
||||
struct playlist_provider base;
|
||||
|
||||
class LastfmPlaylist final : public SongEnumerator {
|
||||
struct input_stream *is;
|
||||
|
||||
struct playlist_provider *xspf;
|
||||
SongEnumerator *const xspf;
|
||||
|
||||
LastfmPlaylist(input_stream *_is, playlist_provider *_xspf)
|
||||
public:
|
||||
LastfmPlaylist(input_stream *_is, SongEnumerator *_xspf)
|
||||
:is(_is), xspf(_xspf) {
|
||||
playlist_provider_init(&base, &lastfm_playlist_plugin);
|
||||
}
|
||||
|
||||
~LastfmPlaylist() {
|
||||
playlist_plugin_close(xspf);
|
||||
virtual ~LastfmPlaylist() {
|
||||
delete xspf;
|
||||
is->Close();
|
||||
}
|
||||
|
||||
virtual Song *NextSong() override {
|
||||
return xspf->NextSong();
|
||||
}
|
||||
};
|
||||
|
||||
static struct {
|
||||
@@ -161,7 +164,7 @@ lastfm_find(const char *response, const char *name)
|
||||
}
|
||||
}
|
||||
|
||||
static struct playlist_provider *
|
||||
static SongEnumerator *
|
||||
lastfm_open_uri(const char *uri, Mutex &mutex, Cond &cond)
|
||||
{
|
||||
char *p, *q, *response, *session;
|
||||
@@ -256,24 +259,7 @@ lastfm_open_uri(const char *uri, Mutex &mutex, Cond &cond)
|
||||
|
||||
/* create the playlist object */
|
||||
|
||||
const auto playlist = new LastfmPlaylist(is, xspf);
|
||||
return &playlist->base;
|
||||
}
|
||||
|
||||
static void
|
||||
lastfm_close(struct playlist_provider *_playlist)
|
||||
{
|
||||
LastfmPlaylist *playlist = (LastfmPlaylist *)_playlist;
|
||||
|
||||
delete playlist;
|
||||
}
|
||||
|
||||
static Song *
|
||||
lastfm_read(struct playlist_provider *_playlist)
|
||||
{
|
||||
LastfmPlaylist *playlist = (LastfmPlaylist *)_playlist;
|
||||
|
||||
return playlist_plugin_read(playlist->xspf);
|
||||
return new LastfmPlaylist(is, xspf);
|
||||
}
|
||||
|
||||
static const char *const lastfm_schemes[] = {
|
||||
@@ -288,8 +274,6 @@ const struct playlist_plugin lastfm_playlist_plugin = {
|
||||
lastfm_finish,
|
||||
lastfm_open_uri,
|
||||
nullptr,
|
||||
lastfm_close,
|
||||
lastfm_read,
|
||||
|
||||
lastfm_schemes,
|
||||
nullptr,
|
||||
|
@@ -20,47 +20,37 @@
|
||||
#include "config.h"
|
||||
#include "M3uPlaylistPlugin.hxx"
|
||||
#include "PlaylistPlugin.hxx"
|
||||
#include "SongEnumerator.hxx"
|
||||
#include "Song.hxx"
|
||||
#include "TextInputStream.hxx"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
struct M3uPlaylist {
|
||||
struct playlist_provider base;
|
||||
|
||||
class M3uPlaylist final : public SongEnumerator {
|
||||
TextInputStream tis;
|
||||
|
||||
public:
|
||||
M3uPlaylist(input_stream *is)
|
||||
:tis(is) {
|
||||
playlist_provider_init(&base, &m3u_playlist_plugin);
|
||||
}
|
||||
|
||||
virtual Song *NextSong() override;
|
||||
};
|
||||
|
||||
static struct playlist_provider *
|
||||
static SongEnumerator *
|
||||
m3u_open_stream(struct input_stream *is)
|
||||
{
|
||||
M3uPlaylist *playlist = new M3uPlaylist(is);
|
||||
|
||||
return &playlist->base;
|
||||
return new M3uPlaylist(is);
|
||||
}
|
||||
|
||||
static void
|
||||
m3u_close(struct playlist_provider *_playlist)
|
||||
Song *
|
||||
M3uPlaylist::NextSong()
|
||||
{
|
||||
M3uPlaylist *playlist = (M3uPlaylist *)_playlist;
|
||||
|
||||
delete playlist;
|
||||
}
|
||||
|
||||
static Song *
|
||||
m3u_read(struct playlist_provider *_playlist)
|
||||
{
|
||||
M3uPlaylist *playlist = (M3uPlaylist *)_playlist;
|
||||
std::string line;
|
||||
const char *line_s;
|
||||
|
||||
do {
|
||||
if (!playlist->tis.ReadLine(line))
|
||||
if (!tis.ReadLine(line))
|
||||
return NULL;
|
||||
|
||||
line_s = line.c_str();
|
||||
@@ -89,8 +79,6 @@ const struct playlist_plugin m3u_playlist_plugin = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
m3u_open_stream,
|
||||
m3u_close,
|
||||
m3u_read,
|
||||
|
||||
nullptr,
|
||||
m3u_suffixes,
|
||||
|
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* 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 "MemoryPlaylistProvider.hxx"
|
||||
#include "Song.hxx"
|
||||
|
||||
static void
|
||||
memory_playlist_close(struct playlist_provider *_playlist)
|
||||
{
|
||||
MemoryPlaylistProvider *playlist = (MemoryPlaylistProvider *)_playlist;
|
||||
|
||||
delete playlist;
|
||||
}
|
||||
|
||||
static Song *
|
||||
memory_playlist_read(struct playlist_provider *_playlist)
|
||||
{
|
||||
MemoryPlaylistProvider *playlist = (MemoryPlaylistProvider *)_playlist;
|
||||
|
||||
return playlist->Read();
|
||||
}
|
||||
|
||||
static constexpr struct playlist_plugin memory_playlist_plugin = {
|
||||
nullptr,
|
||||
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
memory_playlist_close,
|
||||
memory_playlist_read,
|
||||
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
};
|
||||
|
||||
MemoryPlaylistProvider::MemoryPlaylistProvider(std::forward_list<SongPointer> &&_songs)
|
||||
:songs(std::move(_songs)) {
|
||||
playlist_provider_init(this, &memory_playlist_plugin);
|
||||
}
|
||||
|
||||
inline Song *
|
||||
MemoryPlaylistProvider::Read()
|
||||
{
|
||||
if (songs.empty())
|
||||
return NULL;
|
||||
|
||||
auto result = songs.front().Steal();
|
||||
songs.pop_front();
|
||||
return result;
|
||||
}
|
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* 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_MEMORY_PLAYLIST_PROVIDER_HXX
|
||||
#define MPD_MEMORY_PLAYLIST_PROVIDER_HXX
|
||||
|
||||
#include "PlaylistPlugin.hxx"
|
||||
#include "SongPointer.hxx"
|
||||
|
||||
#include <forward_list>
|
||||
|
||||
struct Song;
|
||||
|
||||
class MemoryPlaylistProvider : public playlist_provider {
|
||||
std::forward_list<SongPointer> songs;
|
||||
|
||||
public:
|
||||
MemoryPlaylistProvider(std::forward_list<SongPointer> &&_songs);
|
||||
|
||||
Song *Read();
|
||||
};
|
||||
|
||||
#endif
|
@@ -19,7 +19,8 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "PlsPlaylistPlugin.hxx"
|
||||
#include "MemoryPlaylistProvider.hxx"
|
||||
#include "PlaylistPlugin.hxx"
|
||||
#include "MemorySongEnumerator.hxx"
|
||||
#include "InputStream.hxx"
|
||||
#include "Song.hxx"
|
||||
#include "Tag.hxx"
|
||||
@@ -101,7 +102,7 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs)
|
||||
|
||||
}
|
||||
|
||||
static struct playlist_provider *
|
||||
static SongEnumerator *
|
||||
pls_open_stream(struct input_stream *is)
|
||||
{
|
||||
GError *error = NULL;
|
||||
@@ -150,7 +151,7 @@ pls_open_stream(struct input_stream *is)
|
||||
g_key_file_free(keyfile);
|
||||
|
||||
songs.reverse();
|
||||
return new MemoryPlaylistProvider(std::move(songs));
|
||||
return new MemorySongEnumerator(std::move(songs));
|
||||
}
|
||||
|
||||
static const char *const pls_suffixes[] = {
|
||||
@@ -170,8 +171,6 @@ const struct playlist_plugin pls_playlist_plugin = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
pls_open_stream,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
nullptr,
|
||||
pls_suffixes,
|
||||
|
@@ -19,7 +19,8 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "RssPlaylistPlugin.hxx"
|
||||
#include "MemoryPlaylistProvider.hxx"
|
||||
#include "PlaylistPlugin.hxx"
|
||||
#include "MemorySongEnumerator.hxx"
|
||||
#include "InputStream.hxx"
|
||||
#include "Song.hxx"
|
||||
#include "Tag.hxx"
|
||||
@@ -198,7 +199,7 @@ rss_parser_destroy(gpointer data)
|
||||
*
|
||||
*/
|
||||
|
||||
static struct playlist_provider *
|
||||
static SongEnumerator *
|
||||
rss_open_stream(struct input_stream *is)
|
||||
{
|
||||
RssParser parser;
|
||||
@@ -246,8 +247,8 @@ rss_open_stream(struct input_stream *is)
|
||||
}
|
||||
|
||||
parser.songs.reverse();
|
||||
MemoryPlaylistProvider *playlist =
|
||||
new MemoryPlaylistProvider(std::move(parser.songs));
|
||||
MemorySongEnumerator *playlist =
|
||||
new MemorySongEnumerator(std::move(parser.songs));
|
||||
|
||||
g_markup_parse_context_free(context);
|
||||
|
||||
@@ -272,8 +273,6 @@ const struct playlist_plugin rss_playlist_plugin = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
rss_open_stream,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
nullptr,
|
||||
rss_suffixes,
|
||||
|
@@ -19,7 +19,8 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "SoundCloudPlaylistPlugin.hxx"
|
||||
#include "MemoryPlaylistProvider.hxx"
|
||||
#include "PlaylistPlugin.hxx"
|
||||
#include "MemorySongEnumerator.hxx"
|
||||
#include "ConfigData.hxx"
|
||||
#include "InputStream.hxx"
|
||||
#include "Song.hxx"
|
||||
@@ -315,7 +316,7 @@ soundcloud_parse_json(const char *url, yajl_handle hand,
|
||||
* soundcloud://url/<url or path of soundcloud page>
|
||||
*/
|
||||
|
||||
static struct playlist_provider *
|
||||
static SongEnumerator *
|
||||
soundcloud_open_uri(const char *uri, Mutex &mutex, Cond &cond)
|
||||
{
|
||||
char *s, *p;
|
||||
@@ -389,7 +390,7 @@ soundcloud_open_uri(const char *uri, Mutex &mutex, Cond &cond)
|
||||
return NULL;
|
||||
|
||||
data.songs.reverse();
|
||||
return new MemoryPlaylistProvider(std::move(data.songs));
|
||||
return new MemorySongEnumerator(std::move(data.songs));
|
||||
}
|
||||
|
||||
static const char *const soundcloud_schemes[] = {
|
||||
@@ -404,8 +405,6 @@ const struct playlist_plugin soundcloud_playlist_plugin = {
|
||||
soundcloud_finish,
|
||||
soundcloud_open_uri,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
soundcloud_schemes,
|
||||
nullptr,
|
||||
|
@@ -19,7 +19,8 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "XspfPlaylistPlugin.hxx"
|
||||
#include "MemoryPlaylistProvider.hxx"
|
||||
#include "PlaylistPlugin.hxx"
|
||||
#include "MemorySongEnumerator.hxx"
|
||||
#include "InputStream.hxx"
|
||||
#include "Tag.hxx"
|
||||
#include "util/Error.hxx"
|
||||
@@ -217,7 +218,7 @@ xspf_parser_destroy(gpointer data)
|
||||
*
|
||||
*/
|
||||
|
||||
static struct playlist_provider *
|
||||
static SongEnumerator *
|
||||
xspf_open_stream(struct input_stream *is)
|
||||
{
|
||||
XspfParser parser;
|
||||
@@ -265,8 +266,8 @@ xspf_open_stream(struct input_stream *is)
|
||||
}
|
||||
|
||||
parser.songs.reverse();
|
||||
MemoryPlaylistProvider *playlist =
|
||||
new MemoryPlaylistProvider(std::move(parser.songs));
|
||||
MemorySongEnumerator *playlist =
|
||||
new MemorySongEnumerator(std::move(parser.songs));
|
||||
|
||||
g_markup_parse_context_free(context);
|
||||
|
||||
@@ -290,8 +291,6 @@ const struct playlist_plugin xspf_playlist_plugin = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
xspf_open_stream,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
nullptr,
|
||||
xspf_suffixes,
|
||||
|
Reference in New Issue
Block a user