本文整理汇总了C++中CFileItemList::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemList::Get方法的具体用法?C++ CFileItemList::Get怎么用?C++ CFileItemList::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemList
的用法示例。
在下文中一共展示了CFileItemList::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void CGUIControlListSetting::Update(bool updateDisplayOnly /* = false */)
{
if (updateDisplayOnly || m_pButton == NULL)
return;
CGUIControlBaseSetting::Update();
CFileItemList options;
bool optionsValid = GetItems(m_pSetting, options);
if (optionsValid && !static_cast<const CSettingControlList*>(m_pSetting->GetControl())->HideValue())
{
std::vector<std::string> labels;
for (int index = 0; index < options.Size(); index++)
{
const CFileItemPtr pItem = options.Get(index);
if (pItem->IsSelected())
labels.push_back(pItem->GetLabel());
}
m_pButton->SetLabel2(StringUtils::Join(labels, ", "));
}
else
m_pButton->SetLabel2(StringUtils::Empty);
// disable the control if it has less than two items
if (!m_pButton->IsDisabled() && options.Size() <= 1)
m_pButton->SetEnabled(false);
}
示例2: AddOrRemove
bool CFavouritesDirectory::AddOrRemove(CFileItem *item, int contextWindow)
{
if (!item) return false;
// load our list
CFileItemList items;
Load(items);
std::string executePath(GetExecutePath(*item, contextWindow));
CFileItemPtr match = items.Get(executePath);
if (match)
{ // remove the item
items.Remove(match.get());
}
else
{ // create our new favourite item
CFileItemPtr favourite(new CFileItem(item->GetLabel()));
if (item->GetLabel().empty())
favourite->SetLabel(CUtil::GetTitleFromPath(item->GetPath(), item->m_bIsFolder));
favourite->SetArt("thumb", item->GetArt("thumb"));
favourite->SetPath(executePath);
items.Add(favourite);
}
// and save our list again
return Save(items);
}
示例3: Update
void CGUIControlListSetting::Update()
{
if (m_pButton == NULL)
return;
CGUIControlBaseSetting::Update();
CFileItemList options;
if (GetItems(m_pSetting, options))
{
std::vector<std::string> labels;
for (int index = 0; index < options.Size(); index++)
{
const CFileItemPtr pItem = options.Get(index);
if (pItem->IsSelected())
labels.push_back(pItem->GetLabel());
}
m_pButton->SetLabel2(StringUtils::Join(labels, ", "));
}
// disable the control if it has less than two items
if (!m_pButton->IsDisabled() && options.Size() <= 1)
m_pButton->SetEnabled(false);
}
示例4: GetTvShowFolders
/**
* \brief Gets a list of folders for recorded TV shows
*/
bool CMythDirectory::GetTvShowFolders(const CStdString& base, CFileItemList &items)
{
cmyth_proglist_t list = m_session->GetAllRecordedPrograms();
if (!list)
{
CLog::Log(LOGERROR, "%s - unable to get list of recordings", __FUNCTION__);
return false;
}
int count = m_dll->proglist_get_count(list);
for (int i = 0; i < count; i++)
{
cmyth_proginfo_t program = m_dll->proglist_get_item(list, i);
if (program)
{
if (!IsVisible(program))
{
m_dll->ref_release(program);
continue;
}
if (!IsTvShow(program))
{
m_dll->ref_release(program);
continue;
}
CStdString title = GetValue(m_dll->proginfo_title(program));
CStdString path = base + "/" + title + "/";
/*
* Only add each TV show once. If the TV show is already in the list, update the date for the
* folder to be the date of the last recorded TV show as the programs are returned in the
* order they were recorded.
*/
if (items.Contains(path))
{
CFileItemPtr item = items.Get(path);
item->m_dateTime = GetValue(m_dll->proginfo_rec_start(program));
}
else
{
CFileItemPtr item(new CFileItem(path, true));
item->m_dateTime = GetValue(m_dll->proginfo_rec_start(program));
item->SetLabel(title);
items.Add(item);
}
m_dll->ref_release(program);
}
}
m_dll->ref_release(list);
items.AddSortMethod(SortByLabel, 551 /* Name */, LABEL_MASKS("", "", "%L", "%J"), CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
items.AddSortMethod(SortByDate, 552 /* Date */, LABEL_MASKS("", "", "%L", "%J"));
return true;
}
示例5: OnPrepareFileItems
void CGUIWindowVideoNav::OnPrepareFileItems(CFileItemList &items)
{
CGUIWindowVideoBase::OnPrepareFileItems(items);
// set fanart
CQueryParams params;
CVideoDatabaseDirectory dir;
dir.GetQueryParams(items.m_strPath,params);
if (params.GetContentType() == VIDEODB_CONTENT_MUSICVIDEOS)
CGUIWindowMusicNav::SetupFanart(items);
NODE_TYPE node = dir.GetDirectoryChildType(items.m_strPath);
// now filter as necessary
bool filterWatched=false;
if (node == NODE_TYPE_EPISODES
|| node == NODE_TYPE_SEASONS
|| node == NODE_TYPE_TITLE_MOVIES
|| node == NODE_TYPE_TITLE_TVSHOWS
|| node == NODE_TYPE_TITLE_MUSICVIDEOS
|| node == NODE_TYPE_RECENTLY_ADDED_EPISODES
|| node == NODE_TYPE_RECENTLY_ADDED_MOVIES
|| node == NODE_TYPE_RECENTLY_ADDED_MUSICVIDEOS)
filterWatched = true;
if (items.IsPlugin())
filterWatched = true;
if (items.IsSmartPlayList())
{
if (items.GetContent() == "tvshows")
node = NODE_TYPE_TITLE_TVSHOWS; // so that the check below works
filterWatched = true;
}
int watchMode = g_settings.GetWatchMode(m_vecItems->GetContent());
for (int i = 0; i < items.Size(); i++)
{
CFileItemPtr item = items.Get(i);
if(item->HasVideoInfoTag() && (node == NODE_TYPE_TITLE_TVSHOWS || node == NODE_TYPE_SEASONS))
{
if (watchMode == VIDEO_SHOW_UNWATCHED)
item->GetVideoInfoTag()->m_iEpisode = item->GetPropertyInt("unwatchedepisodes");
if (watchMode == VIDEO_SHOW_WATCHED)
item->GetVideoInfoTag()->m_iEpisode = item->GetPropertyInt("watchedepisodes");
item->SetProperty("numepisodes", item->GetVideoInfoTag()->m_iEpisode);
}
if(filterWatched)
{
if((watchMode==VIDEO_SHOW_WATCHED && item->GetVideoInfoTag()->m_playCount== 0)
|| (watchMode==VIDEO_SHOW_UNWATCHED && item->GetVideoInfoTag()->m_playCount > 0))
{
items.Remove(i);
i--;
}
}
}
}
示例6: HandleFileItemList
void CFileItemHandler::HandleFileItemList(const char *ID, bool allowFile, const char *resultname, CFileItemList &items, const CVariant ¶meterObject, CVariant &result, int size, bool sortLimit /* = true */)
{
int start, end;
HandleLimits(parameterObject, result, size, start, end);
if (sortLimit)
Sort(items, parameterObject);
else
{
start = 0;
end = items.Size();
}
CThumbLoader *thumbLoader = NULL;
if (end - start > 0)
{
if (items.Get(start)->HasVideoInfoTag())
thumbLoader = new CVideoThumbLoader();
else if (items.Get(start)->HasMusicInfoTag())
thumbLoader = new CMusicThumbLoader();
if (thumbLoader != NULL)
thumbLoader->Initialize();
}
std::set<std::string> fields;
if (parameterObject.isMember("properties") && parameterObject["properties"].isArray())
{
for (CVariant::const_iterator_array field = parameterObject["properties"].begin_array(); field != parameterObject["properties"].end_array(); field++)
fields.insert(field->asString());
}
for (int i = start; i < end; i++)
{
CVariant object;
CFileItemPtr item = items.Get(i);
HandleFileItem(ID, allowFile, resultname, item, parameterObject, fields, result, true, thumbLoader);
}
delete thumbLoader;
}
示例7: GetBroadcastFromBroadcastid
CFileItemPtr CPVROperations::GetBroadcastFromBroadcastid(unsigned int broadcastid)
{
EpgSearchFilter filter;
filter.Reset();
filter.m_iUniqueBroadcastId = broadcastid;
CFileItemList broadcasts;
int resultSize = g_EpgContainer.GetEPGSearch(broadcasts, filter);
if (resultSize != 1)
return CFileItemPtr();
return broadcasts.Get(0);
}
示例8: RemoveDirectory
bool CAddonCallbacksAddon::RemoveDirectory(const void* addonData, const char *strPath)
{
CAddonInterfaces* helper = (CAddonInterfaces*) addonData;
if (!helper)
return false;
// Empty directory
CFileItemList fileItems;
CDirectory::GetDirectory(strPath, fileItems);
for (int i = 0; i < fileItems.Size(); ++i)
CFile::Delete(fileItems.Get(i)->GetPath());
return CDirectory::Remove(strPath);
}
示例9: OnSettingAction
void CPeripherals::OnSettingAction(const CSetting *setting)
{
if (setting == NULL)
return;
const std::string &settingId = setting->GetId();
if (settingId == CSettings::SETTING_INPUT_PERIPHERALS)
{
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
CFileItemList items;
GetDirectory("peripherals://all/", items);
int iPos = -1;
do
{
pDialog->Reset();
pDialog->SetHeading(CVariant{35000});
pDialog->SetUseDetails(true);
pDialog->SetItems(items);
pDialog->SetSelected(iPos);
pDialog->Open();
iPos = pDialog->IsConfirmed() ? pDialog->GetSelectedLabel() : -1;
if (iPos >= 0)
{
CFileItemPtr pItem = items.Get(iPos);
CGUIDialogPeripheralSettings *pSettingsDialog = (CGUIDialogPeripheralSettings *)g_windowManager.GetWindow(WINDOW_DIALOG_PERIPHERAL_SETTINGS);
if (pItem && pSettingsDialog)
{
// pass peripheral item properties to settings dialog so skin authors
// can use it to show more detailed information about the device
pSettingsDialog->SetProperty("vendor", pItem->GetProperty("vendor"));
pSettingsDialog->SetProperty("product", pItem->GetProperty("product"));
pSettingsDialog->SetProperty("bus", pItem->GetProperty("bus"));
pSettingsDialog->SetProperty("location", pItem->GetProperty("location"));
pSettingsDialog->SetProperty("class", pItem->GetProperty("class"));
pSettingsDialog->SetProperty("version", pItem->GetProperty("version"));
// open settings dialog
pSettingsDialog->SetFileItem(pItem.get());
pSettingsDialog->Open();
}
}
} while (pDialog->IsConfirmed());
}
}
示例10: remove_directory
bool Interface_Filesystem::remove_directory(void* kodiBase, const char *path)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
if (addon == nullptr || path == nullptr)
{
CLog::Log(LOGERROR, "Interface_Filesystem::%s - invalid data (addon='%p', path='%p')", __FUNCTION__, kodiBase, path);
return false;
}
// Empty directory
CFileItemList fileItems;
CDirectory::GetDirectory(path, fileItems);
for (int i = 0; i < fileItems.Size(); ++i)
CFile::Delete(fileItems.Get(i)->GetPath());
return CDirectory::Remove(path);
}
示例11: GetFileDetails
JSONRPC_STATUS CFileOperations::GetFileDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
CStdString file = parameterObject["file"].asString();
if (!CFile::Exists(file))
return InvalidParams;
if (!CFileUtils::RemoteAccessAllowed(file))
return InvalidParams;
CStdString path;
URIUtils::GetDirectory(file, path);
CFileItemList items;
if (path.empty() || !CDirectory::GetDirectory(path, items) || !items.Contains(file))
return InvalidParams;
CFileItemPtr item = items.Get(file);
if (!URIUtils::IsUPnP(file))
FillFileItem(item, item, parameterObject["media"].asString(), parameterObject);
// Check if the "properties" list exists
// and make sure it contains the "file"
// field
CVariant param = parameterObject;
if (!param.isMember("properties"))
param["properties"] = CVariant(CVariant::VariantTypeArray);
bool hasFileField = false;
for (CVariant::const_iterator_array itr = param["properties"].begin_array(); itr != param["properties"].end_array(); itr++)
{
if (itr->asString().compare("file") == 0)
{
hasFileField = true;
break;
}
}
if (!hasFileField)
param["properties"].append("file");
param["properties"].append("filetype");
HandleFileItem("id", true, "filedetails", item, parameterObject, param["properties"], result, false);
return OK;
}
示例12: GetFilteredItems
bool CGUIMediaWindow::GetFilteredItems(const CStdString &filter, CFileItemList &items)
{
CStdString trimmedFilter(filter);
trimmedFilter.TrimLeft().ToLower();
if (trimmedFilter.IsEmpty())
return true;
CFileItemList filteredItems;
bool numericMatch = StringUtils::IsNaturalNumber(trimmedFilter);
for (int i = 0; i < items.Size(); i++)
{
CFileItemPtr item = items.Get(i);
if (item->IsParentFolder())
{
filteredItems.Add(item);
continue;
}
// TODO: Need to update this to get all labels, ideally out of the displayed info (ie from m_layout and m_focusedLayout)
// though that isn't practical. Perhaps a better idea would be to just grab the info that we should filter on based on
// where we are in the library tree.
// Another idea is tying the filter string to the current level of the tree, so that going deeper disables the filter,
// but it's re-enabled on the way back out.
CStdString match;
/* if (item->GetFocusedLayout())
match = item->GetFocusedLayout()->GetAllText();
else if (item->GetLayout())
match = item->GetLayout()->GetAllText();
else*/
match = item->GetLabel(); // Filter label only for now
if (numericMatch)
StringUtils::WordToDigits(match);
size_t pos = StringUtils::FindWords(match.c_str(), trimmedFilter.c_str());
if (pos != CStdString::npos)
filteredItems.Add(item);
}
items.ClearItems();
items.Append(filteredItems);
return (items.GetObjectCount() > 0);
}
示例13: HandleFileItemList
void CFileItemHandler::HandleFileItemList(const char *ID, bool allowFile, const char *resultname, CFileItemList &items, const CVariant ¶meterObject, CVariant &result)
{
int size = items.Size();
int start = (int)parameterObject["limits"]["start"].asInteger();
int end = (int)parameterObject["limits"]["end"].asInteger();
end = (end <= 0 || end > size) ? size : end;
start = start > end ? end : start;
Sort(items, parameterObject["sort"]);
result["limits"]["start"] = start;
result["limits"]["end"] = end;
result["limits"]["total"] = size;
for (int i = start; i < end; i++)
{
CVariant object;
CFileItemPtr item = items.Get(i);
HandleFileItem(ID, allowFile, resultname, item, parameterObject, parameterObject["properties"], result);
}
}
示例14: checkRecordings
void fileOps::checkRecordings ( PVR_HANDLE handle )
{
// Experimenting with updating videoinfotag
PVR::CPVRRecordings *someRecordings = (PVR::CPVRRecordings*) handle->dataAddress;
if ((someRecordings->size() > 0) && (isMyth))
{
CFileItemList fileList;
someRecordings->GetRecordings(&fileList);
for (int i=0;i<fileList.Size();i++)
{
PVR::CPVRRecording* pvrTag = fileList.Get(i)->GetPVRRecordingInfoTag();
CStdString iconPath = getArtworkPath(pvrTag->m_strTitle.c_str(),FILE_OPS_GET_COVERART);
if (!iconPath.IsEmpty())
{
someRecordings->UpdateEntry(*pvrTag);
}
}
}
}
示例15: GetBroadcastDetails
JSONRPC_STATUS CPVROperations::GetBroadcastDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
if (!g_PVRManager.IsStarted())
return FailedToExecute;
EpgSearchFilter filter;
filter.Reset();
filter.m_iUniqueBroadcastId = (int)parameterObject["broadcastid"].asInteger();
CFileItemList broadcasts;
int resultSize = g_EpgContainer.GetEPGSearch(broadcasts, filter);
if (resultSize <= 0)
return InvalidParams;
else if (resultSize > 1)
return InternalError;
CFileItemPtr broadcast = broadcasts.Get(0);
HandleFileItem("broadcastid", false, "broadcastdetails", broadcast, parameterObject, parameterObject["properties"], result, false);
return OK;
}