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
void cSkinSTTNGDisplayChannel::Flush(void)
{
  if (withInfo) {
     if (!message) {
        const cFont *font = cFont::GetFont(fontSml);
        cString date = DayDateTime();
        int w = font->Width(date);
        osd->DrawText(x4 - w - 2, y7 - font->Height(date), date, Theme.Color(clrChannelDate), frameColor, font);
        cDevice *Device = cDevice::PrimaryDevice();
        const tTrackId *Track = Device->GetTrack(Device->GetCurrentAudioTrack());
        if (!Track && *lastTrackId.description || Track && strcmp(lastTrackId.description, Track->description)) {
           osd->DrawText(x3 + 2, y6, Track ? Track->description : "", Theme.Color(clrChannelName), frameColor, font, x4 - x3 - w - 4);
           strn0cpy(lastTrackId.description, Track ? Track->description : "", sizeof(lastTrackId.description));
           }
        }

     int seen = 0;
     if (present) {
        time_t t = time(NULL);
        if (t > present->StartTime())
           seen = min(y4 - y3 - 1, int((y4 - y3) * double(t - present->StartTime()) / present->Duration()));
        }
     if (seen != lastSeen) {
        osd->DrawRectangle(x1 + Gap, y3, x1 + Gap + ScrollWidth - 1, y4 - 1, Theme.Color(clrChannelTimebarRest));
        if (seen)
        osd->DrawRectangle(x1 + Gap, y3, x1 + Gap + ScrollWidth - 1, y3 + seen, Theme.Color(clrChannelTimebarSeen));
        lastSeen = seen;
        }
     }
  osd->Flush();
}
Ejemplo n.º 3
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);
  }