本文整理汇总了C++中CSmartPlaylist::GetVirtualFolders方法的典型用法代码示例。如果您正苦于以下问题:C++ CSmartPlaylist::GetVirtualFolders方法的具体用法?C++ CSmartPlaylist::GetVirtualFolders怎么用?C++ CSmartPlaylist::GetVirtualFolders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSmartPlaylist
的用法示例。
在下文中一共展示了CSmartPlaylist::GetVirtualFolders方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDirectory
bool CSmartPlaylistDirectory::GetDirectory(const CSmartPlaylist &playlist, CFileItemList& items, const std::string &strBaseDir /* = "" */, bool filter /* = false */)
{
bool success = false, success2 = false;
std::vector<std::string> virtualFolders;
SortDescription sorting;
sorting.limitEnd = playlist.GetLimit();
sorting.sortBy = playlist.GetOrder();
sorting.sortOrder = playlist.GetOrderAscending() ? SortOrderAscending : SortOrderDescending;
sorting.sortAttributes = playlist.GetOrderAttributes();
if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
sorting.sortAttributes = (SortAttribute)(sorting.sortAttributes | SortAttributeIgnoreArticle);
items.SetSortIgnoreFolders((sorting.sortAttributes & SortAttributeIgnoreFolders) == SortAttributeIgnoreFolders);
std::string option = !filter ? "xsp" : "filter";
const std::string& group = playlist.GetGroup();
bool isGrouped = !group.empty() && !StringUtils::EqualsNoCase(group, "none") && !playlist.IsGroupMixed();
// get all virtual folders and add them to the item list
playlist.GetVirtualFolders(virtualFolders);
for (std::vector<std::string>::const_iterator virtualFolder = virtualFolders.begin(); virtualFolder != virtualFolders.end(); virtualFolder++)
{
CFileItemPtr pItem = CFileItemPtr(new CFileItem(*virtualFolder, true));
IFileDirectory *dir = CFileDirectoryFactory::Create(pItem->GetURL(), pItem.get());
if (dir != NULL)
{
pItem->SetSpecialSort(SortSpecialOnTop);
items.Add(pItem);
delete dir;
}
}
if (playlist.GetType() == "movies" ||
playlist.GetType() == "tvshows" ||
playlist.GetType() == "episodes")
{
CVideoDatabase db;
if (db.Open())
{
MediaType mediaType = MediaTypes::FromString(playlist.GetType());
std::string baseDir = strBaseDir;
if (strBaseDir.empty())
{
if (mediaType == MediaTypeTvShow || mediaType == MediaTypeEpisode)
baseDir = "videodb://tvshows/";
else if (mediaType == MediaTypeMovie)
baseDir = "videodb://movies/";
else
return false;
if (!isGrouped)
baseDir += "titles";
else
baseDir += group;
URIUtils::AddSlashAtEnd(baseDir);
if (mediaType == MediaTypeEpisode)
baseDir += "-1/-1/";
}
CVideoDbUrl videoUrl;
if (!videoUrl.FromString(baseDir))
return false;
// store the smartplaylist as JSON in the URL as well
std::string xsp;
if (!playlist.IsEmpty(filter))
{
if (!playlist.SaveAsJson(xsp, !filter))
return false;
}
if (!xsp.empty())
videoUrl.AddOption(option, xsp);
else
videoUrl.RemoveOption(option);
CDatabase::Filter dbfilter;
success = db.GetItems(videoUrl.ToString(), items, dbfilter, sorting);
db.Close();
// if we retrieve a list of episodes and we didn't receive
// a pre-defined base path, we need to fix it
if (strBaseDir.empty() && mediaType == MediaTypeEpisode && !isGrouped)
videoUrl.AppendPath("-1/-1/");
items.SetProperty(PROPERTY_PATH_DB, videoUrl.ToString());
}
}
else if (playlist.IsMusicType() || playlist.GetType().empty())
{
CMusicDatabase db;
if (db.Open())
{
CSmartPlaylist plist(playlist);
if (playlist.GetType() == "mixed" || playlist.GetType().empty())
plist.SetType("songs");
MediaType mediaType = MediaTypes::FromString(plist.GetType());
//.........这里部分代码省略.........