Actually scrobble

This commit is contained in:
David Sansome 2009-12-29 20:11:03 +00:00
parent 72f793a002
commit 5e514c42b6
4 changed files with 19 additions and 13 deletions

View File

@ -265,22 +265,28 @@ void LastFMService::NowPlaying(const Song &song) {
if (!InitScrobbler())
return;
scrobbler_->nowPlaying(TrackFromSong(song));
last_track_ = TrackFromSong(song);
lastfm::MutableTrack mtrack(last_track_);
mtrack.stamp();
scrobbler_->nowPlaying(last_track_);
}
void LastFMService::Scrobble(const Song& song) {
void LastFMService::Scrobble() {
if (!InitScrobbler())
return;
scrobbler_->cache(TrackFromSong(song));
scrobbler_->cache(last_track_);
scrobbler_->submit();
}
void LastFMService::Love(const Song& song) {
lastfm::MutableTrack mtrack(TrackFromSong(song));
void LastFMService::Love() {
lastfm::MutableTrack mtrack(last_track_);
mtrack.love();
}
void LastFMService::Ban(const Song& song) {
lastfm::MutableTrack mtrack(TrackFromSong(song));
void LastFMService::Ban() {
lastfm::MutableTrack mtrack(last_track_);
mtrack.ban();
}

View File

@ -41,9 +41,9 @@ class LastFMService : public RadioService {
void Authenticate(const QString& username, const QString& password);
void NowPlaying(const Song& song);
void Scrobble(const Song& song);
void Love(const Song& song);
void Ban(const Song& song);
void Scrobble();
void Love();
void Ban();
signals:
void AuthenticationComplete(bool success);

View File

@ -342,7 +342,7 @@ void MainWindow::UpdateTrackPosition() {
if (!playlist_->has_scrobbled() &&
position >= playlist_->scrobble_point()) {
radio_model_->GetLastFMService()->Scrobble(playlist_->current_item_metadata());
radio_model_->GetLastFMService()->Scrobble();
playlist_->set_scrobbled(true);
}
}

View File

@ -21,9 +21,9 @@ const char* Playlist::kSettingsGroup = "Playlist";
Playlist::Playlist(QObject *parent) :
QAbstractListModel(parent),
current_is_paused_(false),
ignore_sorting_(false),
scrobble_point_(-1),
has_scrobbled_(false)
has_scrobbled_(false),
ignore_sorting_(false)
{
}