Repository: xbmc/xbmc
File: xbmc/pvr/filesystem/PVRGUIDirectory.cpp (C++)

Code before:
        if (playedOnly && !channel->LastWatched())
          continue;

        if (dateAdded)
        {
          const CDateTime dtChannelAdded{channel->DateTimeAdded()};
          if (!dtChannelAdded.IsValid())
            continue;

          const std::shared_ptr<const CPVRClient> client{
              CServiceBroker::GetPVRManager().GetClient(groupMember->ChannelClientID())};
          if (client)
          {
            const CDateTime& dtFirstChannelsAdded{client->GetDateTimeFirstChannelsAdded()};
            if (dtFirstChannelsAdded.IsValid() && (dtChannelAdded <= dtFirstChannelsAdded))
            {
              continue; // Ignore channels added on very first GetChannels call for the client.
            }
          }
        }

        const auto item{std::make_shared<CFileItem>(groupMember)};
        if (dateAdded)
          item->SetProperty("hideable", true);

        results.Add(item);
      }
      return true;
    }
  }
  return false;
}

namespace
{

bool GetTimersRootDirectory(const CPVRTimersPath& path,
                            bool bHideDisabled,
                            const std::vector<std::shared_ptr<CPVRTimerInfoTag>>& timers,
                            CFileItemList& results)
{
  bool bRadio = path.IsRadio();
  bool bRules = path.IsRules();

  for (const auto& timer : timers)
  {
    if ((bRadio == timer->IsRadio() ||
         (bRules && timer->ClientChannelUID() == PVR_TIMER_ANY_CHANNEL)) &&
        (bRules == timer->IsTimerRule()) && (!bHideDisabled || !timer->IsDisabled()))
    {
      const auto item = std::make_shared<CFileItem>(timer);

Review comment (suggestion):
Instead of this, please remove `const` in line 848.

Code after:
  const CPVRChannelsPath path(m_url.GetWithoutOptions());
  if (path.IsValid())
  {
    if (path.IsEmpty())
    {
      std::shared_ptr<CFileItem> item;

      // all tv channels
      item = std::make_shared<CFileItem>(CPVRChannelsPath::PATH_TV_CHANNELS, true);
      item->SetLabel(g_localizeStrings.Get(19020)); // TV
      item->SetLabelPreformatted(true);
      results.Add(item);

      // all radio channels
      item = std::make_shared<CFileItem>(CPVRChannelsPath::PATH_RADIO_CHANNELS, true);
      item->SetLabel(g_localizeStrings.Get(19021)); // Radio
      item->SetLabelPreformatted(true);
      results.Add(item);

      return true;
    }
    else if (path.IsChannelsRoot())
    {
      return GetChannelGroupsDirectory(path.IsRadio(), true, results);
    }
    else if (path.IsChannelGroup())
    {
      const CByClientAndProviderFilter<const CPVRChannel> byClientAndProviderFilter{m_url};
      const bool playedOnly{(m_url.HasOption("view") && (m_url.GetOption("view") == "lastplayed"))};
      const bool dateAdded{(m_url.HasOption("view") && (m_url.GetOption("view") == "dateadded"))};
      const bool showHiddenChannels{path.IsHiddenChannelGroup()};
      const std::vector<std::shared_ptr<CPVRChannelGroupMember>> groupMembers{
          GetChannelGroupMembers(path)};
      for (const auto& groupMember : groupMembers)
      {
        const std::shared_ptr<const CPVRChannel> channel{groupMember->Channel()};

        if (byClientAndProviderFilter.Filter(channel))
          continue;

        if (showHiddenChannels != channel->IsHidden())
          continue;

        if (playedOnly && !channel->LastWatched())
          continue;

        if (dateAdded)
        {
          const CDateTime dtChannelAdded{channel->DateTimeAdded()};
          if (!dtChannelAdded.IsValid())
            continue;