Пример #1
0
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
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 */
    {
      CMD_LOCK;
      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
unsigned int CHTSPData::GetNumTimers()
{
  SRecordings recordings = GetDVREntries(false, true);
  return recordings.size();
}
Пример #6
0
unsigned int CHTSPData::GetNumRecordings()
{
  SRecordings recordings = GetDVREntries(true, false);
  return recordings.size();
}