当前位置: 首页>>代码示例>>C++>>正文


C++ CFileItemList::Remove方法代码示例

本文整理汇总了C++中CFileItemList::Remove方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemList::Remove方法的具体用法?C++ CFileItemList::Remove怎么用?C++ CFileItemList::Remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFileItemList的用法示例。


在下文中一共展示了CFileItemList::Remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FilterRecordings

int EpgSearchFilter::FilterRecordings(CFileItemList &results)
{
    int iRemoved(0);
    if (!g_PVRManager.IsStarted())
        return iRemoved;

    CFileItemList recordings;
    g_PVRRecordings->GetAll(recordings);

    // TODO inefficient!
    CPVRRecordingPtr recording;
    for (int iRecordingPtr = 0; iRecordingPtr < recordings.Size(); iRecordingPtr++)
    {
        recording = recordings.Get(iRecordingPtr)->GetPVRRecordingInfoTag();
        if (!recording)
            continue;

        for (int iResultPtr = 0; iResultPtr < results.Size(); iResultPtr++)
        {
            const CEpgInfoTagPtr epgentry(results.Get(iResultPtr)->GetEPGInfoTag());

            /* no match */
            if (!epgentry ||
                    epgentry->Title() != recording->m_strTitle ||
                    epgentry->Plot()  != recording->m_strPlot)
                continue;

            results.Remove(iResultPtr);
            iResultPtr--;
            ++iRemoved;
        }
    }

    return iRemoved;
}
开发者ID:ncvann,项目名称:xbmc,代码行数:35,代码来源:EpgSearchFilter.cpp

示例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);
}
开发者ID:AchimTuran,项目名称:xbmc,代码行数:28,代码来源:FavouritesDirectory.cpp

示例3: BindItems

void CLocalFilesSource::BindItems(CFileItemList& items)
{
  // Perform post processing here
  // Need to default video content to help with the UPnP case where we don't really know the content type
  bool bDefaultVideo = false;

  if( items.m_strPath.Equals("boxeedb://unresolvedVideoFiles") )
    bDefaultVideo = true;

  for (int i = 0 ; i < items.Size() ; i++)
  {
    CFileItemPtr pItem = items[i];

    if (pItem->IsVideo() || bDefaultVideo)
    {
      pItem->SetProperty("IsVideo", true);
    }
    else if (pItem->IsAudio())
    {
      pItem->SetProperty("IsMusic", true);
    }
    else if (pItem->IsPicture())
    {
      pItem->SetProperty("IsPhotos", true);
    }
    else if (!pItem->m_bIsFolder)
    {
      items.Remove(i);
      i--;
    }
  }

  CBrowseWindowSource::BindItems(items);
}
开发者ID:Kr0nZ,项目名称:boxee,代码行数:34,代码来源:GUIWindowBoxeeBrowseLocal.cpp

示例4: FilterDirectory

bool CPVRChannelGroupsContainer::FilterDirectory(const CURL &url, CFileItemList &results) const
{
    if (!results.IsEmpty())
    {
        if (url.HasOption("view"))
        {
            const std::string view(url.GetOption("view"));
            if (view == "lastplayed")
            {
                // remove channels never played so far
                for (int i = 0; i < results.Size(); ++i)
                {
                    const CPVRChannelPtr channel(results.Get(i)->GetPVRChannelInfoTag());
                    time_t lastWatched = channel->LastWatched();
                    if (!lastWatched)
                    {
                        results.Remove(i);
                        --i;
                    }
                }
            }
            else
            {
                CLog::Log(LOGERROR, "CPVRChannelGroupsContainer - %s - unsupported value '%s' for url parameter 'view'", __FUNCTION__, view.c_str());
                return false;
            }
        }
    }
    return true;
}
开发者ID:mhueske,项目名称:xbmc,代码行数:30,代码来源:PVRChannelGroupsContainer.cpp

示例5: RemoveDuplicates

