本文整理汇总了C++中CSmartPlaylist::LoadFromJson方法的典型用法代码示例。如果您正苦于以下问题:C++ CSmartPlaylist::LoadFromJson方法的具体用法?C++ CSmartPlaylist::LoadFromJson怎么用?C++ CSmartPlaylist::LoadFromJson使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSmartPlaylist
的用法示例。
在下文中一共展示了CSmartPlaylist::LoadFromJson方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDirectory
bool CGUIWindowMusicBase::GetDirectory(const CStdString &strDirectory, CFileItemList &items)
{
CStdString directory = strDirectory;
// check if the path contains a filter and if so load it and
// remove it from the path to get proper GUI view states etc
CSmartPlaylist filterXsp;
CMusicDbUrl musicUrl;
if (musicUrl.FromString(strDirectory))
{
CVariant filter;
if (musicUrl.GetOption("filter", filter))
{
// load the filter and if it's type does not match the
// path's item type reset it
if (filterXsp.LoadFromJson(filter.asString()) && !filterXsp.GetType().Equals(musicUrl.GetType().c_str()))
filterXsp.Reset();
// remove the "filter" option from the path
musicUrl.AddOption("filter", "");
}
directory = musicUrl.ToString();
}
items.SetArt("thumb", "");
bool bResult = CGUIMediaWindow::GetDirectory(directory, items);
if (bResult)
CMusicThumbLoader::FillThumb(items);
// (re-)apply the previously retrieved filter
// because it was reset in CGUIMediaWindow::GetDirectory()
if (!filterXsp.IsEmpty())
m_filter = filterXsp;
// add in the "New Playlist" item if we're in the playlists folder
if ((items.GetPath() == "special://musicplaylists/") && !items.Contains("newplaylist://"))
{
CFileItemPtr newPlaylist(new CFileItem(g_settings.GetUserDataItem("PartyMode.xsp"),false));
newPlaylist->SetLabel(g_localizeStrings.Get(16035));
newPlaylist->SetLabelPreformated(true);
newPlaylist->m_bIsFolder = true;
items.Add(newPlaylist);
newPlaylist.reset(new CFileItem("newplaylist://", false));
newPlaylist->SetLabel(g_localizeStrings.Get(525));
newPlaylist->SetLabelPreformated(true);
newPlaylist->SetSpecialSort(SortSpecialOnBottom);
newPlaylist->SetCanQueue(false);
items.Add(newPlaylist);
newPlaylist.reset(new CFileItem("newsmartplaylist://music", false));
newPlaylist->SetLabel(g_localizeStrings.Get(21437));
newPlaylist->SetLabelPreformated(true);
newPlaylist->SetSpecialSort(SortSpecialOnBottom);
newPlaylist->SetCanQueue(false);
items.Add(newPlaylist);
}
return bResult;
}
示例2: 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;
}
示例3: validateOption
bool CMusicDbUrl::validateOption(const std::string &key, const CVariant &value)
{
if (!CDbUrl::validateOption(key, value))
return false;
// if the value is empty it will remove the option which is ok
// otherwise we only care about the "filter" option here
if (value.empty() || !StringUtils::EqualsNoCase(key, "filter"))
return true;
if (!value.isString())
return false;
CSmartPlaylist xspFilter;
if (!xspFilter.LoadFromJson(value.asString()))
return false;
// check if the filter playlist matches the item type
return xspFilter.GetType() == m_type;
}