Example #1
0
bool CPVRChannel::UpdateFromClient(const CPVRChannelPtr &channel)
{
  assert(channel.get());

  SetClientID(channel->ClientID());
  SetStreamURL(channel->StreamURL());

  CSingleLock lock(m_critSection);

  if (m_iClientChannelNumber.channel    != channel->ClientChannelNumber() ||
      m_iClientChannelNumber.subchannel != channel->ClientSubChannelNumber() ||
      m_strInputFormat                  != channel->InputFormat() ||
      m_iClientEncryptionSystem         != channel->EncryptionSystem() ||
      m_strClientChannelName            != channel->ClientChannelName())
  {
    m_iClientChannelNumber.channel    = channel->ClientChannelNumber();
    m_iClientChannelNumber.subchannel = channel->ClientSubChannelNumber();
    m_strInputFormat                  = channel->InputFormat();
    m_iClientEncryptionSystem         = channel->EncryptionSystem();
    m_strClientChannelName            = channel->ClientChannelName();

    UpdateEncryptionName();
    SetChanged();
  }

  // only update the channel name and icon if the user hasn't changed them manually
  if (m_strChannelName.empty() || !IsUserSetName())
    SetChannelName(channel->ClientChannelName());
  if (m_strIconPath.empty() || !IsUserSetIcon())
    SetIconPath(channel->IconPath());

  return m_bChanged;
}
Example #2
0
int CPVRChannelGroup::GetEPGNowOrNext(CFileItemList &results, bool bGetNext) const
{
  int iInitialSize = results.Size();
  CEpgInfoTagPtr epgNext;
  CPVRChannelPtr channel;
  CSingleLock lock(m_critSection);

  for (PVR_CHANNEL_GROUP_SORTED_MEMBERS::const_iterator it = m_sortedMembers.begin(); it != m_sortedMembers.end(); ++it)
  {
    channel = (*it).channel;
    CEpgPtr epg = channel->GetEPG();
    if (epg && !channel->IsHidden())
    {
      epgNext = bGetNext ? epg->GetTagNext() : epg->GetTagNow();
      if (epgNext)
      {
        CFileItemPtr entry(new CFileItem(epgNext));
        entry->SetLabel2(epgNext->StartAsLocalTime().GetAsLocalizedTime("", false));
        entry->SetPath(channel->Path());
        entry->SetArt("thumb", channel->IconPath());
        results.Add(entry);
      }
    }
  }

  return results.Size() - iInitialSize;
}
Example #3
0
int CPVRChannelGroup::GetEPGNext(CFileItemList &results)
{
  int iInitialSize = results.Size();
  CSingleLock lock(m_critSection);

  for (unsigned int iChannelPtr = 0; iChannelPtr < m_members.size(); iChannelPtr++)
  {
    CPVRChannelPtr channel = m_members.at(iChannelPtr).channel;
    CEpg *epg = channel->GetEPG();
    if (!epg || !epg->HasValidEntries() || m_members.at(iChannelPtr).channel->IsHidden())
      continue;

    CEpgInfoTag epgNow;
    if (!epg->InfoTagNext(epgNow))
      continue;

    CFileItemPtr entry(new CFileItem(epgNow));
    entry->SetLabel2(epgNow.StartAsLocalTime().GetAsLocalizedTime("", false));
    entry->SetPath(channel->Path());
    entry->SetArt("thumb", channel->IconPath());
    results.Add(entry);
  }

  return results.Size() - iInitialSize;
}
Example #4
0
std::string CPVRTimerInfoTag::ChannelIcon() const
{
    std::string strReturn;
    CPVRChannelPtr channeltag = ChannelTag();
    if (channeltag)
        strReturn = channeltag->IconPath();
    return strReturn;
}
Example #5
0
/*!
 * @brief Copy over channel info from xbmcChannel to addonClient.
 * @param xbmcChannel The channel on XBMC's side.
 * @param addonChannel The channel on the addon's side.
 */
