Example #1
0
void CGUIWindowVideoNav::LoadVideoInfo(CFileItemList &items)
{
  // TODO: this could possibly be threaded as per the music info loading,
  //       we could also cache the info
  if (!items.GetContent().IsEmpty())
    return; // don't load for listings that have content set

  CStdString content = m_database.GetContentForPath(items.m_strPath);
  if (content.IsEmpty())
  {
    items.SetContent("files");
    return;
  }
  items.SetContent(content);

  bool clean = (g_guiSettings.GetBool("myvideos.cleanstrings") &&
                !items.IsVirtualDirectoryRoot() &&
                m_stackingAvailable);

  if (!content.IsEmpty())
  {
    for (int i = 0; i < items.Size(); i++)
    {
      CFileItemPtr pItem = items[i];
      CFileItem item;
      if (m_database.GetItemForPath(content, pItem->m_strPath, item))
      { // copy info across
        pItem->UpdateInfo(item);
        // TODO: we may wish to use a playable_url parameter here rather than
        //       switching the path of the item (eg movie as a folder)
        pItem->m_strPath = item.m_strPath;
        pItem->m_bIsFolder = item.m_bIsFolder;
      }
      else
      {
        if (clean)
          pItem->CleanString();
      }
    }
  }
  else
  {
    for (int i = 0; i < items.Size(); i++)
    {
      CFileItemPtr pItem = items[i];
      int playCount = m_database.GetPlayCount(*pItem);
      if (playCount >= 0)
        pItem->SetOverlayImage(CGUIListItem::ICON_OVERLAY_UNWATCHED, playCount > 0);
      if (clean)
        pItem->CleanString();
    }
  }
}
void CGUIWindowVideoFiles::OnPrepareFileItems(CFileItemList &items)
{
  CGUIWindowVideoBase::OnPrepareFileItems(items);
  if (g_guiSettings.GetBool("myvideos.cleanfilenames"))
  {
    for (int i = 0; i < (int)items.Size(); ++i)
    {
      CFileItemPtr item = items[i];
      if ((item->m_bIsFolder && !CUtil::IsInArchive(item->m_strPath)) || m_cleaningAvailable)
        item->CleanString();
    }
  }
}