本文整理汇总了C++中xfile::CStackDirectory::ConstructStackPath方法的典型用法代码示例。如果您正苦于以下问题:C++ CStackDirectory::ConstructStackPath方法的具体用法?C++ CStackDirectory::ConstructStackPath怎么用?C++ CStackDirectory::ConstructStackPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xfile::CStackDirectory
的用法示例。
在下文中一共展示了CStackDirectory::ConstructStackPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PlayRecording
bool CGUIWindowPVRBase::PlayRecording(CFileItem *item, bool bPlayMinimized /* = false */, bool bCheckResume /* = true */)
{
if (!item->HasPVRRecordingInfoTag())
return false;
std::string stream = item->GetPVRRecordingInfoTag()->m_strStreamURL;
if (stream.empty())
{
if (bCheckResume)
CheckResumeRecording(item);
CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, 0, 0, static_cast<void*>(new CFileItem(*item)));
return true;
}
/* Isolate the folder from the filename */
size_t found = stream.find_last_of("/");
if (found == std::string::npos)
found = stream.find_last_of("\\");
if (found != std::string::npos)
{
/* Check here for asterisk at the begin of the filename */
if (stream[found+1] == '*')
{
/* Create a "stack://" url with all files matching the extension */
std::string ext = URIUtils::GetExtension(stream);
std::string dir = stream.substr(0, found);
CFileItemList items;
XFILE::CDirectory::GetDirectory(dir, items);
items.Sort(SortByFile, SortOrderAscending);
std::vector<int> stack;
for (int i = 0; i < items.Size(); ++i)
{
if (URIUtils::HasExtension(items[i]->GetPath(), ext))
stack.push_back(i);
}
if (stack.empty())
{
/* If we have a stack change the path of the item to it */
XFILE::CStackDirectory dir;
std::string stackPath = dir.ConstructStackPath(items, stack);
item->SetPath(stackPath);
}
}
else
{
/* If no asterisk is present play only the given stream URL */
item->SetPath(stream);
}
}
else
{
CLog::Log(LOGERROR, "CGUIWindowPVRCommon - %s - can't open recording: no valid filename", __FUNCTION__);
CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19036});
return false;
}
if (bCheckResume)
CheckResumeRecording(item);
CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, 0, 0, static_cast<void*>(new CFileItem(*item)));
return true;
}
示例2: GetWithoutUserDetails
CStdString CURL::GetWithoutUserDetails() const
{
CStdString strURL;
if (m_strProtocol.Equals("stack"))
{
CFileItemList items;
CStdString strURL2;
strURL2 = Get();
XFILE::CStackDirectory dir;
dir.GetDirectory(strURL2,items);
vector<CStdString> newItems;
for (int i=0;i<items.Size();++i)
{
CURL url(items[i]->GetPath());
items[i]->SetPath(url.GetWithoutUserDetails());
newItems.push_back(items[i]->GetPath());
}
dir.ConstructStackPath(newItems,strURL);
return strURL;
}
unsigned int sizeneed = m_strProtocol.length()
+ m_strDomain.length()
+ m_strHostName.length()
+ m_strFileName.length()
+ m_strOptions.length()
+ m_strProtocolOptions.length()
+ 10;
strURL.reserve(sizeneed);
if (m_strProtocol == "")
return m_strFileName;
strURL = m_strProtocol;
strURL += "://";
if (m_strHostName != "")
{
if (URIUtils::ProtocolHasParentInHostname(m_strProtocol))
strURL += CURL(m_strHostName).GetWithoutUserDetails();
else
strURL += m_strHostName;
if ( HasPort() )
{
CStdString strPort;
strPort.Format("%i", m_iPort);
strURL += ":";
strURL += strPort;
}
strURL += "/";
}
strURL += m_strFileName;
if( m_strOptions.length() > 0 )
strURL += m_strOptions;
if( m_strProtocolOptions.length() > 0 )
strURL += "|"+m_strProtocolOptions;
return strURL;
}