本文整理汇总了C++中CFileItem::GetURL方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItem::GetURL方法的具体用法?C++ CFileItem::GetURL怎么用?C++ CFileItem::GetURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItem
的用法示例。
在下文中一共展示了CFileItem::GetURL方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Supports
bool CInputStreamAddon::Supports(BinaryAddonBasePtr& addonBase, const CFileItem &fileitem)
{
// check if a specific inputstream addon is requested
CVariant addon = fileitem.GetProperty("inputstreamaddon");
if (!addon.isNull())
return (addon.asString() == addonBase->ID());
// check protocols
std::string protocol = fileitem.GetURL().GetProtocol();
if (!protocol.empty())
{
std::string protocols = addonBase->Type(ADDON_INPUTSTREAM)->GetValue("@protocols").asString();
if (!protocols.empty())
{
std::vector<std::string> protocolsList = StringUtils::Tokenize(protocols, "|");
for (auto& value : protocolsList)
{
StringUtils::Trim(value);
if (value == protocol)
return true;
}
}
}
std::string filetype = fileitem.GetURL().GetFileType();
if (!filetype.empty())
{
std::string extensions = addonBase->Type(ADDON_INPUTSTREAM)->GetValue("@extension").asString();
if (!extensions.empty())
{
std::vector<std::string> extensionsList = StringUtils::Tokenize(extensions, "|");
for (auto& value : extensionsList)
{
StringUtils::Trim(value);
if (value == filetype)
return true;
}
}
}
return false;
}
示例2: Download
void CGUIDialogSubtitles::Download(const CFileItem &subtitle)
{
UpdateStatus(DOWNLOADING);
// subtitle URL should be of the form plugin://<addonid>/?param=foo¶m=bar
// we just append (if not already present) the action=download parameter.
CURL url(subtitle.GetURL());
if (url.GetOption("action").empty())
url.SetOption("action", "download");
AddJob(new CSubtitlesJob(url, subtitle.GetLabel()));
}
示例3: Supports
bool CInputStream::Supports(const CFileItem &fileitem)
{
{
CSingleLock lock(m_parentSection);
auto it = m_configMap.find(ID());
if (it == m_configMap.end())
return false;
if (!it->second.m_ready)
return false;
}
// check if a specific inputstream addon is requested
CVariant addon = fileitem.GetProperty("inputstreamaddon");
if (!addon.isNull())
{
if (addon.asString() != ID())
return false;
else
return true;
}
// check protocols
std::string protocol = fileitem.GetURL().GetProtocol();
if (!protocol.empty())
{
if (std::find(m_protocolsList.begin(),
m_protocolsList.end(), protocol) != m_protocolsList.end())
return true;
}
// check paths
CSingleLock lock(m_parentSection);
auto it = m_configMap.find(ID());
if (it == m_configMap.end())
return false;
bool match = false;
for (auto &path : it->second.m_pathList)
{
if (path.empty())
continue;
CRegExp r(true, CRegExp::asciiOnly, path.c_str());
if (r.RegFind(fileitem.GetPath().c_str()) == 0 && r.GetFindLen() > 5)
{
match = true;
break;
}
}
return match;
}