Exemplo n.º 1
0
        private void AddEntry(ushort service, EPG.EventEntry entry)
        {
            // Create a key
            string simpleKey = string.Format("{0}-{1}", service, entry.EventIdentifier);

            // Already collected
            if (m_Entries.ContainsKey(simpleKey)) return;

            // Lock out
            m_Entries[simpleKey] = true;

            // Descriptors we can have
            EPG.Descriptors.ShortEvent shortEvent = null;

            // Extended events
            List<EPG.Descriptors.ExtendedEvent> exEvents = new List<EPG.Descriptors.ExtendedEvent>();

            // Check all descriptors
            foreach (EPG.Descriptor descr in entry.Descriptors)
                if (descr.IsValid)
                {
                    // Check type
                    if (null == shortEvent)
                    {
                        // Read
                        shortEvent = descr as EPG.Descriptors.ShortEvent;

                        // Done for now
                        if (null != shortEvent) continue;
                    }

                    // Test
                    EPG.Descriptors.ExtendedEvent exEvent = descr as EPG.Descriptors.ExtendedEvent;

                    // Register
                    if (null != exEvent) exEvents.Add(exEvent);
                }

            // Data
            string name = null, description = null;

            // Take the best we got
            if (exEvents.Count > 0)
            {
                // Text builder
                StringBuilder text = new StringBuilder();

                // Process all
                foreach (EPG.Descriptors.ExtendedEvent exEvent in exEvents)
                {
                    // Normal
                    if (null == name) name = exEvent.Name;

                    // Merge
                    if (exEvent.Text != null) text.Append(exEvent.Text);
                }

                // Use
                description = text.ToString();
            }

            // Try short event
            if (null != shortEvent)
            {
                // Read
                if (null == name) name = shortEvent.Name;
                if (null == description) description = shortEvent.Text;

                // Check for additional information
                if (string.IsNullOrEmpty(name))
                    name = shortEvent.Text;
                else if (!string.IsNullOrEmpty(shortEvent.Text))
                    name += string.Format(" ({0})", shortEvent.Text);
            }

            // Remember
            m_ListItems.Add(new EPGEntry(service, name, description, entry.StartTime.ToLocalTime(), entry.Duration));
        }
Exemplo n.º 2
0
        private void SectionFound(EPG.Section section)
        {
            // Check
            if ((null == section) || !section.IsValid) return;

            // Convert
            EPG.Tables.EIT epgTable = section.Table as EPG.Tables.EIT;

            // Check it
            if ((null == epgTable) || !epgTable.IsValid) return;

            // Process all events
            foreach (EPG.EventEntry entry in epgTable.Entries)
                if (EPG.EventStatus.Running == entry.Status)
                    AddEntry(epgTable.ServiceIdentifier, entry);
        }