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;
}
Example #2
0
bool CHomeRunFile::Open(const CURL &url)
{
  if(!m_pdll->IsLoaded())
    return false;

  m_device = m_pdll->device_create_from_str(url.GetHostName().c_str(), NULL);
  if(!m_device)
    return false;

  m_pdll->device_set_tuner_from_str(m_device, url.GetFileName().c_str());

  if(url.HasOption("channel"))
    m_pdll->device_set_tuner_channel(m_device, url.GetOption("channel").c_str());

  if(url.HasOption("program"))
    m_pdll->device_set_tuner_program(m_device, url.GetOption("program").c_str());

  // start streaming from selected device and tuner
  if( m_pdll->device_stream_start(m_device) <= 0 )
    return false;

  return true;
}