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


C++ Metadata::FormatArtist方法代码示例

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


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

示例1: run

void ReadCDThread::run()
{
#ifndef USING_MINGW
    threadRegister("ReadCD");
    // lock all_music and cd_status_changed while running thread
    QMutexLocker locker(getLock());

    CdDecoder *decoder = new CdDecoder("cda", NULL, NULL, NULL);
    decoder->setDevice(m_CDdevice);
    int tracknum = decoder->getNumCDAudioTracks();

    bool redo = false;

    if (tracknum != gMusicData->all_music->getCDTrackCount())
    {
        cd_status_changed = true;
        LOG(VB_GENERAL, LOG_INFO, QString("CD status has changed."));
    }
    else
        cd_status_changed = false;

    if (tracknum == 0)
    {
        //  No CD, or no recognizable CD
        gMusicData->all_music->clearCDData();
        gMusicData->all_playlists->clearCDList();
    }
    else if (tracknum > 0)
    {
        // Check the last track to see if it's differen than whatever it was
        // before
        Metadata *checker = decoder->getLastMetadata();
        if (checker)
        {
            if (!gMusicData->all_music->checkCDTrack(checker))
            {
                redo = true;
                cd_status_changed = true;
                gMusicData->all_music->clearCDData();
                gMusicData->all_playlists->clearCDList();
            }
            else
                cd_status_changed = false;
            delete checker;
        }
        else
        {
            LOG(VB_GENERAL, LOG_ERR, "The cddecoder said it had audio tracks, "
                                     "but it won't tell me about them");
        }
    }

    int tracks = decoder->getNumTracks();
    bool setTitle = false;

    for (int actual_tracknum = 1;
         redo && actual_tracknum <= tracks; actual_tracknum++)
    {
        Metadata *track = decoder->getMetadata(actual_tracknum);
        if (track)
        {
            gMusicData->all_music->addCDTrack(track);

            if (!setTitle)
            {

                QString parenttitle = " ";
                if (track->FormatArtist().length() > 0)
                {
                    parenttitle += track->FormatArtist();
                    parenttitle += " ~ ";
                }

                if (track->Album().length() > 0)
                    parenttitle += track->Album();
                else
                {
                    parenttitle = " " + QObject::tr("Unknown");
                    LOG(VB_GENERAL, LOG_ERR,
                        "Couldn't find your CD. It may not be in the freedb "
                        "database.\n"
                        "    More likely, however, is that you need to delete\n"
                        "    ~/.cddb and ~/.cdserverrc and restart mythmusic.");
                }
                gMusicData->all_music->setCDTitle(parenttitle);
                setTitle = true;
            }
            delete track;
        }
    }

    delete decoder;
    threadDeregister();
#endif // USING_MINGW
}
开发者ID:txase,项目名称:mythtv,代码行数:95,代码来源:databasebox.cpp

示例2: writeTree


//.........这里部分代码省略.........

    // populate the sort id into the artist map
    uint32_t count = 1;
    for (Iartist = artist_map.begin(); Iartist != artist_map.end(); Iartist++)
    {
        Iartist->second = count;
        count++;
    }

    int RatingWeight = 2;
    int PlayCountWeight = 2;
    int LastPlayWeight = 2;
    int RandomWeight = 2;

    parent->FillIntelliWeights(RatingWeight, PlayCountWeight, LastPlayWeight,
                               RandomWeight);

    for (it = songs.begin(); it != songs.end(); ++it)
    {
        if (!(*it)->getCDFlag())
        {
            if ((*it)->getValue() == 0)
            {
                VERBOSE(VB_IMPORTANT, LOC_ERR + kID0err);
            }
            if ((*it)->getValue() > 0)
            {
                // Normal track
                Metadata *tmpdata =
                    all_available_music->getMetadata((*it)->getValue());
                if (tmpdata && tmpdata->isVisible())
                {
                    QString a_string = QString("%1 ~ %2")
                                       .arg(tmpdata->FormatArtist())
                                       .arg(tmpdata->FormatTitle());
                    GenericTree *added_node = tree_to_write_to->addNode(
                        a_string, (*it)->getValue(), true);
                    ++a_counter;
                    added_node->setAttribute(0, 1);
                    added_node->setAttribute(1, a_counter); //  regular order
                    added_node->setAttribute(2, rand()); //  random order

                    //
                    //  Compute "intelligent" weighting
                    //

                    int rating = tmpdata->Rating();
                    int playcount = tmpdata->PlayCount();
                    double lastplaydbl = tmpdata->LastPlay().toTime_t();
                    double ratingValue = (double)(rating) / 10;
                    double playcountValue, lastplayValue;

                    if (playcountMax == playcountMin)
                        playcountValue = 0;
                    else
                        playcountValue = ((playcountMin - (double)playcount)
                                         / (playcountMax - playcountMin) + 1);

                    if (lastplayMax == lastplayMin)
                        lastplayValue = 0;
                    else
                        lastplayValue = ((lastplayMin - lastplaydbl)
                                        / (lastplayMax - lastplayMin) + 1);

                    double rating_value =  (RatingWeight * ratingValue +
                                            PlayCountWeight * playcountValue +
开发者ID:Cougar,项目名称:mythtv,代码行数:67,代码来源:playlist.cpp


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