本文整理汇总了C++中mpd::Song::getTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ Song::getTitle方法的具体用法?C++ Song::getTitle怎么用?C++ Song::getTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpd::Song
的用法示例。
在下文中一共展示了Song::getTitle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void Lyrics::update()
{
# ifdef HAVE_CURL_CURL_H
if (isReadyToTake)
Take();
if (isDownloadInProgress)
{
w.flush();
w.refresh();
}
# endif // HAVE_CURL_CURL_H
if (ReloadNP)
{
const MPD::Song s = myPlaylist->nowPlayingSong();
if (!s.empty() && !s.getArtist().empty() && !s.getTitle().empty())
{
drawHeader();
itsScrollBegin = 0;
itsSong = s;
Load();
}
ReloadNP = 0;
}
}
示例2: GenerateFilename
std::string Lyrics::GenerateFilename(const MPD::Song &s)
{
std::string filename;
if (Config.store_lyrics_in_song_dir)
{
if (s.isFromDatabase())
{
filename = Config.mpd_music_dir;
filename += "/";
filename += s.getURI();
}
else
filename = s.getURI();
// 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 = s.getArtist();
file += " - ";
file += s.getTitle();
file += ".txt";
removeInvalidCharsFromFilename(file);
filename = Config.lyrics_directory;
filename += "/";
filename += file;
}
return filename;
}
示例3: DownloadInBackground
void Lyrics::DownloadInBackground(const MPD::Song &s)
{
if (s.empty() || s.getArtist().empty() || s.getTitle().empty())
return;
std::string filename = GenerateFilename(s);
std::ifstream f(filename.c_str());
if (f.is_open())
{
f.close();
return;
}
Statusbar::msg("Fetching lyrics for \"%s\"...", s.toString(Config.song_status_format_no_colors, Config.tags_separator).c_str());
MPD::Song *s_copy = new MPD::Song(s);
pthread_mutex_lock(&itsDIBLock);
if (itsWorkersNumber == itsMaxWorkersNumber)
itsToDownload.push(s_copy);
else
{
++itsWorkersNumber;
pthread_t t;
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
pthread_create(&t, &attr, DownloadInBackgroundImpl, s_copy);
}
pthread_mutex_unlock(&itsDIBLock);
}
示例4: DownloadInBackgroundImplHelper
void Lyrics::DownloadInBackgroundImplHelper(const MPD::Song &s)
{
std::string artist = Curl::escape(s.getArtist());
std::string title = Curl::escape(s.getTitle());
LyricsFetcher::Result result;
bool fetcher_defined = itsFetcher && *itsFetcher;
for (LyricsFetcher **plugin = fetcher_defined ? itsFetcher : lyricsPlugins; *plugin != 0; ++plugin)
{
result = (*plugin)->fetch(artist, title);
if (result.first)
break;
if (fetcher_defined)
break;
}
if (result.first == true)
Save(GenerateFilename(s), result.second);
}