当前位置: 首页>>代码示例>>C++>>正文


C++ MusicMetadata::setCompilationArtist方法代码示例

本文整理汇总了C++中MusicMetadata::setCompilationArtist方法的典型用法代码示例。如果您正苦于以下问题:C++ MusicMetadata::setCompilationArtist方法的具体用法?C++ MusicMetadata::setCompilationArtist怎么用?C++ MusicMetadata::setCompilationArtist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MusicMetadata的用法示例。


在下文中一共展示了MusicMetadata::setCompilationArtist方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: artistChanged

void Ripper::artistChanged()
{
    QString newartist = m_artistEdit->GetText();

    if (m_tracks->size() > 0)
    {
        for (int trackno = 0; trackno < m_tracks->size(); ++trackno)
        {
            MusicMetadata *data = m_tracks->at(trackno)->metadata;
            if (data)
            {
                if (m_compilationCheck->GetBooleanCheckState())
                {
                    data->setCompilationArtist(newartist);
                }
                else
                {
                    data->setArtist(newartist);
                    data->setCompilationArtist("");
                }
            }
        }

        updateTrackList();
    }

    m_artistName = newartist;
}
开发者ID:faginbagin,项目名称:mythtv,代码行数:28,代码来源:cdrip.cpp

示例2: 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();
}
开发者ID:faginbagin,项目名称:mythtv,代码行数:45,代码来源:cdrip.cpp

示例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;
                }
            }
//.........这里部分代码省略.........
开发者ID:tomhughes,项目名称:mythtv,代码行数:101,代码来源:metaioid3.cpp


注:本文中的MusicMetadata::setCompilationArtist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。