int CPVREpgSearchFilter::RemoveDuplicates(CFileItemList &results)
{
  unsigned int iSize = results.Size();

  for (unsigned int iResultPtr = 0; iResultPtr < iSize; iResultPtr++)
  {
    const CPVREpgInfoTagPtr epgentry_1(results.Get(iResultPtr)->GetEPGInfoTag());
    if (!epgentry_1)
      continue;

    for (unsigned int iTagPtr = 0; iTagPtr < iSize; iTagPtr++)
    {
      if (iResultPtr == iTagPtr)
        continue;

      const CPVREpgInfoTagPtr epgentry_2(results.Get(iTagPtr)->GetEPGInfoTag());
      if (!epgentry_2)
        continue;

      if (epgentry_1->Title()       != epgentry_2->Title() ||
          epgentry_1->Plot()        != epgentry_2->Plot() ||
          epgentry_1->PlotOutline() != epgentry_2->PlotOutline())
        continue;

      results.Remove(iTagPtr);
      iResultPtr--;
      iTagPtr--;
      iSize--;
    }
  }

  return iSize;
}
开发者ID:HitcherUK,项目名称:xbmc,代码行数:33,代码来源:EpgSearchFilter.cpp

示例6: FilterTimers

int EpgSearchFilter::FilterTimers(CFileItemList &results)
{
    int iRemoved(0);
    if (!g_PVRManager.IsStarted())
        return iRemoved;

    std::vector<CFileItemPtr> timers = g_PVRTimers->GetActiveTimers();
    // TODO inefficient!
    for (unsigned int iTimerPtr = 0; iTimerPtr < timers.size(); iTimerPtr++)
    {
        CFileItemPtr fileItem = timers.at(iTimerPtr);
        if (!fileItem || !fileItem->HasPVRTimerInfoTag())
            continue;

        CPVRTimerInfoTagPtr timer = fileItem->GetPVRTimerInfoTag();
        if (!timer)
            continue;

        for (int iResultPtr = 0; iResultPtr < results.Size(); iResultPtr++)
        {
            const CEpgInfoTagPtr epgentry(results.Get(iResultPtr)->GetEPGInfoTag());
            if (!epgentry ||
                    *epgentry->ChannelTag() != *timer->ChannelTag() ||
                    epgentry->StartAsUTC()   <  timer->StartAsUTC() ||
                    epgentry->EndAsUTC()     >  timer->EndAsUTC())
                continue;

            results.Remove(iResultPtr);
            iResultPtr--;
            ++iRemoved;
        }
    }

    return iRemoved;
}
开发者ID:ncvann,项目名称:xbmc,代码行数:35,代码来源:EpgSearchFilter.cpp

示例7: OnPostUnInstall

void CAddonUnInstallJob::OnPostUnInstall()
{
  if (m_addon->Type() == ADDON_REPOSITORY)
  {
    CAddonDatabase database;
    database.Open();
    database.DeleteRepository(m_addon->ID());
  }

  bool bSave(false);
  CFileItemList items;
  XFILE::CFavouritesDirectory::Load(items);
  for (int i=0; i < items.Size(); ++i)
  {
    if (items[i]->GetPath().find(m_addon->ID()) != std::string::npos)
    {
      items.Remove(items[i].get());
      bSave = true;
    }
  }

  if (bSave)
    CFavouritesDirectory::Save(items);

  if (m_addon->Type() == ADDON_PVRDLL)
  {
    if (CSettings::Get().GetBool("pvrmanager.enabled"))
      PVR::CPVRManager::Get().Start(true);
  }
}
开发者ID:BimBamBoum,项目名称:xbmc,代码行数:30,代码来源:AddonInstaller.cpp

示例8: AddOrRemove

bool CFavourites::AddOrRemove(CFileItem *item, int contextWindow)
{
  if (!item) return false;

  // load our list
  CFileItemList items;
  Load(items);

  CStdString 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().IsEmpty())
      favourite->SetLabel(CUtil::GetTitleFromPath(item->m_strPath, item->m_bIsFolder));
    favourite->SetThumbnailImage(item->GetThumbnailImage());
    favourite->m_strPath = executePath;
    items.Add(favourite);
  }

  // and save our list again
  return Save(items);
}
开发者ID:Bobbin007,项目名称:xbmc,代码行数:28,代码来源:Favourites.cpp

