本文整理汇总了C++中mpd::Song::GetArtist方法的典型用法代码示例。如果您正苦于以下问题:C++ Song::GetArtist方法的具体用法?C++ Song::GetArtist怎么用?C++ Song::GetArtist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpd::Song
的用法示例。
在下文中一共展示了Song::GetArtist方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GenerateFilename
std::string Lyrics::GenerateFilename(const MPD::Song &s)
{
std::string filename;
if (Config.store_lyrics_in_song_dir)
{
if (s.isFromDB())
{
filename = Config.mpd_music_dir;
filename += "/";
filename += s.GetFile();
}
else
filename = s.GetFile();
// replace song's extension with .txt
size_t dot = filename.rfind('.');
assert(dot != std::string::npos);
filename.resize(dot);
filename += ".txt";
}
else
{
std::string file = locale_to_utf_cpy(s.GetArtist());
file += " - ";
file += locale_to_utf_cpy(s.GetTitle());
file += ".txt";
EscapeUnallowedChars(file);
filename = Config.lyrics_directory;
filename += "/";
filename += file;
}
return filename;
}
示例2: loadNewSong
void Storage::loadNewSong(MPD::Song s) {
// save current file
currentArtist->saveArtist(filePath);
if (Config::GetInstance()->isRemoteStorageEnabled()) {
// save to shared storage
if (remoteSaveArtist(filePath)) {
currentArtist->setSynced(true);
} else {
currentArtist->setSynced(false);
}
// save with sync flags
currentArtist->saveArtist(filePath);
}
// clear current Artist
currentArtist->clear();
// load new data to storage
filePath = createArtistFilePath(s.GetArtist());
currentArtist->name.set(s.GetArtist());
currentArtist->album.set(s.GetAlbum());
// check if file exists
// search in local temp
currentArtist->loadArtistFromFile(filePath);
// if is enabled remote sharing, share
if (Config::GetInstance()->isRemoteStorageEnabled()) {
// remote load artist
std::string remoteArtistContent = remoteLoadArtist(s.GetArtist());
currentArtist->loadArtistFromRemoteContent(remoteArtistContent);
}
// classificate artist
currentArtist->loadClassificator();
currentArtist->classificateArtist();
loadWidgets();
}
示例3: updatePlayer
void updatePlayer(MPD::Client *, MPD::StatusChanges changed, void *) {
if (changed.SongID) {
if (MPD::Client::GetInstance()->isPlaying()) {
#if DEBUG
std::cout << "Song changed" << std::endl;
#endif
MPD::Song song = MPD::Client::GetInstance()->GetCurrentSong();
// set song parameters to storage
Storage::GetInstance()->loadNewSong(song);
// run agents
AgentManager::GetInstance()->songChanged();
// set text widgets
GUI::MainWindow::GetInstance()->setSongLabel(song.GetArtist() + " - " + song.GetTitle());
GUI::MainWindow::GetInstance()->setArtist(song.GetArtist());
GUI::MainWindow::GetInstance()->setTitle(song.GetTitle());
GUI::MainWindow::GetInstance()->setAlbum(song.GetAlbum());
GUI::MainWindow::GetInstance()->setGenre(song.GetGenre());
GUI::MainWindow::GetInstance()->setTimeScale(MPD::Client::GetInstance()->GetElapsedTime(), MPD::Client::GetInstance()->GetTotalTime());
}
}
if (changed.ElapsedTime) {
// if (!Config::GetInstance()->isAgentsEnabled()) {
// AgentManager::GetInstance()->killAgents();
// }
//
// AgentManager::GetInstance()->isSourcesChanged();
// load new info to widgets
GUI::MainWindow::GetInstance()->articlesWidget->updateArticlesWidget();
GUI::MainWindow::GetInstance()->slideshowWidget->updateSlideshowWidget();
// GUI::MainWindow::GetInstance()->coverWidget->updateCoverWidget();
GUI::MainWindow::GetInstance()->setTimeScale(MPD::Client::GetInstance()->GetElapsedTime(), MPD::Client::GetInstance()->GetTotalTime());
if (MPD::Client::GetInstance()->isPlaying()) {
MPD::Song song = MPD::Client::GetInstance()->GetCurrentSong();
GUI::MainWindow::GetInstance()->setSongLabel(song.GetArtist() + " - " + song.GetTitle());
GUI::MainWindow::GetInstance()->setStatusBar(_("IMPC Playing: ") + song.GetFile());
}
}
if (changed.PlayerState) {
MPD::PlayerState s = MPD::Client::GetInstance()->GetState();
if (s == MPD::psPlay) {
GUI::MainWindow::GetInstance()->on_play();
GUI::MainWindow::GetInstance()->setPlayButtonActive(true);
GUI::MainWindow::GetInstance()->setBitrate(MPD::Client::GetInstance()->GetBitrate());
} else if (s == MPD::psPause) {
GUI::MainWindow::GetInstance()->on_pause();
GUI::MainWindow::GetInstance()->setPlayButtonActive(false);
} else if (s == MPD::psStop) {
GUI::MainWindow::GetInstance()->on_stop();
GUI::MainWindow::GetInstance()->articlesWidget->clearArticlesWidget();
GUI::MainWindow::GetInstance()->slideshowWidget->clearSlide();
}
}
if (changed.DBUpdating) {
GUI::MainWindow::GetInstance()->artistsWidget->reload();
}
if (changed.Volume) {
// we set default volume
GUI::MainWindow::GetInstance()->setVolume((double) MPD::Client::GetInstance()->GetVolume());
}
AgentManager::GetInstance()->checkIfAgentsEnabled();
}