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


C++ VideoPtr::FixInfo方法代码示例

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


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

示例1: if

void Parser3::ParseVideoEntry( QDomNode Node, VideoPtr Info ) {

    QDomNode Child = Node.firstChild();

    if( Info->Releated.isNull() ) {
        Info->Releated = new VideoFeed;
        Info->Releated->Type = VideoFeed::FT_VideoReleated;
        Info->Releated->ParsedPages = 0;
        Info->Releated->HasFullFeed = false;
    } if( Info->Responces.isNull() ) {
        Info->Responces = new VideoFeed;
        Info->Responces->Type = VideoFeed::FT_VideoResponses;
        Info->Responces->ParsedPages = 0;
        Info->Responces->HasFullFeed = false;
    }


    while( !Child.isNull() )
    {
        QString NodeName = Child.nodeName();
        if( NodeName == "published" )
        {
            Info->Uploaded = QDate::fromString( Child.namedItem("#text").nodeValue(), Qt::ISODate );
        }
        else if( NodeName == "title" )
        {
            Info->Title = Child.namedItem("#text").nodeValue();
        }
        else if( NodeName == "link" )
        {
            QString RelValue = Child.attributes().namedItem("rel").nodeValue();
            if( RelValue == "http://gdata.youtube.com/schemas/2007#video.responses" )
            {
                Info->Releated->NextPageInFeed = QUrl( Child.attributes().namedItem("href").nodeValue() );
            }
            else if( RelValue == "http://gdata.youtube.com/schemas/2007#video.related" )
            {
                if( Info->Responces.isNull() )
                {
                Info->Responces->NextPageInFeed = QUrl( Child.attributes().namedItem("href").nodeValue() );
            }
            }
        }
        else if( NodeName == "author" )
        {
            Info->Author = Child.namedItem("name").namedItem("#text").nodeValue();
            Info->UrlAuthor = QUrl( Child.namedItem("uri").namedItem("#text").nodeValue() );
        }
        else if( NodeName == "gd:comments" )
        {
            Info->UrlComments = QUrl( Child.namedItem("gd:feedLink").attributes().namedItem("href").nodeValue() );
            Info->Comments = Child.namedItem("gd:feedLink").attributes().namedItem("countHint").nodeValue().toInt();
        }
        else if( NodeName == "media:group" )
        {
            Info->Description = Child.namedItem("media:description").namedItem("#text").nodeValue();
            Info->KeyWords = Child.namedItem("media:keywords").namedItem("#text").nodeValue();
            Info->Length = Child.namedItem("yt:duration").attributes().namedItem("seconds").nodeValue().toInt();
            /// The ID is const, but here we have to change it :/
            const_cast<QString&>( Info->ID ) = Child.namedItem("yt:videoid").namedItem("#text").nodeValue();
        }
        else if( NodeName == "gd:rating" )
        {
            Info->Rating = Child.attributes().namedItem("average").nodeValue().toFloat();
        }
        else if( NodeName == "yt:statistics" )
        {
            Info->Views = Child.attributes().namedItem("viewCount").nodeValue().toInt();
            Info->Favorites = Child.attributes().namedItem("favoriteCount").nodeValue().toInt();
        }
        else if( NodeName == "yt:rating" )
        {
            Info->Likes = Child.attributes().namedItem("numLikes").nodeValue().toInt();
            Info->DisLikes = Child.attributes().namedItem("numDislikes").nodeValue().toInt();
        }

        Child = Child.nextSibling();
    }

    Info->UrlThumbnail = QUrl( "http://i.ytimg.com/vi/"+Info->ID+"/hqdefault.jpg" );

    Info->FixInfo();
    return;
}
开发者ID:Visse,项目名称:QTYoutubeViewer,代码行数:84,代码来源:Parser3.cpp


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