void CPVRClient::WriteClientChannelInfo(const CPVRChannelPtr &xbmcChannel, PVR_CHANNEL &addonChannel)
{
  assert(xbmcChannel.get());

  memset(&addonChannel, 0, sizeof(addonChannel));

  addonChannel.iUniqueId         = xbmcChannel->UniqueID();
  addonChannel.iChannelNumber    = xbmcChannel->ClientChannelNumber();
  addonChannel.iSubChannelNumber = xbmcChannel->ClientSubChannelNumber();
  strncpy(addonChannel.strChannelName, xbmcChannel->ClientChannelName().c_str(), sizeof(addonChannel.strChannelName) - 1);
  strncpy(addonChannel.strIconPath, xbmcChannel->IconPath().c_str(), sizeof(addonChannel.strIconPath) - 1);
  addonChannel.iEncryptionSystem = xbmcChannel->EncryptionSystem();
  addonChannel.bIsRadio          = xbmcChannel->IsRadio();
  addonChannel.bIsHidden         = xbmcChannel->IsHidden();
  strncpy(addonChannel.strInputFormat, xbmcChannel->InputFormat().c_str(), sizeof(addonChannel.strInputFormat) - 1);
  strncpy(addonChannel.strStreamURL, xbmcChannel->StreamURL().c_str(), sizeof(addonChannel.strStreamURL) - 1);
}
void CGUIDialogPVRChannelManager::Update()
{
  // lock our display, as this window is rendered from the player thread
  g_graphicsContext.Lock();
  m_viewControl.SetCurrentView(CONTROL_LIST_CHANNELS);

  // empty the lists ready for population
  Clear();

  CPVRChannelGroupPtr channels = g_PVRChannelGroups->GetGroupAll(m_bIsRadio);

  // No channels available, nothing to do.
  if(!channels)
    return;

  std::vector<PVRChannelGroupMember> groupMembers(channels->GetMembers());
  CFileItemPtr channelFile;
  for (std::vector<PVRChannelGroupMember>::const_iterator it = groupMembers.begin(); it != groupMembers.end(); ++it)
  {
    channelFile = CFileItemPtr(new CFileItem((*it).channel));
    if (!channelFile || !channelFile->HasPVRChannelInfoTag())
      continue;
    const CPVRChannelPtr channel(channelFile->GetPVRChannelInfoTag());

    channelFile->SetProperty("ActiveChannel", !channel->IsHidden());
    channelFile->SetProperty("Name", channel->ChannelName());
    channelFile->SetProperty("UseEPG", channel->EPGEnabled());
    channelFile->SetProperty("Icon", channel->IconPath());
    channelFile->SetProperty("EPGSource", (int)0);
    channelFile->SetProperty("ParentalLocked", channel->IsLocked());
    channelFile->SetProperty("Number", StringUtils::Format("%i", channel->ChannelNumber()));

    std::string clientName;
    g_PVRClients->GetClientName(channel->ClientID(), clientName);
    channelFile->SetProperty("ClientName", clientName);
    channelFile->SetProperty("SupportsSettings", g_PVRClients->SupportsChannelSettings(channel->ClientID()));

    m_channelItems->Add(channelFile);
  }

  {
    std::vector< std::pair<std::string, int> > labels;
    labels.push_back(std::make_pair(g_localizeStrings.Get(19210), 0));
    /// TODO: Add Labels for EPG scrapers here
    SET_CONTROL_LABELS(SPIN_EPGSOURCE_SELECTION, 0, &labels);
  }

  m_clientsWithSettingsList = g_PVRClients->GetClientsSupportingChannelSettings(m_bIsRadio);
  if (!m_clientsWithSettingsList.empty())
    m_bAllowNewChannel = true;

  if (m_bAllowNewChannel)
    SET_CONTROL_VISIBLE(BUTTON_NEW_CHANNEL);
  else
    SET_CONTROL_HIDDEN(BUTTON_NEW_CHANNEL);

  Renumber();
  m_viewControl.SetItems(*m_channelItems);
  m_viewControl.SetSelectedItem(m_iSelected);

  g_graphicsContext.Unlock();
}