Repository: xbmc/xbmc
File: xbmc/video/windows/GUIWindowVideoBase.cpp (C++)

Code before:

      if (VIDEO::IsVideoDb(*item) && item->HasVideoInfoTag())
        item->SetPath(item->GetVideoInfoTag()->GetPath());
    }
    listNeedsUpdating = true;
  } while (needsRefresh);

  return listNeedsUpdating;
}

bool CGUIWindowVideoBase::ShowInfoAndRefresh(const CFileItemPtr& item, const ScraperPtr& info)
{
  const int ret{ShowInfo(item, info)};

  // Test IsActive() since we can be called from other windows (music, home) we need this check
  if (ret && IsActive())
  {
    const int itemNumber{m_viewControl.GetSelectedItem()};
    Refresh();
    m_viewControl.SetSelectedItem(itemNumber);
  }

  CVariant data;
  data["id"] = item->GetVideoInfoTag()->m_iDbId;
  data["type"] = item->GetVideoInfoTag()->m_type;
  CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::VideoLibrary, "OnUpdate", data);

  return ret;
}

void CGUIWindowVideoBase::OnQueueItem(int iItem, bool first)
{
  if (iItem < 0 || iItem >= m_vecItems->Size())
    return;

  OnQueueItem(m_vecItems->Get(iItem), iItem, first);
}

void CGUIWindowVideoBase::OnQueueItem(const std::shared_ptr<CFileItem>& item, int iItem, bool first)
{
  // don't re-queue items from playlist window
  if (GetID() == WINDOW_VIDEO_PLAYLIST)
    return;

  if (item->IsRAR() || item->IsZIP())
    return;

  VIDEO::UTILS::QueueItem(item, first ? VIDEO::UTILS::QueuePosition::POSITION_BEGIN
                                      : VIDEO::UTILS::QueuePosition::POSITION_END);

  // select next item

Review comment (suggestion):
I don't doubt this fixes the issue but the announce for videolibrary update is being done by a GUI window when it should be done by the actual library component...
Any chance you can find out a proper place for the announce?
Thanks for tackling some of our open issues! It's greatly appreciated

Code after:
      if (VIDEO::IsVideoDb(*item) && item->HasVideoInfoTag())
        item->SetPath(item->GetVideoInfoTag()->GetPath());
    }
    listNeedsUpdating = true;
  } while (needsRefresh);

  return listNeedsUpdating;
}

bool CGUIWindowVideoBase::ShowInfoAndRefresh(const CFileItemPtr& item, const ScraperPtr& info)
{
  const int ret{ShowInfo(item, info)};

  // Test IsActive() since we can be called from other windows (music, home) we need this check
  if (ret && IsActive())
  {
    const int itemNumber{m_viewControl.GetSelectedItem()};
    Refresh();
    m_viewControl.SetSelectedItem(itemNumber);
  }

  return ret;
}

void CGUIWindowVideoBase::OnQueueItem(int iItem, bool first)
{
  if (iItem < 0 || iItem >= m_vecItems->Size())
    return;

  OnQueueItem(m_vecItems->Get(iItem), iItem, first);
}

void CGUIWindowVideoBase::OnQueueItem(const std::shared_ptr<CFileItem>& item, int iItem, bool first)
{
  // don't re-queue items from playlist window
  if (GetID() == WINDOW_VIDEO_PLAYLIST)
    return;

  if (item->IsRAR() || item->IsZIP())
    return;

  VIDEO::UTILS::QueueItem(item, first ? VIDEO::UTILS::QueuePosition::POSITION_BEGIN
                                      : VIDEO::UTILS::QueuePosition::POSITION_END);

  // select next item
  m_viewControl.SetSelectedItem(iItem + 1);
}

bool CGUIWindowVideoBase::OnSelect(int iItem)
{
  if (iItem < 0 || iItem >= m_vecItems->Size())