/thirdparty/liblastfm2/src/types/Playlist.cpp
http://github.com/tomahawk-player/tomahawk · C++ · 63 lines · 36 code · 8 blank · 19 comment · 1 complexity · b3cb000789441e03fbae98ae4534eff5 MD5 · raw file
- /*
- Copyright 2009 Last.fm Ltd.
- - Primarily authored by Max Howell, Jono Cole and Doug Mansell
- This file is part of liblastfm.
- liblastfm 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 3 of the License, or
- (at your option) any later version.
- liblastfm 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 liblastfm. If not, see <http://www.gnu.org/licenses/>.
- */
- #include "Playlist.h"
- #include "Track.h"
- #include "../ws/ws.h"
- QNetworkReply*
- lastfm::Playlist::addTrack( const Track& t ) const
- {
- QMap<QString, QString> map;
- map["method"] = "playlist.addTrack";
- map["playlistID"] = m_id;
- map["artist"] = t.artist();
- map["track"] = t.title();
- return lastfm::ws::post(map);
- }
- QNetworkReply*
- lastfm::Playlist::fetch() const
- {
- return fetch( QUrl("lastfm://playlist/" + QString::number( m_id )) );
- }
- QNetworkReply* //static
- lastfm::Playlist::fetch( const QUrl& url )
- {
- QMap<QString, QString> map;
- map["method"] = "playlist.fetch";
- map["playlistURL"] = url.toString();
- return lastfm::ws::get(map);
- }
- QNetworkReply* //static
- lastfm::Playlist::create( const QString& title, const QString& description /*=""*/ )
- {
- QMap<QString, QString> map;
- map["method"] = "playlist.create";
- map["title"] = title;
- if (description.size())
- map["description"] = description;
- return lastfm::ws::post(map);
- }