示例9: 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--;
      }
    }
  }
}
开发者ID:Bobbin007,项目名称:xbmc,代码行数:58,代码来源:GUIWindowVideoNav.cpp

示例10: OnLinkMovieToTvShow

void CGUIWindowVideoNav::OnLinkMovieToTvShow(int itemnumber, bool bRemove)
{
  CFileItemList list;
  if (bRemove)
  {
    vector<int> ids;
    if (!m_database.GetLinksToTvShow(m_vecItems->Get(itemnumber)->GetVideoInfoTag()->m_iDbId,ids))
      return;
    for (unsigned int i=0;i<ids.size();++i)
    {
      CVideoInfoTag tag;
      m_database.GetTvShowInfo("",tag,ids[i]);
      CFileItemPtr show(new CFileItem(tag));
      list.Add(show);
    }
  }
  else
  {
    m_database.GetTvShowsNav("videodb://2/2",list);

    // remove already linked shows
    vector<int> ids;
    if (!m_database.GetLinksToTvShow(m_vecItems->Get(itemnumber)->GetVideoInfoTag()->m_iDbId,ids))
      return;
    for (int i=0;i<list.Size();)
    {
      unsigned int j;
      for (j=0;j<ids.size();++j)
      {
        if (list[i]->GetVideoInfoTag()->m_iDbId == ids[j])
          break;
      }
      if (j == ids.size())
        i++;
      else
        list.Remove(i);
    }
  }
  int iSelectedLabel = 0;
  if (list.Size() > 1)
  {
    list.Sort(g_guiSettings.GetBool("filelists.ignorethewhensorting") ? SORT_METHOD_LABEL_IGNORE_THE : SORT_METHOD_LABEL, SORT_ORDER_ASC);
    CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
    pDialog->Reset();
    pDialog->SetItems(&list);
    pDialog->SetHeading(20356);
    pDialog->DoModal();
    iSelectedLabel = pDialog->GetSelectedLabel();
  }
  if (iSelectedLabel > -1)
  {
    m_database.LinkMovieToTvshow(m_vecItems->Get(itemnumber)->GetVideoInfoTag()->m_iDbId,
                                 list[iSelectedLabel]->GetVideoInfoTag()->m_iDbId, bRemove);
    CUtil::DeleteVideoDatabaseDirectoryCache();
  }
}
开发者ID:Bobbin007,项目名称:xbmc,代码行数:56,代码来源:GUIWindowVideoNav.cpp

示例11: GetDirectory

bool CGUIWindowScripts::GetDirectory(const CStdString& strDirectory, CFileItemList& items)
{
  if (!CGUIMediaWindow::GetDirectory(strDirectory,items))
    return false;

  // flatten any folders
  for (int i = 0; i < items.Size(); i++)
  {
    CFileItemPtr item = items[i];
    if (item->m_bIsFolder && !item->IsParentFolder() && !item->m_bIsShareOrDrive && !item->GetLabel().Left(1).Equals("."))
    { // folder item - let's check for a default.py file, and flatten if we have one
      CStdString defaultPY;
      
      // If using a multipath directory, get the first path
      CStdString firstPath;
      if (CUtil::IsMultiPath(item->m_strPath)) firstPath = CMultiPathDirectory::GetFirstPath(item->m_strPath);
      else firstPath = item->m_strPath;
      
      CUtil::AddFileToFolder(firstPath, "default.py", defaultPY);
      if (!CFile::Exists(defaultPY)) {
         CUtil::AddFileToFolder(firstPath, "Default.py", defaultPY);
         if (!CFile::Exists(defaultPY)) {
            CUtil::AddFileToFolder(firstPath, "DEFAULT.PY", defaultPY);
         }
      }

      if (CFile::Exists(defaultPY))
      { // yes, format the item up
        item->m_strPath = defaultPY;
        item->m_bIsFolder = false;
        item->FillInDefaultIcon();
        item->SetLabelPreformated(true);
      }
    }
    if (item->GetLabel().Equals("autoexec.py") || (item->GetLabel().Left(1).Equals(".") && !item->IsParentFolder()))
    {
      items.Remove(i);
      i--;
    }
		// Remove extension & set thumbnail AppleScripts
		CStdString itemLabel = item->GetLabel();
		if (CUtil::GetExtension(itemLabel) == ".applescript")
		{
			CUtil::RemoveExtension(itemLabel);
			item->SetLabel(itemLabel);
			item->SetThumbnailImage(Cocoa_GetIconFromBundle("/Applications/AppleScript/Script Editor.app", "SECompiledScript"));
		}
  }

  items.SetProgramThumbs();

  return true;
}
开发者ID:Castlecard,项目名称:plex,代码行数:53,代码来源:GUIWindowScripts.cpp

