本文整理汇总了C++中MusicMetadata::setCompilation方法的典型用法代码示例。如果您正苦于以下问题:C++ MusicMetadata::setCompilation方法的具体用法?C++ MusicMetadata::setCompilation怎么用?C++ MusicMetadata::setCompilation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MusicMetadata
的用法示例。
在下文中一共展示了MusicMetadata::setCompilation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compilationChanged
void Ripper::compilationChanged(bool state)
{
if (!state)
{
if (m_tracks->size() > 0)
{
// Update artist MetaData of each track on the ablum...
for (int trackno = 0; trackno < m_tracks->size(); ++trackno)
{
MusicMetadata *data = m_tracks->at(trackno)->metadata;
if (data)
{
data->setCompilationArtist("");
data->setArtist(m_artistName);
data->setCompilation(false);
}
}
}
m_switchTitleArtist->SetVisible(false);
}
else
{
if (m_tracks->size() > 0)
{
// Update artist MetaData of each track on the album...
for (int trackno = 0; trackno < m_tracks->size(); ++trackno)
{
MusicMetadata *data;
data = m_tracks->at(trackno)->metadata;
if (data)
{
data->setCompilationArtist(m_artistName);
data->setCompilation(true);
}
}
}
m_switchTitleArtist->SetVisible(true);
}
BuildFocusList();
updateTrackList();
}
示例2: lock
//.........这里部分代码省略.........
if (!compilation_artist.isEmpty() &&
artist != compilation_artist)
isCompilation = true;
album = cdtext_get_const(CDTEXT_TITLE, cdtext);
if (genre.isNull())
genre = cdtext_get_const(CDTEXT_GENRE, cdtext);
cdtext_destroy(cdtext);
}
}
else
{
if (s_iCdtext < 0)
LOG(VB_MEDIA, LOG_INFO, "No cdtext title for track");
s_iCdtext = 0;
}
}
else
{
if (s_iCdtext < 0)
LOG(VB_MEDIA, LOG_INFO, "No cdtext");
s_iCdtext = 0;
}
}
if (title.isEmpty() || artist.isEmpty() || album.isEmpty())
#endif // CDTEXT
{
// CDDB lookup
Cddb::Toc toc;
Cddb::Matches r;
if (Cddb::Query(r, GetToc(cdio, toc)))
{
Cddb::Matches::match_t::const_iterator select = r.matches.begin();
if (r.matches.size() > 1)
{
// TODO prompt user to select one
// In the meantime, select the first non-generic genre
for (Cddb::Matches::match_t::const_iterator it = select;
it != r.matches.end(); ++it)
{
QString g = it->discGenre.toLower();
if (g != "misc" && g != "data")
{
select = it;
break;
}
}
}
Cddb::Album info;
if (Cddb::Read(info, select->discGenre, select->discID))
{
isCompilation = info.isCompilation;
if (info.genre.toLower() != "unknown")
genre = info.genre[0].toTitleCase() + info.genre.mid(1);
else
genre = info.discGenre[0].toTitleCase() + info.discGenre.mid(1);;
album = info.title;
compilation_artist = info.artist;
year = info.year;
if (info.tracks.size() >= tracknum)
{
const Cddb::Track& track = info.tracks[tracknum - 1];
title = track.title;
artist = track.artist;
}
// Create a temporary local alias for future lookups
if (r.discID != info.discID)
Cddb::Alias(info, r.discID);
}
}
}
if (compilation_artist.toLower().left(7) == "various")
compilation_artist = QObject::tr("Various Artists");
if (artist.isEmpty())
{
artist = compilation_artist;
compilation_artist.clear();
}
if (title.isEmpty())
title = QObject::tr("Track %1").arg(tracknum);
MusicMetadata *m = new MusicMetadata(getFilename(), artist, compilation_artist,
album, title, genre, year, tracknum, length);
if (m)
m->setCompilation(isCompilation);
return m;
}
示例3: MusicMetadata
/*!
* \copydoc MetaIO::read()
*/
MusicMetadata *MetaIOID3::read(const QString &filename)
{
if (!OpenFile(filename))
return nullptr;
TagLib::ID3v2::Tag *tag = GetID3v2Tag(true); // Create tag if none are found
// if there is no ID3v2 tag, try to read the ID3v1 tag and copy it to
// the ID3v2 tag structure
if (tag->isEmpty())
{
TagLib::ID3v1::Tag *tag_v1 = GetID3v1Tag();
if (!tag_v1)
return nullptr;
if (!tag_v1->isEmpty())
{
tag->setTitle(tag_v1->title());
tag->setArtist(tag_v1->artist());
tag->setAlbum(tag_v1->album());
tag->setTrack(tag_v1->track());
tag->setYear(tag_v1->year());
tag->setGenre(tag_v1->genre());
}
}
MusicMetadata *metadata = new MusicMetadata(filename);
ReadGenericMetadata(tag, metadata);
bool compilation = false;
// Compilation Artist (TPE4 Remix) or fallback to (TPE2 Band)
// N.B. The existance of a either frame is NOT an indication that this
// is a compilation, but if it is then one of them will probably hold
// the compilation artist.
TextIdentificationFrame *tpeframe = nullptr;
TagLib::ID3v2::FrameList tpelist = tag->frameListMap()["TPE4"];
if (tpelist.isEmpty() || tpelist.front()->toString().isEmpty())
tpelist = tag->frameListMap()["TPE2"];
if (!tpelist.isEmpty())
tpeframe = (TextIdentificationFrame *)tpelist.front();
if (tpeframe && !tpeframe->toString().isEmpty())
{
QString compilation_artist = TStringToQString(tpeframe->toString())
.trimmed();
metadata->setCompilationArtist(compilation_artist);
}
// Rating and playcount, stored in POPM frame
PopularimeterFrame *popm = findPOPM(tag, ""); // Global (all apps) tag
// If no 'global' tag exists, look for the MythTV specific one
if (!popm)
{
popm = findPOPM(tag, email);
}
// Fallback to using any POPM tag we can find
if (!popm)
{
if (!tag->frameListMap()["POPM"].isEmpty())
popm = dynamic_cast<PopularimeterFrame *>
(tag->frameListMap()["POPM"].front());
}
if (popm)
{
int rating = popm->rating();
rating = lroundf(static_cast<float>(rating) / 255.0f * 10.0f);
metadata->setRating(rating);
metadata->setPlaycount(popm->counter());
}
// Look for MusicBrainz Album+Artist ID in TXXX Frame
UserTextIdentificationFrame *musicbrainz = find(tag,
"MusicBrainz Album Artist Id");
if (musicbrainz)
{
// If the MusicBrainz ID is the special "Various Artists" ID
// then compilation is TRUE
if (!compilation && !musicbrainz->fieldList().isEmpty())
{
TagLib::StringList l = musicbrainz->fieldList();
for (TagLib::StringList::ConstIterator it = l.begin(); it != l.end(); it++)
{
QString ID = TStringToQString((*it));
if (ID == MYTH_MUSICBRAINZ_ALBUMARTIST_UUID)
{
compilation = true;
break;
}
}
//.........这里部分代码省略.........
示例4: while
/*!
* \copydoc MetaIO::read()
*/
MusicMetadata* MetaIOMP4::read(const QString &filename)
{
QString title, artist, album, genre;
int year = 0, tracknum = 0, length = 0;
bool compilation = false;
AVFormatContext* p_context = NULL;
AVInputFormat* p_inputformat = NULL;
QByteArray local8bit = filename.toLocal8Bit();
if ((avformat_open_input(&p_context, local8bit.constData(),
p_inputformat, NULL) < 0))
{
return NULL;
}
if (avformat_find_stream_info(p_context, NULL) < 0)
return NULL;
#if 0
//### Debugging, enable to dump a list of all field names/values found
AVDictionaryEntry *tag = av_dict_get(p_context->metadata, "\0", NULL,
AV_METADATA_IGNORE_SUFFIX);
while (tag != NULL)
{
LOG(VB_GENERAL, LOG_DEBUG, QString("Tag: %1 Value: %2")
.arg(tag->key) .arg(QString::fromUtf8(tag->value)));
tag = av_dict_get(p_context->metadata, "\0", tag,
AV_METADATA_IGNORE_SUFFIX);
}
//####
#endif
title = getFieldValue(p_context, "title");
if (title.isEmpty())
{
readFromFilename(filename, artist, album, title, genre, tracknum);
}
else
{
title = getFieldValue(p_context, "title");
artist = getFieldValue(p_context, "author");
// Author is the correct fieldname, but
// we've been saving to artist for years
if (artist.isEmpty())
artist = getFieldValue(p_context, "artist");
album = getFieldValue(p_context, "album");
year = getFieldValue(p_context, "year").toInt();
genre = getFieldValue(p_context, "genre");
tracknum = getFieldValue(p_context, "track").toInt();
compilation = getFieldValue(p_context, "").toInt();
length = getTrackLength(p_context);
}
metadataSanityCheck(&artist, &album, &title, &genre);
MusicMetadata *retdata = new MusicMetadata(filename,
artist,
compilation ? artist : "",
album,
title,
genre,
year,
tracknum,
length);
retdata->setCompilation(compilation);
avformat_close_input(&p_context);
return retdata;
}