static void ParseItemRSS(CFileItem* item, SResources& resources, TiXmlElement* item_child, const CStdString& name, const CStdString& xmlns, const CStdString& path) { CStdString text = item_child->GetText(); if (name == "title") { if(text.length() > item->m_strTitle.length()) item->m_strTitle = text; } else if (name == "pubDate") { CDateTime pubDate(ParseDate(text)); item->m_dateTime = pubDate; } else if (name == "link") { SResource res; res.tag = "rss:link"; res.path = text; resources.push_back(res); } else if(name == "enclosure") { const char * url = item_child->Attribute("url"); const char * type = item_child->Attribute("type"); const char * len = item_child->Attribute("length"); SResource res; res.tag = "rss:enclosure"; if(url) res.path = url; if(type) res.mime = type; if(len) res.size = _atoi64(len); resources.push_back(res); } else if(name == "description") { CStdString description = text; HTML::CHTMLUtil::RemoveTags(description); item->SetProperty("description", description); } else if(name == "guid") { if(IsPathToMedia(text)) { SResource res; res.tag = "rss:guid"; res.path = text; resources.push_back(res); } } }
static void ParseItemVoddler(CFileItem* item, SResources& resources, TiXmlElement* element, const std::string& name, const std::string& xmlns, const std::string& path) { CVideoInfoTag* vtag = item->GetVideoInfoTag(); std::string text = GetValue(element); if(name == "trailer") { vtag->m_strTrailer = text; SResource res; res.tag = "voddler:trailer"; res.mime = XMLUtils::GetAttribute(element, "type"); res.path = text; resources.push_back(res); } else if(name == "year") vtag->m_iYear = atoi(text.c_str()); else if(name == "rating") vtag->m_fRating = (float)atof(text.c_str()); else if(name == "tagline") vtag->m_strTagLine = text; else if(name == "posterwall") { const char* url = element->Attribute("url"); if(url) item->SetArt("fanart", url); else if(IsPathToThumbnail(text)) item->SetArt("fanart", text); } }
static void ParseItemVoddler(CFileItem* item, SResources& resources, TiXmlElement* element, const CStdString& name, const CStdString& xmlns) { CVideoInfoTag* vtag = item->GetVideoInfoTag(); CStdString text = element->GetText(); if(name == "trailer") { vtag->m_strTrailer = text; SResource res; res.tag = "voddler:trailer"; res.mime = element->Attribute("type"); res.path = text; resources.push_back(res); } else if(name == "year") vtag->m_iYear = atoi(text); else if(name == "rating") vtag->m_fRating = (float)atof(text); else if(name == "tagline") vtag->m_strTagLine = text; else if(name == "posterwall") { const char* url = element->Attribute("url"); if(url) item->SetProperty("fanart_image", url); else if(IsPathToThumbnail(text)) item->SetProperty("fanart_image", text); } }
static void ParseItemSVT(CFileItem* item, SResources& resources, TiXmlElement* element, const CStdString& name, const CStdString& xmlns) { CStdString text = element->GetText(); if (name == "xmllink") { SResource res; res.tag = "svtplay:xmllink"; res.path = text; res.mime = "application/rss+xml"; resources.push_back(res); } }
static void ParseItemSVT(CFileItem* item, SResources& resources, TiXmlElement* element, const std::string& name, const std::string& xmlns, const std::string& path) { std::string text = GetValue(element); if (name == "xmllink") { SResource res; res.tag = "svtplay:xmllink"; res.path = text; res.mime = "application/rss+xml"; resources.push_back(res); } else if (name == "broadcasts") { CURL url(path); if(StringUtils::StartsWith(url.GetFileName(), "v1/")) { SResource res; res.tag = "svtplay:broadcasts"; res.path = url.GetWithoutFilename() + "v1/video/list/" + text; res.mime = "application/rss+xml"; resources.push_back(res); } } }
static void ParseItemSVT(CFileItem* item, SResources& resources, TiXmlElement* element, const CStdString& name, const CStdString& xmlns, const CStdString& path) { CStdString text = element->GetText(); if (name == "xmllink") { SResource res; res.tag = "svtplay:xmllink"; res.path = text; res.mime = "application/rss+xml"; resources.push_back(res); } else if (name == "broadcasts") { CURL url(path); if(url.GetFileName().Left(3) == "v1/") { SResource res; res.tag = "svtplay:broadcasts"; res.path = url.GetWithoutFilename() + "v1/video/list/" + text; res.mime = "application/rss+xml"; resources.push_back(res); } } }
static void ParseItemMRSS(CFileItem* item, SResources& resources, TiXmlElement* item_child, const std::string& name, const std::string& xmlns, const std::string& path) { CVideoInfoTag* vtag = item->GetVideoInfoTag(); std::string text = GetValue(item_child); if(name == "content") { SResource res; res.tag = "media:content"; res.mime = XMLUtils::GetAttribute(item_child, "type"); res.path = XMLUtils::GetAttribute(item_child, "url"); item_child->Attribute("width", &res.width); item_child->Attribute("height", &res.height); item_child->Attribute("bitrate", &res.bitrate); item_child->Attribute("duration", &res.duration); if(item_child->Attribute("fileSize")) res.size = _atoi64(item_child->Attribute("fileSize")); resources.push_back(res); ParseItem(item, resources, item_child, path); } else if(name == "group") { ParseItem(item, resources, item_child, path); } else if(name == "thumbnail") { if(!item_child->NoChildren() && IsPathToThumbnail(item_child->FirstChild()->ValueStr())) item->SetArt("thumb", item_child->FirstChild()->ValueStr()); else { const char * url = item_child->Attribute("url"); if(url && IsPathToThumbnail(url)) item->SetArt("thumb", url); } } else if (name == "title") { if(text.empty()) return; if(text.length() > item->m_strTitle.length()) item->m_strTitle = text; } else if(name == "description") { if(text.empty()) return; std::string description = text; if(XMLUtils::GetAttribute(item_child, "type") == "html") HTML::CHTMLUtil::RemoveTags(description); item->SetProperty("description", description); } else if(name == "category") { if(text.empty()) return; std::string scheme = XMLUtils::GetAttribute(item_child, "scheme"); /* okey this is silly, boxee what did you think?? */ if (scheme == "urn:boxee:genre") vtag->m_genre.push_back(text); else if(scheme == "urn:boxee:title-type") { if (text == "tv") item->SetProperty("boxee:istvshow", true); else if(text == "movie") item->SetProperty("boxee:ismovie", true); } else if(scheme == "urn:boxee:episode") vtag->m_iEpisode = atoi(text.c_str()); else if(scheme == "urn:boxee:season") vtag->m_iSeason = atoi(text.c_str()); else if(scheme == "urn:boxee:show-title") vtag->m_strShowTitle = text.c_str(); else if(scheme == "urn:boxee:view-count") vtag->m_playCount = atoi(text.c_str()); else if(scheme == "urn:boxee:source") item->SetProperty("boxee:provider_source", text); else vtag->m_genre = StringUtils::Split(text, g_advancedSettings.m_videoItemSeparator); } else if(name == "rating") { std::string scheme = XMLUtils::GetAttribute(item_child, "scheme"); if(scheme == "urn:user") vtag->m_fRating = (float)atof(text.c_str()); else vtag->m_strMPAARating = text; } else if(name == "credit") { std::string role = XMLUtils::GetAttribute(item_child, "role"); if (role == "director") vtag->m_director.push_back(text); else if(role == "author" || role == "writer") vtag->m_writingCredits.push_back(text); else if(role == "actor") { SActorInfo actor; actor.strName = text; vtag->m_cast.push_back(actor); } } else if(name == "copyright") vtag->m_studio = StringUtils::Split(text, g_advancedSettings.m_videoItemSeparator); else if(name == "keywords") item->SetProperty("keywords", text); }
static void ParseItemMRSS(CFileItem* item, SResources& resources, TiXmlElement* item_child, const CStdString& name, const CStdString& xmlns) { CVideoInfoTag* vtag = item->GetVideoInfoTag(); CStdString text = item_child->GetText(); if(name == "content") { SResource res; res.tag = "media:content"; res.mime = item_child->Attribute("type"); res.path = item_child->Attribute("url"); if(item_child->Attribute("width")) res.width = atoi(item_child->Attribute("width")); if(item_child->Attribute("height")) res.height = atoi(item_child->Attribute("height")); if(item_child->Attribute("bitrate")) res.bitrate = atoi(item_child->Attribute("bitrate")); if(item_child->Attribute("duration")) res.duration = atoi(item_child->Attribute("duration")); if(item_child->Attribute("fileSize")) res.size = _atoi64(item_child->Attribute("fileSize")); resources.push_back(res); ParseItem(item, resources, item_child); } else if(name == "group") { ParseItem(item, resources, item_child); } else if(name == "thumbnail") { if(item_child->GetText() && IsPathToThumbnail(item_child->GetText())) item->SetThumbnailImage(item_child->GetText()); else { const char * url = item_child->Attribute("url"); if(url && IsPathToThumbnail(url)) item->SetThumbnailImage(url); } } else if (name == "title") { if(text.IsEmpty()) return; if(text.length() > item->m_strTitle.length()) item->m_strTitle = text; } else if(name == "description") { if(text.IsEmpty()) return; CStdString description = text; if(CStdString(item_child->Attribute("type")) == "html") HTML::CHTMLUtil::RemoveTags(description); item->SetProperty("description", description); } else if(name == "category") { if(text.IsEmpty()) return; CStdString scheme = item_child->Attribute("scheme"); /* okey this is silly, boxee what did you think?? */ if (scheme == "urn:boxee:genre") vtag->m_strGenre = text; else if(scheme == "urn:boxee:title-type") { if (text == "tv") item->SetProperty("boxee:istvshow", true); else if(text == "movie") item->SetProperty("boxee:ismovie", true); } else if(scheme == "urn:boxee:episode") vtag->m_iEpisode = atoi(text.c_str()); else if(scheme == "urn:boxee:season") vtag->m_iSeason = atoi(text.c_str()); else if(scheme == "urn:boxee:show-title") vtag->m_strShowTitle = text.c_str(); else if(scheme == "urn:boxee:view-count") vtag->m_playCount = atoi(text.c_str()); else if(scheme == "urn:boxee:source") item->SetProperty("boxee:provider_source", text); else vtag->m_strGenre = text; } else if(name == "rating") { CStdString scheme = item_child->Attribute("scheme"); if(scheme == "urn:user") vtag->m_fRating = (float)atof(text.c_str()); else vtag->m_strMPAARating = text; } else if(name == "credit") { CStdString role = item_child->Attribute("role"); if (role == "director") vtag->m_strDirector += ", " + text; else if(role == "author" || role == "writer") vtag->m_strWritingCredits += ", " + text; else if(role == "actor") { SActorInfo actor; actor.strName = text; vtag->m_cast.push_back(actor); } } else if(name == "copyright") vtag->m_strStudio = text; else if(name == "keywords") item->SetProperty("keywords", text); }