コード例 #1
0
ファイル: PVRManager.cpp プロジェクト: Avbrella/xbmc
bool CPVRManager::OpenLiveStream(const CFileItem &channel)
{
  bool bReturn(false);
  if (!channel.HasPVRChannelInfoTag())
    return bReturn;

  CLog::Log(LOGDEBUG,"PVRManager - %s - opening live stream on channel '%s'",
      __FUNCTION__, channel.GetPVRChannelInfoTag()->ChannelName().c_str());

  // check if we're allowed to play this file
  if (IsParentalLocked(*channel.GetPVRChannelInfoTag()))
    return bReturn;

  if ((bReturn = m_addons->OpenStream(*channel.GetPVRChannelInfoTag(), false)) != false)
  {
    CSingleLock lock(m_critSection);
    if(m_currentFile)
      delete m_currentFile;
    m_currentFile = new CFileItem(channel);

    // set channel as selected item
    if (channel.HasPVRChannelInfoTag())
      CGUIWindowPVRBase::SetSelectedItemPath(channel.GetPVRChannelInfoTag()->IsRadio(), channel.GetPVRChannelInfoTag()->Path());

    CPVRChannelPtr playingChannel;
    if (m_addons->GetPlayingChannel(playingChannel))
      UpdateLastWatched(*playingChannel.get());
  }

  return bReturn;
}
コード例 #2
0
ファイル: PVRChannelGroup.cpp プロジェクト: Dr-Romantic/xbmc
CFileItemPtr CPVRChannelGroup::GetByChannelUpDown(const CFileItem &channel, bool bChannelUp) const
{
  if (channel.HasPVRChannelInfoTag())
  {
    CSingleLock lock(m_critSection);
    int iChannelIndex = GetIndex(*channel.GetPVRChannelInfoTag());

    bool bGotChannel(false);
    while (!bGotChannel)
    {
      if (bChannelUp)
        iChannelIndex++;
      else
        iChannelIndex--;

      if (iChannelIndex >= (int)m_members.size())
        iChannelIndex = 0;
      else if (iChannelIndex < 0)
        iChannelIndex = m_members.size() - 1;

      CFileItemPtr current = GetByIndex(iChannelIndex);
      if (!current || *current->GetPVRChannelInfoTag() == *channel.GetPVRChannelInfoTag())
        break;

      if (!current->GetPVRChannelInfoTag()->IsHidden())
        return current;
    }
  }

  CFileItemPtr retVal(new CFileItem);
  return retVal;
}
コード例 #3
0
ファイル: PVRChannelGroup.cpp プロジェクト: sonics620/xbmc
CFileItemPtr CPVRChannelGroup::GetByChannelDown(const CFileItem &channel) const
{
  CFileItemPtr retval;

  if (channel.HasPVRChannelInfoTag())
  {
    CSingleLock lock(m_critSection);
    for (PVR_CHANNEL_GROUP_SORTED_MEMBERS::const_reverse_iterator it = m_sortedMembers.rbegin(); !retval && it != m_sortedMembers.rend(); ++it)
    {
      if ((*it).channel == channel.GetPVRChannelInfoTag())
      {
        do
        {
          if ((++it) == m_sortedMembers.rend())
            it = m_sortedMembers.rbegin();
          if ((*it).channel && !(*it).channel->IsHidden())
            retval = CFileItemPtr(new CFileItem((*it).channel));
        } while (!retval && (*it).channel != channel.GetPVRChannelInfoTag());

        if (!retval)
          retval = CFileItemPtr(new CFileItem);
      }
    }
  }
  return retval;
}
コード例 #4
0
ファイル: PVRManager.cpp プロジェクト: dpvip/xbmc
bool CPVRManager::PlayMedia(const CFileItem& item)
{
  if (!g_PVRManager.IsStarted())
  {
    CLog::Log(LOGERROR, "CApplication - %s PVR manager not started to play file '%s'", __FUNCTION__, item.GetPath().c_str());
    return false;
  }

  CFileItem pvrItem(item);
  if (URIUtils::IsPVRChannel(item.GetPath()) && !item.HasPVRChannelInfoTag())
    pvrItem = *g_PVRChannelGroups->GetByPath(item.GetPath());
  else if (URIUtils::IsPVRRecording(item.GetPath()) && !item.HasPVRRecordingInfoTag())
    pvrItem = *g_PVRRecordings->GetByPath(item.GetPath());

  if (!pvrItem.HasPVRChannelInfoTag() && !pvrItem.HasPVRRecordingInfoTag())
    return false;

  // check parental lock if we want to play a channel
  if (pvrItem.IsPVRChannel() && !g_PVRManager.CheckParentalLock(pvrItem.GetPVRChannelInfoTag()))
    return false;

  if (!g_application.IsCurrentThread())
  {
    CFileItemList *l = new CFileItemList; //don't delete,
    l->Add(std::make_shared<CFileItem>(pvrItem));
    CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, -1, -1, static_cast<void*>(l));
    return true;
  }

  return g_application.PlayFile(pvrItem, "videoplayer", false) == PLAYBACK_OK;
}
コード例 #5
0
ファイル: PVRManager.cpp プロジェクト: Avbrella/xbmc
bool CPVRManager::PlayMedia(const CFileItem& item)
{
  if (!g_PVRManager.IsStarted())
  {
    CLog::Log(LOGERROR, "CApplication - %s PVR manager not started to play file '%s'", __FUNCTION__, item.GetPath().c_str());
    return false;
  }

  CFileItem pvrItem(item);
  if (URIUtils::IsPVRChannel(item.GetPath()) && !item.HasPVRChannelInfoTag())
    pvrItem = *g_PVRChannelGroups->GetByPath(item.GetPath());
  else if (URIUtils::IsPVRRecording(item.GetPath()) && !item.HasPVRRecordingInfoTag())
    pvrItem = *g_PVRRecordings->GetByPath(item.GetPath());
  
  if (!pvrItem.HasPVRChannelInfoTag() && !pvrItem.HasPVRRecordingInfoTag())
    return false;
    
  // check parental lock if we want to play a channel
  if (pvrItem.IsPVRChannel() && !g_PVRManager.CheckParentalLock(*pvrItem.GetPVRChannelInfoTag()))
    return false;
  
  if (!g_application.IsCurrentThread())  
  {
    CApplicationMessenger::Get().MediaPlay(pvrItem);
    return true;
  }
    
  return g_application.PlayFile(pvrItem, false) == PLAYBACK_OK;
}
コード例 #6
0
ファイル: PVRManager.cpp プロジェクト: 68foxboris/xbmc
CPVRClientPtr CPVRManager::GetClient(const CFileItem &item) const
{
  int iClientID = PVR_INVALID_CLIENT_ID;

  if (item.HasPVRChannelInfoTag())
    iClientID = item.GetPVRChannelInfoTag()->ClientID();
  else if (item.HasPVRRecordingInfoTag())
    iClientID = item.GetPVRRecordingInfoTag()->m_iClientId;
  else if (item.HasPVRTimerInfoTag())
    iClientID = item.GetPVRTimerInfoTag()->m_iClientId;
  else if (item.HasEPGInfoTag())
    iClientID = item.GetEPGInfoTag()->ClientID();
  else if (URIUtils::IsPVRChannel(item.GetPath()))
  {
    const std::shared_ptr<CFileItem> channelItem = m_channelGroups->GetByPath(item.GetPath());
    if (channelItem)
      iClientID = channelItem->GetPVRChannelInfoTag()->ClientID();
  }
  else if (URIUtils::IsPVRRecording(item.GetPath()))
  {
    const std::shared_ptr<CFileItem> recordingItem = m_recordings->GetByPath(item.GetPath());
    if (recordingItem)
      iClientID = recordingItem->GetPVRRecordingInfoTag()->ClientID();
  }
  return GetClient(iClientID);
}
コード例 #7
0
ファイル: PVRManager.cpp プロジェクト: anaconda/xbmc
bool CPVRManager::OpenLiveStream(const CFileItem &fileItem)
{
  bool bReturn(false);
  if (!fileItem.HasPVRChannelInfoTag())
    return bReturn;

  CLog::Log(LOGDEBUG,"PVRManager - %s - opening live stream on channel '%s'",
      __FUNCTION__, fileItem.GetPVRChannelInfoTag()->ChannelName().c_str());

  // check if we're allowed to play this file
  if (IsParentalLocked(fileItem.GetPVRChannelInfoTag()))
    return bReturn;

  if ((bReturn = m_addons->OpenStream(fileItem.GetPVRChannelInfoTag(), false)) != false)
  {
    CSingleLock lock(m_critSection);
    m_currentFile.reset(new CFileItem(fileItem));
  }

  if (bReturn)
  {
    const CPVRChannelPtr channel(m_addons->GetPlayingChannel());
    if (channel)
    {
      SetPlayingGroup(channel);
      UpdateLastWatched(channel);
      // set channel as selected item
      CGUIWindowPVRBase::SetSelectedItemPath(channel->IsRadio(), channel->Path());
    }
  }

  return bReturn;
}
コード例 #8
0
ファイル: PVRManager.cpp プロジェクト: donggx/xbmc
bool CPVRManager::OpenLiveStream(const CFileItem &channel)
{
  bool bReturn(false);
  if (!channel.HasPVRChannelInfoTag())
    return bReturn;

  CLog::Log(LOGDEBUG,"PVRManager - %s - opening live stream on channel '%s'",
      __FUNCTION__, channel.GetPVRChannelInfoTag()->ChannelName().c_str());

  // check if we're allowed to play this file
  if (IsParentalLocked(*channel.GetPVRChannelInfoTag()))
    return bReturn;

  CPVRChannelPtr playingChannel;
  CPVRChannelGroupPtr group;
  bool bPersistChanges(false);
  if ((bReturn = m_addons->OpenStream(*channel.GetPVRChannelInfoTag(), false)) != false)
  {
    CSingleLock lock(m_critSection);
    if(m_currentFile)
      delete m_currentFile;
    m_currentFile = new CFileItem(channel);

    if (m_addons->GetPlayingChannel(playingChannel))
    {
      time_t tNow;
      CDateTime::GetCurrentDateTime().GetAsTime(tNow);

      /* update last watched timestamp for channel */
      playingChannel->SetLastWatched(tNow);

      /* update last watched timestamp for group */
      group = g_PVRManager.GetPlayingGroup(playingChannel->IsRadio());
      group->SetLastWatched(tNow);

      /* update last played group */
      m_channelGroups->SetLastPlayedGroup(group);

      bPersistChanges = true;
    }
  }

  if (bPersistChanges)
  {
    playingChannel->Persist();
    group->Persist();
  }

  return bReturn;
}
コード例 #9
0
CPVRClientPtr CPVRManager::GetClient(const CFileItem &item) const
{
  int iClientID = PVR_INVALID_CLIENT_ID;

  if (item.HasPVRChannelInfoTag())
    iClientID = item.GetPVRChannelInfoTag()->ClientID();
  else if (item.HasPVRRecordingInfoTag())
    iClientID = item.GetPVRRecordingInfoTag()->m_iClientId;
  else if (item.HasPVRTimerInfoTag())
    iClientID = item.GetPVRTimerInfoTag()->m_iClientId;
  else if (item.HasEPGInfoTag())
    iClientID = item.GetEPGInfoTag()->ClientID();

  return GetClient(iClientID);
}
コード例 #10
0
ファイル: PVRChannelGroup.cpp プロジェクト: Dr-Romantic/xbmc
bool CPVRChannelGroup::ToggleChannelLocked(const CFileItem &item)
{
  if (!item.HasPVRChannelInfoTag())
    return false;

  CSingleLock lock(m_critSection);

  /* get the real channel from the group */
  CPVRChannelPtr channel = GetByUniqueID(item.GetPVRChannelInfoTag()->UniqueID());
  if (!channel)
    return false;

  channel->SetLocked(!channel->IsLocked());

  return true;
}
コード例 #11
0
ファイル: PVRChannelGroup.cpp プロジェクト: Cobrettini/xbmc
bool CPVRChannelGroup::ToggleChannelLocked(const CFileItem &item)
{
  if (!item.HasPVRChannelInfoTag())
    return false;

  CSingleLock lock(m_critSection);

  /* get the real channel from the group */
  const PVRChannelGroupMember& member(GetByUniqueID(item.GetPVRChannelInfoTag()->StorageId()));
  if (member.channel)
  {
    member.channel->SetLocked(!member.channel->IsLocked());
    return true;
  }

  return false;
}
コード例 #12
0
ファイル: PVRManager.cpp プロジェクト: FLyrfors/xbmc
bool CPVRManager::OpenLiveStream(const CFileItem &fileItem)
{
  bool bReturn(false);

  if (!fileItem.HasPVRChannelInfoTag())
    return bReturn;

  CLog::Log(LOGDEBUG,"PVRManager - %s - opening live stream on channel '%s'",
      __FUNCTION__, fileItem.GetPVRChannelInfoTag()->ChannelName().c_str());

  // check if we're allowed to play this file
  const CPVRChannelPtr channel = fileItem.GetPVRChannelInfoTag();
  if (!IsParentalLocked(channel))
    bReturn = m_addons->OpenStream(channel);

  return bReturn;
}
コード例 #13
0
ファイル: PVRChannelGroup.cpp プロジェクト: Dr-Romantic/xbmc
bool CPVRChannelGroup::UpdateChannel(const CFileItem &item, bool bHidden, bool bVirtual, bool bEPGEnabled, bool bParentalLocked, int iEPGSource, int iChannelNumber, const std::string &strChannelName, const std::string &strIconPath, const std::string &strStreamURL, bool bUserSetIcon)
{
  if (!item.HasPVRChannelInfoTag())
    return false;

  CSingleLock lock(m_critSection);

  /* get the real channel from the group */
  CPVRChannelPtr channel = GetByUniqueID(item.GetPVRChannelInfoTag()->UniqueID());
  if (!channel)
    return false;

  channel->SetChannelName(strChannelName, true);
  channel->SetHidden(bHidden);
  channel->SetLocked(bParentalLocked);
  channel->SetIconPath(strIconPath, bUserSetIcon);

  if (bVirtual)
    channel->SetStreamURL(strStreamURL);
  if (iEPGSource == 0)
    channel->SetEPGScraper("client");

  // TODO add other scrapers
  channel->SetEPGEnabled(bEPGEnabled);

  /* set new values in the channel tag */
  if (bHidden)
  {
    SortByChannelNumber(); // or previous changes will be overwritten
    RemoveFromGroup(*channel);
  }
  else
  {
    SetChannelNumber(*channel, iChannelNumber);
  }

  return true;
}
コード例 #14
0
ファイル: PVRManager.cpp プロジェクト: A600/xbmc
bool CPVRManager::OpenLiveStream(const CFileItem &channel)
{
  bool bReturn(false);
  if (!channel.HasPVRChannelInfoTag())
    return bReturn;

  CLog::Log(LOGDEBUG,"PVRManager - %s - opening live stream on channel '%s'",
      __FUNCTION__, channel.GetPVRChannelInfoTag()->ChannelName().c_str());

  // check if we're allowed to play this file
  if (IsParentalLocked(*channel.GetPVRChannelInfoTag()))
    return bReturn;

  if ((bReturn = m_addons->OpenStream(*channel.GetPVRChannelInfoTag(), false)) != false)
  {
    CSingleLock lock(m_critSection);
    if(m_currentFile)
      delete m_currentFile;
    m_currentFile = new CFileItem(channel);
  }

  return bReturn;
}
コード例 #15
0
bool CPVRManager::OpenLiveStream(const CFileItem &channel)
{
  bool bReturn(false);
  if (!channel.HasPVRChannelInfoTag())
    return bReturn;

  CLog::Log(LOGDEBUG,"PVRManager - %s - opening live stream on channel '%s'",
      __FUNCTION__, channel.GetPVRChannelInfoTag()->ChannelName().c_str());

  // check if we're allowed to play this file
  if (IsParentalLocked(*channel.GetPVRChannelInfoTag()))
    return bReturn;

  CPVRChannelPtr playingChannel;
  bool bPersistChannel(false);
  if ((bReturn = m_addons->OpenStream(*channel.GetPVRChannelInfoTag(), false)) != false)
  {
    CSingleLock lock(m_critSection);
    if(m_currentFile)
      delete m_currentFile;
    m_currentFile = new CFileItem(channel);

    if (m_addons->GetPlayingChannel(playingChannel))
    {
      /* store current time in iLastWatched */
      time_t tNow;
      CDateTime::GetCurrentDateTime().GetAsTime(tNow);
      playingChannel->SetLastWatched(tNow);
      bPersistChannel = true;
    }
  }

  if (bPersistChannel)
    playingChannel->Persist();

  return bReturn;
}
コード例 #16
0
ファイル: PVRChannelGroup.cpp プロジェクト: gdachs/xbmc
bool CPVRChannelGroup::UpdateChannel(const CFileItem &item, bool bHidden, bool bEPGEnabled, bool bParentalLocked, int iEPGSource, int iChannelNumber, const std::string &strChannelName, const std::string &strIconPath, bool bUserSetIcon)
{
  if (!item.HasPVRChannelInfoTag())
    return false;

  CSingleLock lock(m_critSection);

  /* get the real channel from the group */
  const PVRChannelGroupMember& member(GetByUniqueID(item.GetPVRChannelInfoTag()->StorageId()));
  if (!member.channel)
    return false;

  member.channel->SetChannelName(strChannelName, true);
  member.channel->SetHidden(bHidden);
  member.channel->SetLocked(bParentalLocked);
  member.channel->SetIconPath(strIconPath, bUserSetIcon);

  if (iEPGSource == 0)
    member.channel->SetEPGScraper("client");

  //! @todo add other scrapers
  member.channel->SetEPGEnabled(bEPGEnabled);

  /* set new values in the channel tag */
  if (bHidden)
  {
    SortByChannelNumber(); // or previous changes will be overwritten
    RemoveFromGroup(member.channel);
  }
  else
  {
    SetChannelNumber(member.channel, iChannelNumber);
  }

  return true;
}