static gpointer do_lastfm_current_song_love (gpointer userdata) { AsycMessageData *message_data = NULL; gint rv; LastfmData *data = userdata; SoundmenuPlugin *soundmenu = data->soundmenu; SoundmenuLastfm *lastfm = soundmenu->clastfm; rv = LASTFM_track_love (lastfm->session_id, data->title, data->artist); message_data = soundmenu_async_finished_message_new(soundmenu, (rv != 0) ? _("Love song on Last.fm failed.") : NULL); soundmenu_lastfm_data_free (data); return message_data; }
bool cSession::LoveTrack(const cMetaData& metaData) { std::cout<<"cSession::LoveTrack "<<metaData.sArtist<<" - "<<metaData.sTitle<<std::endl; if (!IsLoggedIn()) { std::cerr<<"cSession::LoveTrack Error not logged in to LastFM"<<std::endl; return false; } const std::string sArtistUTF8 = spitfire::string::ToUTF8(metaData.sArtist); const std::string sTitleUTF8 = spitfire::string::ToUTF8(metaData.sTitle); int iResult = LASTFM_track_love(pSession, sTitleUTF8.c_str(), sArtistUTF8.c_str()); const char* szStatus = nullptr; const int* iErrorCode = nullptr; const char* szErrorText = nullptr; LASTFM_status(pSession, &szStatus, &iErrorCode, &szErrorText); std::cout<<"cSession::LoveTrack returning "<<(iResult == 0)<<", status="<<szStatus<<", error="<<iErrorCode<<", "<<szErrorText<<std::endl; return (iResult == 0); }