mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-31 11:35:24 +01:00
Commit missing GS radio files
This commit is contained in:
parent
0aba1ce77d
commit
1c99c8cc3b
54
src/internet/groovesharkradio.cpp
Normal file
54
src/internet/groovesharkradio.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2011, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "groovesharkradio.h"
|
||||
|
||||
#include "groovesharkservice.h"
|
||||
#include "core/logging.h"
|
||||
#include "internet/internetplaylistitem.h"
|
||||
|
||||
GroovesharkRadio::GroovesharkRadio()
|
||||
: tag_id_(0),
|
||||
first_time_(true) {
|
||||
}
|
||||
|
||||
GroovesharkRadio::GroovesharkRadio(GroovesharkService* service, int tag_id)
|
||||
: service_(service),
|
||||
tag_id_(tag_id),
|
||||
first_time_(true) {
|
||||
}
|
||||
|
||||
void GroovesharkRadio::Load(const QByteArray& data) {
|
||||
}
|
||||
|
||||
QByteArray GroovesharkRadio::Save() const {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
PlaylistItemList GroovesharkRadio::Generate() {
|
||||
PlaylistItemList items;
|
||||
if (first_time_) {
|
||||
Song song = service_->StartAutoplayTag(tag_id_, autoplay_state_);
|
||||
PlaylistItemPtr playlist_item = PlaylistItemPtr(new InternetPlaylistItem(service_, song));
|
||||
items << playlist_item;
|
||||
first_time_ = false;
|
||||
}
|
||||
Song song = service_->GetAutoplaySong(autoplay_state_);
|
||||
PlaylistItemPtr playlist_item = PlaylistItemPtr(new InternetPlaylistItem(service_, song));
|
||||
items << playlist_item;
|
||||
return items;
|
||||
}
|
46
src/internet/groovesharkradio.h
Normal file
46
src/internet/groovesharkradio.h
Normal file
@ -0,0 +1,46 @@
|
||||
/* This file is part of Clementine.
|
||||
Copyright 2011, David Sansome <me@davidsansome.com>
|
||||
|
||||
Clementine 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.
|
||||
|
||||
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GROOVESHARKDYNAMICPLAYLIST_H
|
||||
#define GROOVESHARKDYNAMICPLAYLIST_H
|
||||
|
||||
#include "smartplaylists/generator.h"
|
||||
|
||||
class GroovesharkService;
|
||||
|
||||
class GroovesharkRadio : public smart_playlists::Generator {
|
||||
|
||||
public:
|
||||
//GroovesharkRadio();
|
||||
GroovesharkRadio(GroovesharkService* service, int tag_id);
|
||||
|
||||
QString type() const { return "Grooveshark"; }
|
||||
void Load(const QByteArray& data);
|
||||
QByteArray Save() const;
|
||||
PlaylistItemList Generate();
|
||||
PlaylistItemList GenerateMore(int count) { return Generate(); }
|
||||
bool is_dynamic() const { return true; }
|
||||
|
||||
private:
|
||||
GroovesharkService* service_;
|
||||
int tag_id_;
|
||||
// For Generate: indicates if it's the first time we generate songs
|
||||
bool first_time_;
|
||||
QVariantMap autoplay_state_;
|
||||
};
|
||||
|
||||
#endif // GROOVESHARKDYNAMICPLAYLIST_H
|
@ -74,7 +74,7 @@ const char* GroovesharkService::kUrlCover = "http://beta.grooveshark.com/static/
|
||||
const char* GroovesharkService::kHomepage = "http://grooveshark.com/";
|
||||
|
||||
const int GroovesharkService::kSearchDelayMsec = 400;
|
||||
const int GroovesharkService::kSongSearchLimit = 50;
|
||||
const int GroovesharkService::kSongSearchLimit = 100;
|
||||
const int GroovesharkService::kSongSimpleSearchLimit = 10;
|
||||
|
||||
typedef QPair<QString, QVariant> Param;
|
||||
|
Loading…
x
Reference in New Issue
Block a user