本文整理汇总了C++中music_info::CMusicInfoTag::GetArtistString方法的典型用法代码示例。如果您正苦于以下问题:C++ CMusicInfoTag::GetArtistString方法的具体用法?C++ CMusicInfoTag::GetArtistString怎么用?C++ CMusicInfoTag::GetArtistString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类music_info::CMusicInfoTag
的用法示例。
在下文中一共展示了CMusicInfoTag::GetArtistString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAlbumDirName
std::string CCDDARipper::GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag)
{
std::string strAlbumDir;
// use audiocds.trackpathformat setting to format
// directory name where CD tracks will be stored,
// use only format part ending at the last '/'
strAlbumDir = CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(CSettings::SETTING_AUDIOCDS_TRACKPATHFORMAT);
size_t pos = strAlbumDir.find_last_of("/\\");
if (pos == std::string::npos)
return ""; // no directory
strAlbumDir = strAlbumDir.substr(0, pos);
// replace %A with album artist name
if (strAlbumDir.find("%A") != std::string::npos)
{
std::string strAlbumArtist = infoTag.GetAlbumArtistString();
if (strAlbumArtist.empty())
strAlbumArtist = infoTag.GetArtistString();
if (strAlbumArtist.empty())
strAlbumArtist = "Unknown Artist";
else
StringUtils::Replace(strAlbumArtist, '/', '_');
StringUtils::Replace(strAlbumDir, "%A", strAlbumArtist);
}
// replace %B with album title
if (strAlbumDir.find("%B") != std::string::npos)
{
std::string strAlbum = infoTag.GetAlbum();
if (strAlbum.empty())
strAlbum = StringUtils::Format("Unknown Album %s", CDateTime::GetCurrentDateTime().GetAsLocalizedDateTime().c_str());
else
StringUtils::Replace(strAlbum, '/', '_');
StringUtils::Replace(strAlbumDir, "%B", strAlbum);
}
// replace %G with genre
if (strAlbumDir.find("%G") != std::string::npos)
{
std::string strGenre = StringUtils::Join(infoTag.GetGenre(), CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_musicItemSeparator);
if (strGenre.empty())
strGenre = "Unknown Genre";
else
StringUtils::Replace(strGenre, '/', '_');
StringUtils::Replace(strAlbumDir, "%G", strGenre);
}
// replace %Y with year
if (strAlbumDir.find("%Y") != std::string::npos)
{
std::string strYear = infoTag.GetYearString();
if (strYear.empty())
strYear = "Unknown Year";
else
StringUtils::Replace(strYear, '/', '_');
StringUtils::Replace(strAlbumDir, "%Y", strYear);
}
return strAlbumDir;
}