当前位置: 首页>>代码示例>>C++>>正文


C++ Song::GetArtist方法代码示例

本文整理汇总了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;
}
开发者ID:bear24rw,项目名称:ncmpcpp,代码行数:32,代码来源:lyrics.cpp

示例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();
  }
开发者ID:tomwagner,项目名称:IntelligentMPDClient,代码行数:44,代码来源:storage.cpp

示例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();
}
开发者ID:tomwagner,项目名称:IntelligentMPDClient,代码行数:80,代码来源:intelligentclient.cpp


注:本文中的mpd::Song::GetArtist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。