本文整理汇总了C++中taglib::StringList::append方法的典型用法代码示例。如果您正苦于以下问题:C++ StringList::append方法的具体用法?C++ StringList::append怎么用?C++ StringList::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类taglib::StringList
的用法示例。
在下文中一共展示了StringList::append方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: meta_addTag
int meta_addTag(char* filename, TagLib::String tag)
{
TagLib::StringList tags;
if (meta_getTags(filename, &tags) != EXIT_SUCCESS)
return EXIT_FAILURE;
tags.append(optarg);
return meta_setTags(filename, tags);
}
示例2: setTag
int MetaDSF::setTag(const TagLib::String &key, const TagLib::String &val,
bool replace)
{
TagLib::StringList vals;
vals.append(val);
return setTag(key, vals, replace);
}
示例3: setArtistAlbum
void FileHelper::setArtistAlbum(const QString &artistAlbum)
{
switch (_fileType) {
case EXT_FLAC: {
this->setFlacAttribute("ALBUMARTIST", artistAlbum);
break;
}
case EXT_MP4:{
TagLib::StringList l;
l.append(artistAlbum.toStdString().data());
TagLib::MP4::Item item(l);
this->setMp4Attribute("aART", item);
break;
}
case EXT_MPC:
//mpcFile = static_cast<MPC::File*>(f);
qDebug() << Q_FUNC_INFO << "Not implemented for MPC";
break;
case EXT_MP3:{
TagLib::MPEG::File *mpegFile = static_cast<TagLib::MPEG::File*>(_file);
if (mpegFile->hasID3v2Tag()) {
TagLib::ID3v2::Tag *tag = mpegFile->ID3v2Tag();
QString convertedKey = this->convertKeyToID3v2Key("ARTISTALBUM");
TagLib::ID3v2::FrameList l = tag->frameListMap()[convertedKey.toStdString().data()];
if (!l.isEmpty()) {
tag->removeFrame(l.front());
}
TagLib::ID3v2::TextIdentificationFrame *tif = new TagLib::ID3v2::TextIdentificationFrame(TagLib::ByteVector(convertedKey.toStdString().data()));
tif->setText(artistAlbum.toStdString().data());
tag->addFrame(tif);
} else if (mpegFile->hasID3v1Tag()) {
qDebug() << Q_FUNC_INFO << "Not implemented for ID3v1Tag";
}
break;
}
case EXT_OGG: {
TagLib::Ogg::XiphComment *xiphComment = static_cast<TagLib::Ogg::XiphComment*>(_file->tag());
if (xiphComment) {
xiphComment->addField("ALBUMARTIST", artistAlbum.toStdString().data());
} else {
qDebug() << Q_FUNC_INFO << "Not implemented for this OGG file";
}
break;
}
default:
qDebug() << Q_FUNC_INFO << "Not implemented for this type of file";
break;
}
}
示例4: eval
BlockResult Block::eval(const TagLib::FileRef& file)
{
TagLib::PropertyMap metadata = file.tag()->properties();
TagLib::StringList list;
std::stringstream ss;
// TODO: Needs to be refactored
// TODO: Add more
ss << file.audioProperties()->length();
list.append(ss.str());
metadata.insert("length", list);
list.clear();
ss.clear();
ss << file.audioProperties()->bitrate();
list.append(ss.str());
metadata.insert("bitrate", list);
list.clear();
ss.clear();
if (file.audioProperties()->channels() == 1) {
list.append("mono");
} else if (file.audioProperties()->channels() == 2) {
list.append("stereo");
} //TODO: Add more channels names
metadata.insert("channels", list);
list.clear();
ss.clear();
ss << file.audioProperties()->sampleRate();
list.append(ss.str());
metadata.insert("samplerate", list);
list.clear();
ss.clear();
list.append(file.file()->name());
metadata.insert("filename", list);
list.clear();
ss.clear();
return this->eval(metadata);
}
示例5: extract
void TagLibExtractor::extract(ExtractionResult* result)
{
const QString fileUrl = result->inputUrl();
const QString mimeType = result->inputMimetype();
TagLib::FileRef file(fileUrl.toUtf8().constData(), true);
if (file.isNull()) {
return;
}
TagLib::Tag* tags = file.tag();
result->addType(Type::Audio);
TagLib::String artists;
TagLib::String albumArtists;
TagLib::String composers;
TagLib::String lyricists;
TagLib::StringList genres;
// Handling multiple tags in mpeg files.
if ((mimeType == QLatin1String("audio/mpeg")) || (mimeType == QLatin1String("audio/mpeg3")) || (mimeType == QLatin1String("audio/x-mpeg"))) {
TagLib::MPEG::File mpegFile(fileUrl.toUtf8().constData(), true);
if (mpegFile.ID3v2Tag() && !mpegFile.ID3v2Tag()->isEmpty()) {
TagLib::ID3v2::FrameList lstID3v2;
// Artist.
lstID3v2 = mpegFile.ID3v2Tag()->frameListMap()["TPE1"];
if (!lstID3v2.isEmpty()) {
for (TagLib::ID3v2::FrameList::ConstIterator it = lstID3v2.begin(); it != lstID3v2.end(); ++it) {
if (!artists.isEmpty()) {
artists += ", ";
}
artists += (*it)->toString();
}
}
// Album Artist.
lstID3v2 = mpegFile.ID3v2Tag()->frameListMap()["TPE2"];
if (!lstID3v2.isEmpty()) {
for (TagLib::ID3v2::FrameList::ConstIterator it = lstID3v2.begin(); it != lstID3v2.end(); ++it) {
if (!albumArtists.isEmpty()) {
albumArtists += ", ";
}
albumArtists += (*it)->toString();
}
}
// Composer.
lstID3v2 = mpegFile.ID3v2Tag()->frameListMap()["TCOM"];
if (!lstID3v2.isEmpty()) {
for (TagLib::ID3v2::FrameList::ConstIterator it = lstID3v2.begin(); it != lstID3v2.end(); ++it) {
if (!composers.isEmpty()) {
composers += ", ";
}
composers += (*it)->toString();
}
}
// Lyricist.
lstID3v2 = mpegFile.ID3v2Tag()->frameListMap()["TEXT"];
if (!lstID3v2.isEmpty()) {
for (TagLib::ID3v2::FrameList::ConstIterator it = lstID3v2.begin(); it != lstID3v2.end(); ++it) {
if (!lyricists.isEmpty()) {
lyricists += ", ";
}
lyricists += (*it)->toString();
}
}
// Genre.
lstID3v2 = mpegFile.ID3v2Tag()->frameListMap()["TCON"];
if (!lstID3v2.isEmpty()) {
for (TagLib::ID3v2::FrameList::ConstIterator it = lstID3v2.begin(); it != lstID3v2.end(); ++it) {
genres.append((*it)->toString());
}
}
}
}
// Handling multiple tags in Ogg containers.
{
TagLib::Ogg::FieldListMap lstOgg;
// FLAC files.
if (mimeType == QLatin1String("audio/flac")) {
TagLib::FLAC::File flacFile(fileUrl.toUtf8().constData(), true);
if (flacFile.xiphComment() && !flacFile.xiphComment()->isEmpty()) {
lstOgg = flacFile.xiphComment()->fieldListMap();
}
}
// Vorbis files.
if (mimeType == QLatin1String("audio/ogg") || mimeType == QLatin1String("audio/x-vorbis+ogg")) {
TagLib::Ogg::Vorbis::File oggFile(fileUrl.toUtf8().constData(), true);
if (oggFile.tag() && !oggFile.tag()->isEmpty()) {
lstOgg = oggFile.tag()->fieldListMap();
}
}
//.........这里部分代码省略.........