本文整理汇总了C++中CSmartPlaylist::GetGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ CSmartPlaylist::GetGroup方法的具体用法?C++ CSmartPlaylist::GetGroup怎么用?C++ CSmartPlaylist::GetGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSmartPlaylist
的用法示例。
在下文中一共展示了CSmartPlaylist::GetGroup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnBrowse
//.........这里部分代码省略.........
iLabel = 20360;
}
if (m_type == "musicvideos" || m_type == "mixed")
{
videodatabase.GetMusicVideosNav(basePath + "titles/", items);
iLabel = 20389;
}
}
else if (m_rule.m_field == FieldPlaylist || m_rule.m_field == FieldVirtualFolder)
{
// use filebrowser to grab another smart playlist
// Note: This can cause infinite loops (playlist that refers to the same playlist) but I don't
// think there's any decent way to deal with this, as the infinite loop may be an arbitrary
// number of playlists deep, eg playlist1 -> playlist2 -> playlist3 ... -> playlistn -> playlist1
if (CSmartPlaylist::IsVideoType(m_type))
XFILE::CDirectory::GetDirectory("special://videoplaylists/", items, ".xsp", XFILE::DIR_FLAG_NO_FILE_DIRS);
if (CSmartPlaylist::IsMusicType(m_type))
{
CFileItemList items2;
XFILE::CDirectory::GetDirectory("special://musicplaylists/", items2, ".xsp", XFILE::DIR_FLAG_NO_FILE_DIRS);
items.Append(items2);
}
for (int i = 0; i < items.Size(); i++)
{
CFileItemPtr item = items[i];
CSmartPlaylist playlist;
// don't list unloadable smartplaylists or any referencable smartplaylists
// which do not match the type of the current smartplaylist
if (!playlist.Load(item->GetPath()) ||
(m_rule.m_field == FieldPlaylist &&
(!CSmartPlaylist::CheckTypeCompatibility(m_type, playlist.GetType()) ||
(!playlist.GetGroup().empty() || playlist.IsGroupMixed()))))
{
items.Remove(i);
i -= 1;
continue;
}
if (!playlist.GetName().empty())
item->SetLabel(playlist.GetName());
}
iLabel = 559;
}
else if (m_rule.m_field == FieldPath)
{
VECSOURCES sources;
if (m_type == "songs" || m_type == "mixed")
sources = *CMediaSourceSettings::GetInstance().GetSources("music");
if (CSmartPlaylist::IsVideoType(m_type))
{
VECSOURCES sources2 = *CMediaSourceSettings::GetInstance().GetSources("video");
sources.insert(sources.end(),sources2.begin(),sources2.end());
}
g_mediaManager.GetLocalDrives(sources);
std::string path = m_rule.GetParameter();
CGUIDialogFileBrowser::ShowAndGetDirectory(sources, g_localizeStrings.Get(657), path, false);
if (m_rule.m_parameter.size() > 0)
m_rule.m_parameter.clear();
if (!path.empty())
m_rule.m_parameter.push_back(path);
UpdateButtons();
return;
示例2: 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());
//.........这里部分代码省略.........