示例12: OnPrepareFileItems

void CGUIWindowPictures::OnPrepareFileItems(CFileItemList& items)
{
  CGUIMediaWindow::OnPrepareFileItems(items);

  for (int i=0;i<items.Size();++i )
    if (items[i]->GetLabel().Equals("folder.jpg"))
      items.Remove(i);

  if (items.GetFolderCount()==items.Size() || !CSettings::Get().GetBool("pictures.usetags"))
    return;

  // Start the music info loader thread
  CPictureInfoLoader loader;
  loader.SetProgressCallback(m_dlgProgress);
  loader.Load(items);

  bool bShowProgress=!g_windowManager.HasModalDialog();
  bool bProgressVisible=false;

  unsigned int tick=XbmcThreads::SystemClockMillis();

  while (loader.IsLoading() && m_dlgProgress && !m_dlgProgress->IsCanceled())
  {
    if (bShowProgress)
    { // Do we have to init a progress dialog?
      unsigned int elapsed=XbmcThreads::SystemClockMillis()-tick;

      if (!bProgressVisible && elapsed>1500 && m_dlgProgress)
      { // tag loading takes more then 1.5 secs, show a progress dialog
        CURL url(items.GetPath());

        m_dlgProgress->SetHeading(189);
        m_dlgProgress->SetLine(0, 505);
        m_dlgProgress->SetLine(1, "");
        m_dlgProgress->SetLine(2, url.GetWithoutUserDetails());
        m_dlgProgress->StartModal();
        m_dlgProgress->ShowProgressBar(true);
        bProgressVisible = true;
      }

      if (bProgressVisible && m_dlgProgress)
      { // keep GUI alive
        m_dlgProgress->Progress();
      }
    } // if (bShowProgress)
    Sleep(1);
  } // while (loader.IsLoading())

  if (bProgressVisible && m_dlgProgress)
    m_dlgProgress->Close();
}
开发者ID:CybeSystems,项目名称:XBMCPortable,代码行数:51,代码来源:GUIWindowPictures.cpp

示例13: OnPrepareFileItems

void CGUIWindowPictures::OnPrepareFileItems(CFileItemList& items)
{
  CGUIMediaWindow::OnPrepareFileItems(items);

  for (int i=0;i<items.Size();++i )
    if (StringUtils::EqualsNoCase(items[i]->GetLabel(), "folder.jpg"))
      items.Remove(i);

  if (items.GetFolderCount() == items.Size() || !CServiceBroker::GetSettings().GetBool(CSettings::SETTING_PICTURES_USETAGS))
    return;

  // Start the music info loader thread
  CPictureInfoLoader loader;
  loader.SetProgressCallback(m_dlgProgress);
  loader.Load(items);

  bool bShowProgress = !CServiceBroker::GetGUI()->GetWindowManager().HasModalDialog(true);
  bool bProgressVisible = false;

  unsigned int tick=XbmcThreads::SystemClockMillis();

  while (loader.IsLoading() && m_dlgProgress && !m_dlgProgress->IsCanceled())
  {
    if (bShowProgress)
    { // Do we have to init a progress dialog?
      unsigned int elapsed=XbmcThreads::SystemClockMillis()-tick;

      if (!bProgressVisible && elapsed>1500 && m_dlgProgress)
      { // tag loading takes more then 1.5 secs, show a progress dialog
        CURL url(items.GetPath());

        m_dlgProgress->SetHeading(CVariant{189});
        m_dlgProgress->SetLine(0, CVariant{505});
        m_dlgProgress->SetLine(1, CVariant{""});
        m_dlgProgress->SetLine(2, CVariant{url.GetWithoutUserDetails()});
        m_dlgProgress->Open();
        m_dlgProgress->ShowProgressBar(true);
        bProgressVisible = true;
      }

      if (bProgressVisible && m_dlgProgress)
      { // keep GUI alive
        m_dlgProgress->Progress();
      }
    } // if (bShowProgress)
    Sleep(1);
  } // while (loader.IsLoading())

  if (bProgressVisible && m_dlgProgress)
    m_dlgProgress->Close();
}
开发者ID:Arcko,项目名称:xbmc,代码行数:51,代码来源:GUIWindowPictures.cpp

