aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-01-26 20:47:27 +0100
committerMax Kellermann <max@duempel.org>2015-01-26 20:48:19 +0100
commita289dcb9ee6d7992a21f24b99be667eed6c32321 (patch)
tree647da96585d6021f664c2bcf87c911e18c440c65 /src/playlist
parent023b9c1e7e6792de4da0b867b6bb5d425928bd5b (diff)
parentad1b6ef0ac5e7c869b6adbede153e8b2ac55d708 (diff)
downloadmpd-a289dcb9ee6d7992a21f24b99be667eed6c32321.tar.gz
mpd-a289dcb9ee6d7992a21f24b99be667eed6c32321.tar.xz
mpd-a289dcb9ee6d7992a21f24b99be667eed6c32321.zip
Merge branch 'v0.18.x' into v0.19.x
Diffstat (limited to 'src/playlist')
-rw-r--r--src/playlist/PlaylistRegistry.cxx4
-rw-r--r--src/playlist/plugins/DespotifyPlaylistPlugin.cxx142
-rw-r--r--src/playlist/plugins/DespotifyPlaylistPlugin.hxx25
3 files changed, 0 insertions, 171 deletions
diff --git a/src/playlist/PlaylistRegistry.cxx b/src/playlist/PlaylistRegistry.cxx
index 4e9ef890e..600f32b31 100644
--- a/src/playlist/PlaylistRegistry.cxx
+++ b/src/playlist/PlaylistRegistry.cxx
@@ -23,7 +23,6 @@
#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"
@@ -54,9 +53,6 @@ const struct playlist_plugin *const playlist_plugins[] = {
&asx_playlist_plugin,
&rss_playlist_plugin,
#endif
-#ifdef ENABLE_DESPOTIFY
- &despotify_playlist_plugin,
-#endif
#ifdef ENABLE_SOUNDCLOUD
&soundcloud_playlist_plugin,
#endif
diff --git a/src/playlist/plugins/DespotifyPlaylistPlugin.cxx b/src/playlist/plugins/DespotifyPlaylistPlugin.cxx
deleted file mode 100644
index 636f64bc6..000000000
--- a/src/playlist/plugins/DespotifyPlaylistPlugin.cxx
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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 "DespotifyPlaylistPlugin.hxx"
-#include "lib/despotify/DespotifyUtils.hxx"
-#include "../PlaylistPlugin.hxx"
-#include "../MemorySongEnumerator.hxx"
-#include "tag/Tag.hxx"
-#include "DetachedSong.hxx"
-#include "Log.hxx"
-
-extern "C" {
-#include <despotify.h>
-}
-
-#include <string.h>
-#include <stdlib.h>
-#include <string.h>
-
-static void
-add_song(std::forward_list<DetachedSong> &songs, ds_track &track)
-{
- const char *dsp_scheme = despotify_playlist_plugin.schemes[0];
- char uri[128];
- char *ds_uri;
-
- /* Create a spt://... URI for MPD */
- snprintf(uri, sizeof(uri), "%s://", dsp_scheme);
- ds_uri = uri + strlen(dsp_scheme) + 3;
-
- if (despotify_track_to_uri(&track, ds_uri) != ds_uri) {
- /* Should never really fail, but let's be sure */
- FormatDebug(despotify_domain,
- "Can't add track %s", track.title);
- return;
- }
-
- songs.emplace_front(uri, mpd_despotify_tag_from_track(track));
-}
-
-static bool
-parse_track(struct despotify_session *session,
- std::forward_list<DetachedSong> &songs,
- struct ds_link *link)
-{
- struct ds_track *track = despotify_link_get_track(session, link);
- if (track == nullptr)
- return false;
-
- add_song(songs, *track);
- return true;
-}
-
-static bool
-parse_playlist(struct despotify_session *session,
- std::forward_list<DetachedSong> &songs,
- struct ds_link *link)
-{
- ds_playlist *playlist = despotify_link_get_playlist(session, link);
- if (playlist == nullptr)
- return false;
-
- for (ds_track *track = playlist->tracks; track != nullptr;
- track = track->next)
- add_song(songs, *track);
-
- return true;
-}
-
-static SongEnumerator *
-despotify_playlist_open_uri(const char *url,
- gcc_unused Mutex &mutex, gcc_unused Cond &cond)
-{
- despotify_session *session = mpd_despotify_get_session();
- if (session == nullptr)
- return nullptr;
-
- /* Get link without spt:// */
- ds_link *link =
- despotify_link_from_uri(url + strlen(despotify_playlist_plugin.schemes[0]) + 3);
- if (link == nullptr) {
- FormatDebug(despotify_domain, "Can't find %s\n", url);
- return nullptr;
- }
-
- std::forward_list<DetachedSong> songs;
-
- bool parse_result;
- switch (link->type) {
- case LINK_TYPE_TRACK:
- parse_result = parse_track(session, songs, link);
- break;
- case LINK_TYPE_PLAYLIST:
- parse_result = parse_playlist(session, songs, link);
- break;
- default:
- parse_result = false;
- break;
- }
-
- despotify_free_link(link);
- if (!parse_result)
- return nullptr;
-
- songs.reverse();
- return new MemorySongEnumerator(std::move(songs));
-}
-
-static const char *const despotify_schemes[] = {
- "spt",
- nullptr
-};
-
-const struct playlist_plugin despotify_playlist_plugin = {
- "despotify",
-
- nullptr,
- nullptr,
- despotify_playlist_open_uri,
- nullptr,
-
- despotify_schemes,
- nullptr,
- nullptr,
-};
diff --git a/src/playlist/plugins/DespotifyPlaylistPlugin.hxx b/src/playlist/plugins/DespotifyPlaylistPlugin.hxx
deleted file mode 100644
index 6acfd40f4..000000000
--- a/src/playlist/plugins/DespotifyPlaylistPlugin.hxx
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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_DESPOTIFY_PLAYLIST_PLUGIN_HXX
-#define MPD_PLAYLIST_DESPOTIFY_PLAYLIST_PLUGIN_HXX
-
-extern const struct playlist_plugin despotify_playlist_plugin;
-
-#endif