Ejemplo n.º 1
0
bool cLSTEHandler::Next(bool &Last)
{
	if (*m_Error != NULL) {
		Last = true;
		cString str(m_Error);
		m_Error = NULL;
		return m_Client->Respond(m_Errno, "%s", *str);
	}

	Last = false;
	switch (m_State) {
	case Channel:
		if (m_Schedule != NULL) {
			cChannel *channel = Channels.GetByChannelID(m_Schedule->ChannelID(),
			                                            true);
			if (channel != NULL) {
				m_State = Event;
				return m_Client->Respond(-215, "C %s %s", 
			                         *channel->GetChannelID().ToString(),
			                         channel->Name());
			} else {
				esyslog("ERROR: vdr streamdev: unable to find channel %s by ID",
					         *m_Schedule->ChannelID().ToString());
				m_State = EndChannel;
				return Next(Last);
			}
		} else {
			m_State = EndEPG;
			return Next(Last);
		}
		break;

	case Event:
		if (m_Event != NULL) {
			m_State = Title;
#ifdef __FreeBSD__
			return m_Client->Respond(-215, "E %u %d %d %X", m_Event->EventID(),
#else
			return m_Client->Respond(-215, "E %u %ld %d %X", m_Event->EventID(),
#endif
			                         m_Event->StartTime(), m_Event->Duration(), 
			                         m_Event->TableID());
		} else {
Ejemplo n.º 2
0
  static void sAddEvent(GVariantBuilder *Array, const cEvent &Event)
  {
    const char *c;
    guint32 tu32;
    guint64 tu64;
    int ti;
    gboolean tb;

    GVariantBuilder *arr = g_variant_builder_new(G_VARIANT_TYPE("a(sv)"));

    cString cid = Event.ChannelID().ToString();
    c = *cid;
    cDBusHelper::AddKeyValue(arr, "ChannelID", "s", (void**)&c);

    tu32 = Event.EventID();
    cDBusHelper::AddKeyValue(arr, "EventID", "u", (void**)&tu32);

    c = Event.Title();
    if (c != NULL)
       cDBusHelper::AddKeyValue(arr, "Title", "s", (void**)&c);

    c = Event.ShortText();
    if (c != NULL)
       cDBusHelper::AddKeyValue(arr, "ShortText", "s", (void**)&c);

    c = Event.Description();
    if (c != NULL)
       cDBusHelper::AddKeyValue(arr, "Description", "s", (void**)&c);

    tu64 = Event.StartTime();
    cDBusHelper::AddKeyValue(arr, "StartTime", "t", (void**)&tu64);

    tu64 = Event.EndTime();
    cDBusHelper::AddKeyValue(arr, "EndTime", "t", (void**)&tu64);

    tu64 = Event.Duration();
    cDBusHelper::AddKeyValue(arr, "Duration", "t", (void**)&tu64);

    tu64 = Event.Vps();
    cDBusHelper::AddKeyValue(arr, "Vps", "t", (void**)&tu64);

    ti = Event.RunningStatus();
    cDBusHelper::AddKeyValue(arr, "RunningStatus", "i", (void**)&ti);

  #if VDRVERSNUM >= 10711
    ti = Event.ParentalRating();
    cDBusHelper::AddKeyValue(arr, "ParentalRating", "i", (void**)&ti);

    tb = Event.HasTimer();
    cDBusHelper::AddKeyValue(arr, "HasTimer", "b", (void**)&tb);

    for (int i = 0; i < MaxEventContents; i++) {
        tu32 = Event.Contents(i);
        if (tu32 != 0) {
           cDBusHelper::AddKeyValue(arr, *cString::sprintf("ContentID[%d]", i), "u", (void**)&tu32);
           c = cEvent::ContentToString(tu32);
           cDBusHelper::AddKeyValue(arr, *cString::sprintf("Content[%d]", i), "s", (void**)&c);
           }
        }
  #endif

    g_variant_builder_add_value(Array, g_variant_builder_end(arr));
    g_variant_builder_unref(arr);
  }