예제 #1
0
파일: HTSPData.cpp 프로젝트: herrJones/xbmc
PVR_ERROR CHTSPData::GetTimers(PVR_HANDLE handle)
{
  SRecordings recordings = GetDVREntries(false, true);

  for(SRecordings::const_iterator it = recordings.begin(); it != recordings.end(); ++it)
  {
    SRecording recording = it->second;

    PVR_TIMER tag;
    memset(&tag, 0, sizeof(PVR_TIMER));

    tag.iClientIndex      = recording.id;
    tag.iClientChannelUid = recording.channel;
    tag.startTime         = recording.start;
    tag.endTime           = recording.stop;
    tag.strTitle          = recording.title.c_str();
    tag.strDirectory      = "/";   // unused
    tag.strSummary        = recording.description.c_str();
    tag.state             = (PVR_TIMER_STATE) recording.state;
    tag.iPriority         = 0;     // unused
    tag.iLifetime         = 0;     // unused
    tag.bIsRepeating      = false; // unused
    tag.firstDay          = 0;     // unused
    tag.iWeekdays         = 0;     // unused
    tag.iEpgUid           = 0;     // unused
    tag.iMarginStart      = 0;     // unused
    tag.iMarginEnd        = 0;     // unused
    tag.iGenreType        = 0;     // unused
    tag.iGenreSubType     = 0;     // unused

    PVR->TransferTimerEntry(handle, &tag);
  }

  return PVR_ERROR_NO_ERROR;
}
예제 #2
0
PVR_ERROR cHTSPData::RequestTimerList(PVRHANDLE handle)
{
  time_t localTime;
  int gmtOffset;
  GetTime(&localTime, &gmtOffset);

  SRecordings recordings = GetDVREntries(false, true);

  for(SRecordings::const_iterator it = recordings.begin(); it != recordings.end(); ++it)
  {
    SRecording recording = it->second;

    PVR_TIMERINFO tag;
    tag.index       = recording.id;
    tag.channelNum  = recording.channel;
    tag.starttime   = recording.start;
    tag.endtime     = recording.stop;
    tag.active      = recording.state == ST_SCHEDULED || recording.state == ST_RECORDING;
    tag.recording   = recording.state == ST_RECORDING;
    tag.title       = recording.title.c_str();
    tag.directory   = "/";
    tag.priority    = 0;
    tag.lifetime    = tag.endtime - tag.starttime;
    tag.repeat      = false;
    tag.repeatflags = 0;

    PVR->TransferTimerEntry(handle, &tag);
  }

  return PVR_ERROR_NO_ERROR;
}
예제 #3
0
파일: HTSPData.cpp 프로젝트: herrJones/xbmc
PVR_ERROR CHTSPData::GetRecordings(PVR_HANDLE handle)
{
  SRecordings recordings = GetDVREntries(true, false);

  for(SRecordings::const_iterator it = recordings.begin(); it != recordings.end(); ++it)
  {
    SRecording recording = it->second;

    CStdString strStreamURL = "http://";
    CStdString strRecordingId;
    std::string strChannelName = "";

    /* lock */
    {
      CLockObject lock(m_mutex);
      SChannels::const_iterator itr = m_channels.find(recording.channel);
      if (itr != m_channels.end())
        strChannelName = itr->second.name.c_str();

      if (g_strUsername != "")
      {
        strStreamURL += g_strUsername;
        if (g_strPassword != "")
        {
          strStreamURL += ":";
          strStreamURL += g_strPassword;
        }
        strStreamURL += "@";
      }
      strStreamURL.Format("%s%s:%i/dvrfile/%i", strStreamURL.c_str(), g_strHostname.c_str(), g_iPortHTTP, recording.id);
    }

    strRecordingId.Format("%i", recording.id);

    PVR_RECORDING tag;
    memset(&tag, 0, sizeof(PVR_RECORDING));

    tag.strRecordingId = strRecordingId.c_str();
    tag.strTitle       = recording.title.c_str();
    tag.strStreamURL   = strStreamURL.c_str();
    tag.strDirectory   = "/";
    tag.strPlotOutline = "";
    tag.strPlot        = recording.description.c_str();
    tag.strChannelName = strChannelName.c_str();
    tag.recordingTime  = recording.start;
    tag.iDuration      = recording.stop - recording.start;
    tag.iPriority      = 0;
    tag.iLifetime      = 0;
    tag.iGenreType     = 0;
    tag.iGenreSubType  = 0;

    PVR->TransferRecordingEntry(handle, &tag);
  }

  return PVR_ERROR_NO_ERROR;
}
예제 #4
0
PVR_ERROR cHTSPData::RequestRecordingsList(PVRHANDLE handle)
{
  time_t localTime;
  int gmtOffset;
  GetTime(&localTime, &gmtOffset);

  SRecordings recordings = GetDVREntries(true, false);

  for(SRecordings::const_iterator it = recordings.begin(); it != recordings.end(); ++it)
  {
    SRecording recording = it->second;

    PVR_RECORDINGINFO tag;
    tag.index           = recording.id;
    tag.directory       = "/";
    tag.subtitle        = "";
    tag.channel_name    = "";
    tag.recording_time  = recording.start + gmtOffset;
    tag.duration        = recording.stop - recording.start;
    tag.description     = recording.description.c_str();
    tag.title           = recording.title.c_str();

    CStdString streamURL = "http://";
    {
      CMD_LOCK;
      SChannels::const_iterator itr = m_channels.find(recording.channel);
      if (itr != m_channels.end())
        tag.channel_name = itr->second.name.c_str();
      else
        tag.channel_name = "";

      if (g_szUsername != "")
      {
        streamURL += g_szUsername;
        if (g_szPassword != "")
        {
          streamURL += ":";
          streamURL += g_szPassword;
        }
        streamURL += "@";
      }
      streamURL.Format("%s%s:%i/dvrfile/%i", streamURL.c_str(), g_szHostname.c_str(), g_iPortHTTP, recording.id);
    }
    tag.stream_url      = streamURL.c_str();

    PVR->TransferRecordingEntry(handle, &tag);
  }

  return PVR_ERROR_NO_ERROR;
}
예제 #5
0
PVR_ERROR CHTSPData::GetRecordings(ADDON_HANDLE handle)
{
  SRecordings recordings = GetDVREntries(true, false);

  for(SRecordings::const_iterator it = recordings.begin(); it != recordings.end(); ++it)
  {
    SRecording recording = it->second;
    CStdString strStreamURL;
    CStdString strRecordingId;
    CStdString strDirectory = "/";
    std::string strChannelName = "";
    std::string strIconPath = "";

    /* lock */
    {
      CLockObject lock(m_mutex);
      
      /* determine channel name and icon */
      SChannels::const_iterator itr = m_channels.find(recording.channel);
      if (itr != m_channels.end())
      {
        strChannelName = itr->second.name;
        strIconPath = itr->second.icon;
      }

      /* HTSPv7+ - use HTSP */
      if (GetProtocol() >= 7)
        strStreamURL = "";

      /* HTSPv6- - use HTTP */
      else
        strStreamURL = m_session->GetWebURL("/dvrfile/%i", recording.id);
    }

    strRecordingId.Format("%i", recording.id);

    if (recording.path != "")
    {
      size_t idx = recording.path.rfind("/");
      if (idx == 0 || idx == std::string::npos) {
        strDirectory = "/";
      } else {
        strDirectory = recording.path.substr(0, idx);
        if (strDirectory[0] != '/')
          strDirectory = "/" + strDirectory;
      }
    }

    PVR_RECORDING tag;
    memset(&tag, 0, sizeof(PVR_RECORDING));

    strncpy(tag.strRecordingId, strRecordingId.c_str(), sizeof(tag.strRecordingId) - 1);
    strncpy(tag.strTitle, recording.title.c_str(), sizeof(tag.strTitle) - 1);
    strncpy(tag.strStreamURL, strStreamURL.c_str(), sizeof(tag.strStreamURL) - 1);
    strncpy(tag.strDirectory, strDirectory.c_str(), sizeof(tag.strDirectory) - 1);
    strncpy(tag.strPlot, recording.description.c_str(), sizeof(tag.strPlot) - 1);
    strncpy(tag.strChannelName, strChannelName.c_str(), sizeof(tag.strChannelName) - 1);
    strncpy(tag.strIconPath, strIconPath.c_str(), sizeof(tag.strIconPath) - 1);
    tag.recordingTime  = recording.start;
    tag.iDuration      = recording.stop - recording.start;

    PVR->TransferRecordingEntry(handle, &tag);
  }

  return PVR_ERROR_NO_ERROR;
}
예제 #6
0
PVR_ERROR CHTSPData::GetRecordings(ADDON_HANDLE handle)
{
  SRecordings recordings = GetDVREntries(true, false);

  for(SRecordings::const_iterator it = recordings.begin(); it != recordings.end(); ++it)
  {
    SRecording recording = it->second;
    CStdString strStreamURL = "http://";
    CStdString strRecordingId;
    CStdString strDirectory = "/";
    std::string strChannelName = "";

    /* lock */
    {
      CLockObject lock(m_mutex);
      SChannels::const_iterator itr = m_channels.find(recording.channel);
      if (itr != m_channels.end())
        strChannelName = itr->second.name.c_str();

      /* HTSPv7+ - use HTSP */
      if (GetProtocol() >= 7) {
        strStreamURL = "";

      /* HTSPv6- - use HTTP */
      } else {
        strStreamURL = "http://";

        if (g_strUsername != "")
        {
          strStreamURL += g_strUsername;
          if (g_strPassword != "")
          {
            strStreamURL += ":";
            strStreamURL += g_strPassword;
          }
          strStreamURL += "@";
        }
        strStreamURL.Format("%s%s:%i/dvrfile/%i", strStreamURL.c_str(), g_strHostname.c_str(), g_iPortHTTP, recording.id);
      }
    }

    strRecordingId.Format("%i", recording.id);

    if (recording.path != "")
    {
      size_t i, idx = recording.path.rfind("/");
      if (idx == 0 || idx == std::string::npos) {
        strDirectory = "/";
      } else {
        i = recording.path[0] == '/' ? 1 : 0;
        strDirectory = recording.path.substr(i, idx - i);
        strDirectory.Replace("/", " - ");
        strDirectory = "/" + strDirectory;
      }
    }

    PVR_RECORDING tag;
    memset(&tag, 0, sizeof(PVR_RECORDING));

    strncpy(tag.strRecordingId, strRecordingId.c_str(), sizeof(tag.strRecordingId) - 1);
    strncpy(tag.strTitle, recording.title.c_str(), sizeof(tag.strTitle) - 1);
    strncpy(tag.strStreamURL, strStreamURL.c_str(), sizeof(tag.strStreamURL) - 1);
    strncpy(tag.strDirectory, strDirectory.c_str(), sizeof(tag.strDirectory) - 1);
    strncpy(tag.strPlot, recording.description.c_str(), sizeof(tag.strPlot) - 1);
    strncpy(tag.strChannelName, strChannelName.c_str(), sizeof(tag.strChannelName) - 1);
    tag.recordingTime  = recording.start;
    tag.iDuration      = recording.stop - recording.start;

    PVR->TransferRecordingEntry(handle, &tag);
  }

  return PVR_ERROR_NO_ERROR;
}