本文整理汇总了C++中taglib::File::name方法的典型用法代码示例。如果您正苦于以下问题:C++ File::name方法的具体用法?C++ File::name怎么用?C++ File::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类taglib::File
的用法示例。
在下文中一共展示了File::name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readInfo
bool KMpcPlugin::readInfo( KFileMetaInfo& info, uint what )
{
bool readComment = false;
bool readTech = false;
if (what & (KFileMetaInfo::Fastest |
KFileMetaInfo::DontCare |
KFileMetaInfo::ContentInfo)) readComment = true;
if (what & (KFileMetaInfo::Fastest |
KFileMetaInfo::DontCare |
KFileMetaInfo::TechnicalInfo)) readTech = true;
if ( info.path().isEmpty() ) // remote file
return false;
TagLib::File *file = new TagLib::MPC::File(QFile::encodeName(info.path()).data(), readTech);
if (!file->isOpen())
{
kDebug(7034) << "Couldn't open " << file->name();
delete file;
return false;
}
if(readComment)
{
KFileMetaInfoGroup commentgroup = appendGroup(info, "Comment");
QString date = file->tag()->year() > 0 ? QString::number(file->tag()->year()) : QString();
QString track = file->tag()->track() > 0 ? QString::number(file->tag()->track()) : QString();
appendItem(commentgroup, "Title", TStringToQString(file->tag()->title()).trimmed());
appendItem(commentgroup, "Artist", TStringToQString(file->tag()->artist()).trimmed());
appendItem(commentgroup, "Album", TStringToQString(file->tag()->album()).trimmed());
appendItem(commentgroup, "Date", date);
appendItem(commentgroup, "Comment", TStringToQString(file->tag()->comment()).trimmed());
appendItem(commentgroup, "Tracknumber", track);
appendItem(commentgroup, "Genre", TStringToQString(file->tag()->genre()).trimmed());
}
if (readTech)
{
KFileMetaInfoGroup techgroup = appendGroup(info, "Technical");
TagLib::MPC::Properties *properties =
(TagLib::MPC::Properties*)(file->audioProperties());
appendItem(techgroup, "Bitrate", properties->bitrate());
appendItem(techgroup, "Sample Rate", properties->sampleRate());
appendItem(techgroup, "Channels", properties->channels());
appendItem(techgroup, "Length", properties->length());
appendItem(techgroup, "Version", properties->mpcVersion());
}
delete file;
return true;
}
示例2: readInfo
bool KFlacPlugin::readInfo( KFileMetaInfo& info, uint what )
{
if ( info.path().isEmpty() ) // remote file
return false;
bool readComment = false;
bool readTech = false;
if (what & (KFileMetaInfo::Fastest |
KFileMetaInfo::DontCare |
KFileMetaInfo::ContentInfo)) readComment = true;
if (what & (KFileMetaInfo::Fastest |
KFileMetaInfo::DontCare |
KFileMetaInfo::TechnicalInfo)) readTech = true;
TagLib::File *file = 0;
if (info.mimeType() == "audio/x-flac")
file = new TagLib::FLAC::File(QFile::encodeName(info.path()).data(), readTech);
#ifdef TAGLIB_1_2
else
file = new TagLib::Ogg::FLAC::File(QFile::encodeName(info.path()).data(), readTech);
#endif
if (!file || !file->isValid())
{
kdDebug(7034) << "Couldn't open " << file->name() << endl;
delete file;
return false;
}
if(readComment && file->tag())
{
KFileMetaInfoGroup commentgroup = appendGroup(info, "Comment");
QString date = file->tag()->year() > 0 ? QString::number(file->tag()->year()) : QString::null;
QString track = file->tag()->track() > 0 ? QString::number(file->tag()->track()) : QString::null;
appendItem(commentgroup, "Title", TStringToQString(file->tag()->title()).stripWhiteSpace());
appendItem(commentgroup, "Artist", TStringToQString(file->tag()->artist()).stripWhiteSpace());
appendItem(commentgroup, "Album", TStringToQString(file->tag()->album()).stripWhiteSpace());
appendItem(commentgroup, "Date", date);
appendItem(commentgroup, "Comment", TStringToQString(file->tag()->comment()).stripWhiteSpace());
appendItem(commentgroup, "Tracknumber", track);
appendItem(commentgroup, "Genre", TStringToQString(file->tag()->genre()).stripWhiteSpace());
}
if (readTech && file->audioProperties())
{
KFileMetaInfoGroup techgroup = appendGroup(info, "Technical");
TagLib::FLAC::Properties *properties =
(TagLib::FLAC::Properties*)(file->audioProperties());
appendItem(techgroup, "Bitrate", properties->bitrate());
appendItem(techgroup, "Sample Rate", properties->sampleRate());
appendItem(techgroup, "Sample Width", properties->sampleWidth());
appendItem(techgroup, "Channels", properties->channels());
appendItem(techgroup, "Length", properties->length());
}
delete file;
return true;
}