本文整理汇总了C++中CSmartPlaylist::GetOrderDirection方法的典型用法代码示例。如果您正苦于以下问题:C++ CSmartPlaylist::GetOrderDirection方法的具体用法?C++ CSmartPlaylist::GetOrderDirection怎么用?C++ CSmartPlaylist::GetOrderDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSmartPlaylist
的用法示例。
在下文中一共展示了CSmartPlaylist::GetOrderDirection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Modify
bool CSmartPlaylistFileItemListModifier::Modify(CFileItemList &items) const
{
if (items.HasProperty(PROPERTY_SORT_ORDER))
return false;
std::string xspOption = GetUrlOption(items.GetPath(), URL_OPTION_XSP);
if (xspOption.empty())
return false;
// check for smartplaylist-specific sorting information
CSmartPlaylist xsp;
if (!xsp.LoadFromJson(xspOption))
return false;
items.SetProperty(PROPERTY_SORT_ORDER, (int)xsp.GetOrder());
items.SetProperty(PROPERTY_SORT_ASCENDING, xsp.GetOrderDirection() == SortOrderAscending);
return true;
}
示例2: GetDirectory
//.........这里部分代码省略.........
musicUrl.RemoveOption(option);
CDatabase::Filter dbfilter;
success = db.GetItems(musicUrl.ToString(), items, dbfilter, sorting);
db.Close();
items.SetProperty(PROPERTY_PATH_DB, musicUrl.ToString());
}
}
if (playlist.GetType() == "musicvideos" || playlist.GetType() == "mixed")
{
CVideoDatabase db;
if (db.Open())
{
CSmartPlaylist mvidPlaylist(playlist);
if (playlist.GetType() == "mixed")
mvidPlaylist.SetType("musicvideos");
std::string baseDir = strBaseDir;
if (baseDir.empty())
{
baseDir = "videodb://musicvideos/";
if (!isGrouped)
baseDir += "titles";
else
baseDir += group;
URIUtils::AddSlashAtEnd(baseDir);
}
CVideoDbUrl videoUrl;
if (!videoUrl.FromString(baseDir))
return false;
// store the smartplaylist as JSON in the URL as well
std::string xsp;
if (!mvidPlaylist.IsEmpty(filter))
{
if (!mvidPlaylist.SaveAsJson(xsp, !filter))
return false;
}
if (!xsp.empty())
videoUrl.AddOption(option, xsp);
else
videoUrl.RemoveOption(option);
CFileItemList items2;
CDatabase::Filter dbfilter;
success2 = db.GetItems(videoUrl.ToString(), items2, dbfilter, sorting);
db.Close();
if (items.Size() <= 0)
items.SetPath(videoUrl.ToString());
items.Append(items2);
if (items2.Size())
{
if (items.Size() > items2.Size())
items.SetContent("mixed");
else
items.SetContent("musicvideos");
}
items.SetProperty(PROPERTY_PATH_DB, videoUrl.ToString());
}
}
items.SetLabel(playlist.GetName());
if (isGrouped)
items.SetContent(group);
else
items.SetContent(playlist.GetType());
items.SetProperty(PROPERTY_SORT_ORDER, (int)playlist.GetOrder());
items.SetProperty(PROPERTY_SORT_ASCENDING, playlist.GetOrderDirection() == SortOrderAscending);
if (!group.empty())
{
items.SetProperty(PROPERTY_GROUP_BY, group);
items.SetProperty(PROPERTY_GROUP_MIXED, playlist.IsGroupMixed());
}
// sort grouped list by label
if (items.Size() > 1 && !group.empty())
items.Sort(SortByLabel, SortOrderAscending, SortAttributeIgnoreArticle);
// go through and set the playlist order
for (int i = 0; i < items.Size(); i++)
{
CFileItemPtr item = items[i];
item->m_iprogramCount = i; // hack for playlist order
}
if (playlist.GetType() == "mixed")
return success || success2;
else if (playlist.GetType() == "musicvideos")
return success2;
else
return success;
}