示例14: GetDirectory

bool CGUIWindowAddonBrowser::GetDirectory(const std::string& strDirectory, CFileItemList& items)
{
  bool result = CGUIMediaWindow::GetDirectory(strDirectory, items);

  if (result && CAddonsDirectory::IsRepoDirectory(CURL(strDirectory)))
  {
    if (CServiceBroker::GetSettings().GetBool(CSettings::SETTING_GENERAL_ADDONFOREIGNFILTER))
    {
      int i = 0;
      while (i < items.Size())
      {
        auto prop = items[i]->GetProperty("Addon.Language");
        if (!prop.isNull() && IsForeign(prop.asString()))
          items.Remove(i);
        else
          ++i;
      }
    }
    if (CServiceBroker::GetSettings().GetBool(CSettings::SETTING_GENERAL_ADDONBROKENFILTER))
    {
      for (int i = items.Size() - 1; i >= 0; i--)
      {
        if (items[i]->GetAddonInfo() && !items[i]->GetAddonInfo()->Broken().empty())
        {
          //check if it's installed
          AddonPtr addon;
          if (!CAddonMgr::GetInstance().GetAddon(items[i]->GetProperty("Addon.ID").asString(), addon))
            items.Remove(i);
        }
      }
    }
  }

  for (int i = 0; i < items.Size(); ++i)
    UpdateStatus(items[i]);

  return result;
}
开发者ID:LS80,项目名称:xbmc,代码行数:38,代码来源:GUIWindowAddonBrowser.cpp

示例15: BindItems

void CMyAppsSource::BindItems(CFileItemList& items)
{
  // Perform post processing here
  CBrowseWindowPropertyValueFilter* filter = NULL;

  if (m_mapFilters.find("apptype") != m_mapFilters.end())
  {
    CStdString filtername = m_mapFilters["apptype"];

    if (filtername != "")
    {

      if (filtername == "video")
      {
        filter = new CBrowseWindowPropertyValueFilter(FILTER_APPS_VIDEO_ID, FILTER_APPS_VIDEO_NAME, "app-media", "video");
      }
      else if (filtername == "music")
      {
        filter = new CBrowseWindowPropertyValueFilter(FILTER_APPS_MUSIC_ID, FILTER_APPS_MUSIC_NAME, "app-media", "music");
      }
      else if (filtername == "pictures")
      {
        filter = new CBrowseWindowPropertyValueFilter(FILTER_APPS_PICTURES_ID, FILTER_APPS_PICTURES_NAME, "app-media", "pictures");
      }

      if (filter != NULL)
      {
        int i = 0;

        while (i < items.Size())
        {
          if (filter->Apply(&*items[i]) != true)
          {//need to remove this item
            items.Remove(i);
          }
          else
          {
            i++;
          }
        }

        delete filter;
      }
    }
  }

  CBrowseWindowSource::BindItems(items);
}
开发者ID:marksuman,项目名称:boxee,代码行数:48,代码来源:GUIWindowBoxeeBrowseApps.cpp


注:本文中的CFileItemList::Remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。