本文整理汇总了C++中Video::setPublished方法的典型用法代码示例。如果您正苦于以下问题:C++ Video::setPublished方法的具体用法?C++ Video::setPublished怎么用?C++ Video::setPublished使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Video
的用法示例。
在下文中一共展示了Video::setPublished方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Video
void YT3ListParser::parseItem(const QScriptValue &item) {
Video *video = new Video();
QScriptValue id = item.property("id");
if (id.isString()) video->setId(id.toString());
else {
QString videoId = id.property("videoId").toString();
video->setId(videoId);
}
QScriptValue snippet = item.property("snippet");
bool isLiveBroadcastContent = snippet.property("liveBroadcastContent").toString() != QLatin1String("none");
if (isLiveBroadcastContent) {
delete video;
return;
}
QString publishedAt = snippet.property("publishedAt").toString();
QDateTime publishedDateTime = QDateTime::fromString(publishedAt, Qt::ISODate);
video->setPublished(publishedDateTime);
video->setChannelId(snippet.property("channelId").toString());
video->setTitle(snippet.property("title").toString());
video->setDescription(snippet.property("description").toString());
QScriptValue thumbnails = snippet.property("thumbnails");
video->setThumbnailUrl(thumbnails.property("medium").property("url").toString());
video->setMediumThumbnailUrl(thumbnails.property("high").property("url").toString());
video->setChannelTitle(snippet.property("channelTitle").toString());
// These are only for "videos" requests
QScriptValue contentDetails = item.property("contentDetails");
if (contentDetails.isObject()) {
QString isoPeriod = contentDetails.property("duration").toString();
int duration = DataUtils::parseIsoPeriod(isoPeriod);
video->setDuration(duration);
}
QScriptValue statistics = item.property("statistics");
if (statistics.isObject()) {
uint viewCount = statistics.property("viewCount").toUInt32();
video->setViewCount(viewCount);
}
videos.append(video);
}
示例2: readEntry
void YTFeedReader::readEntry() {
Video* video = new Video();
while (!atEnd()) {
readNext();
/*
qDebug() << name();
QXmlStreamAttribute attribute;
foreach (attribute, attributes())
qDebug() << attribute.name() << ":" << attribute.value();
*/
if (isEndElement() && name() == QLatin1String("entry")) break;
if (isStartElement()) {
if (name() == QLatin1String("link")
&& attributes().value("rel").toString() == QLatin1String("alternate")
&& attributes().value("type").toString() == QLatin1String("text/html")
) {
QString webpage = attributes().value("href").toString();
webpage.remove("&feature=youtube_gdata");
video->setWebpage(webpage);
} else if (name() == QLatin1String("author")) {
while(readNextStartElement())
if (name() == QLatin1String("name")) {
QString author = readElementText();
video->setChannelTitle(author);
} else if (name() == QLatin1String("userId")) {
QString userId = readElementText();
video->setChannelId(userId);
} else skipCurrentElement();
} else if (name() == QLatin1String("published")) {
video->setPublished(QDateTime::fromString(readElementText(), Qt::ISODate));
} else if (namespaceUri() == QLatin1String("http://gdata.youtube.com/schemas/2007")
&& name() == QLatin1String("statistics")) {
QString viewCount = attributes().value("viewCount").toString();
video->setViewCount(viewCount.toInt());
}
else if (namespaceUri() == QLatin1String("http://search.yahoo.com/mrss/")
&& name() == QLatin1String("group")) {
// read media group
while (!atEnd()) {
readNext();
if (isEndElement() && name() == QLatin1String("group")) break;
if (isStartElement()) {
if (name() == QLatin1String("thumbnail")) {
// qDebug() << "Thumb: " << attributes().value("url").toString();
QStringRef name = attributes().value("yt:name");
if (name == QLatin1String("mqdefault"))
video->setThumbnailUrl(
attributes().value("url").toString());
else if (name == QLatin1String("hqdefault"))
video->setMediumThumbnailUrl(
attributes().value("url").toString());
}
else if (name() == QLatin1String("title")) {
QString title = readElementText();
// qDebug() << "Title: " << title;
video->setTitle(title);
}
else if (name() == QLatin1String("description")) {
QString desc = readElementText();
// qDebug() << "Description: " << desc;
video->setDescription(desc);
}
else if (name() == QLatin1String("duration")) {
QString duration = attributes().value("seconds").toString();
// qDebug() << "Duration: " << duration;
video->setDuration(duration.toInt());
}
else if (name() == QLatin1String("license")) {
QString license = readElementText();
// qDebug() << "License: " << license;
if (license == QLatin1String("cc"))
video->setLicense(Video::LicenseCC);
}
}
}
}
}
}
videos.append(video);
}
示例3: readEntry
void YouTubeStreamReader::readEntry() {
Video* video = new Video();
// qDebug(" *** ENTRY ***");
while (!atEnd()) {
readNext();
/*
qDebug() << name();
QXmlStreamAttribute attribute;
foreach (attribute, attributes())
qDebug() << attribute.name() << ":" << attribute.value();
*/
if (isEndElement() && name() == "entry") break;
if (isStartElement()) {
if (name() == "link"
&& attributes().value("rel").toString() == "alternate"
&& attributes().value("type").toString() == "text/html"
) {
QString webpage = attributes().value("href").toString();
webpage.remove("&feature=youtube_gdata");
// qDebug() << "Webpage: " << webpage;
video->setWebpage(QUrl(webpage));
} else if (name() == "author") {
readNext();
if (name() == "name") {
QString author = readElementText();
// qDebug() << "Author: " << author;
video->setAuthor(author);
}
} else if (name() == "published") {
video->setPublished(QDateTime::fromString(readElementText(), Qt::ISODate));
} else if (namespaceUri() == "http://gdata.youtube.com/schemas/2007" && name() == "statistics") {
QString viewCount = attributes().value("viewCount").toString();
// qDebug() << "viewCount: " << viewCount;
video->setViewCount(viewCount.toInt());
}
else if (namespaceUri() == "http://search.yahoo.com/mrss/" && name() == "group") {
// read media group
while (!atEnd()) {
readNext();
if (isEndElement() && name() == "group") break;
if (isStartElement()) {
if (name() == "thumbnail") {
// qDebug() << "Thumb: " << attributes().value("url").toString();
// video->thumbnailUrls() << QUrl(attributes().value("url").toString());
video->addThumbnailUrl(QUrl(attributes().value("url").toString()));
}
else if (name() == "title") {
QString title = readElementText();
// qDebug() << "Title: " << title;
video->setTitle(title);
}
else if (name() == "description") {
QString desc = readElementText();
// qDebug() << "Description: " << desc;
video->setDescription(desc);
}
else if (name() == "duration") {
QString duration = attributes().value("seconds").toString();
// qDebug() << "Duration: " << duration;
video->setDuration(duration.toInt());
}
}
}
}
}
}
videos.append(video);
}