Exemplo n.º 1
0
 /// <summary>
 /// Legt eine neue Information an.
 /// </summary>
 /// <param name="job">Der Auftrag.</param>
 /// <param name="schedule">Die Aufzeichnung.</param>
 /// <param name="guide">Ein Eintrag der Programmzeitschrift.</param>
 /// <param name="profile">Vorgabe für das Geräteprofil.</param>
 /// <returns>Die Information.</returns>
 public static JobScheduleInfo Create( VCRJob job, VCRSchedule schedule, ProgramGuideEntry guide, string profile )
 {
     // Process
     return
         new JobScheduleInfo
         {
             ScheduleIdentifier = (schedule == null) ? null : schedule.UniqueID.Value.ToString( "N" ),
             JobIdentifier = (job == null) ? null : job.UniqueID.Value.ToString( "N" ),
             Schedule = EditSchedule.Create( schedule, job, guide ),
             Job = EditJob.Create( job, guide, profile ),
         };
 }
        /// <summary>
        /// Events are ordered by the <see cref="StartTime"/> field.
        /// </summary>
        /// <param name="obj">Some other instance.</param>
        /// <returns><see cref="DateTime.CompareTo(DateTime)"/> of the <see cref="StartTime"/>
        /// or -1 if the parameter is not an <see cref="ProgramGuideEntry"/>.</returns>
        public int CompareTo(object obj)
        {
            // Check other
            ProgramGuideEntry other = obj as ProgramGuideEntry;

            // Not comparable - we are left of these
            if (other == null)
            {
                return(-1);
            }

            // Forward
            return(StartTime.CompareTo(other.StartTime));
        }
        /// <summary>
        /// Add a single EPG event.
        /// </summary>
        /// <param name="newEvent">A new event.</param>
        public void Add(ProgramGuideEntry newEvent)
        {
            // Create the key
            var key = newEvent.Source;

            // Attach to holder
            if (!m_Events.TryGetValue(key, out OrderedEntries events))
            {
                m_Events.Add(key, events = new OrderedEntries());
            }

            // Forward
            events.Add(newEvent);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Erstellt eine neue Beschreibung.
        /// </summary>
        /// <param name="job">Der konkrete Auftag.</param>
        /// <param name="guide">Ein Eintrag der Programmzeitschrift.</param>
        /// <param name="profile">Vorgabe für das Geräteprofil.</param>
        /// <returns>Die zugehörige Beschreibung.</returns>
        public static EditJob Create( VCRJob job, ProgramGuideEntry guide, string profile )
        {
            // Process
            if (job == null)
            {
                // No hope
                if (guide == null)
                    return null;

                // Create from program guide            
                return
                    new EditJob
                    {
                        Source = ServerRuntime.VCRServer.GetUniqueName( new SourceSelection { ProfileName = profile, Source = guide.Source } ),
                        DVBSubtitles = UserProfileSettings.UseSubTitles,
                        DolbyDigital = UserProfileSettings.UseAC3,
                        AllLanguages = UserProfileSettings.UseMP2,
                        Videotext = UserProfileSettings.UseTTX,
                        UseProfileForRecording = false,
                        Name = guide.Name.MakeValid(),
                        Profile = profile,
                    };
            }

            // Optionen ermitteln
            var streams = job.Streams;
            var sourceName = ServerRuntime.VCRServer.GetUniqueName( job.Source );

            // Report            
            return
                new EditJob
                {
                    UseProfileForRecording = !job.AutomaticResourceSelection,
                    DolbyDigital = streams.GetUsesDolbyAudio(),
                    AllLanguages = streams.GetUsesAllAudio(),
                    DVBSubtitles = streams.GetUsesSubtitles(),
                    Videotext = streams.GetUsesVideotext(),
                    RecordingDirectory = job.Directory,
                    Profile = job.Source.ProfileName,
                    Source = sourceName,
                    Name = job.Name,
                };
        }
Exemplo n.º 5
0
        /// <summary>
        /// Erstellt einen neuen Eintrag für die Programmzeitschrift.
        /// </summary>
        /// <param name="entry">Der originale Eintrag aus der Verwaltung.</param>
        /// <param name="profileName">Der Name des zugehörigen Geräteprofils.</param>
        /// <returns>Die gewünschte Beschreibung.</returns>
        public static GuideItem Create( ProgramGuideEntry entry, string profileName )
        {
            // Validate
            if (entry == null)
                throw new ArgumentNullException( "entry" );

            // Default name of the station
            var source = VCRProfiles.FindSource( profileName, entry.Source );

            // Create
            return
                new GuideItem
                {
                    Identifier = string.Format( "{0}:{1}:{2}", entry.StartTime.Ticks, profileName, SourceIdentifier.ToString( entry.Source ).Replace( " ", "" ) ),
                    Station = (source == null) ? entry.StationName : source.GetUniqueName(),
                    Duration = TimeSpan.FromSeconds( entry.Duration ),
                    Categories = entry.Categories.ToArray(),
                    Ratings = entry.Ratings.ToArray(),
                    Summary = entry.ShortDescription,
                    Description = entry.Description,
                    StartTime = entry.StartTime,
                    Language = entry.Language,
                    Name = entry.Name,
                };
        }
Exemplo n.º 6
0
        /// <summary>
        /// Erstellt eine Beschreibung zu dieser Aufzeichnung.
        /// </summary>
        /// <param name="schedule">Eine Aufzeichnung.</param>
        /// <param name="job">Der bereits vorhandene Auftrag.</param>
        /// <param name="guide">Ein Eintrag aus der Programmzeitschrift.</param>
        /// <returns>Die gewünschte Beschreibung.</returns>
        public static EditSchedule Create( VCRSchedule schedule, VCRJob job, ProgramGuideEntry guide )
        {
            // None
            if (schedule == null)
            {
                // No hope
                if (guide == null)
                    return null;

                // Calculate
                var start = guide.StartTime - TimeSpan.FromMinutes( UserProfileSettings.EPGPreTime );
                var duration = checked( (int) (UserProfileSettings.EPGPreTime + (guide.Duration / 60) + UserProfileSettings.EPGPostTime) );

                // Partial - we have a brand new job which is pre-initialized with the source
                if (job == null)
                    return new EditSchedule { FirstStart = start, Duration = duration };

                // Full monty - we have to overwrite the jobs settings since we are not the first schedule
                return
                    new EditSchedule
                    {
                        Source = ServerRuntime.VCRServer.GetUniqueName( new SourceSelection { ProfileName = job.Source.ProfileName, Source = guide.Source } ),
                        DVBSubtitles = UserProfileSettings.UseSubTitles,
                        DolbyDigital = UserProfileSettings.UseAC3,
                        AllLanguages = UserProfileSettings.UseMP2,
                        Videotext = UserProfileSettings.UseTTX,
                        Name = guide.Name.MakeValid(),
                        Duration = duration,
                        FirstStart = start,
                    };
            }

            // Consolidate exceptions
            schedule.CleanupExceptions();

            // Optionen ermitteln
            var streams = schedule.Streams;
            var sourceName = ServerRuntime.VCRServer.GetUniqueName( schedule.Source );

            // Create
            return
                new EditSchedule
                {
                    Exceptions = schedule.Exceptions.Select( exception => PlanException.Create( exception, schedule ) ).ToArray(),
                    LastDay = schedule.LastDay.GetValueOrDefault( VCRSchedule.MaxMovableDay ),
                    DolbyDigital = streams.GetUsesDolbyAudio(),
                    DVBSubtitles = streams.GetUsesSubtitles(),
                    AllLanguages = streams.GetUsesAllAudio(),
                    Videotext = streams.GetUsesVideotext(),
                    FirstStart = schedule.FirstStart,
                    RepeatPattern = schedule.Days,
                    Duration = schedule.Duration,
                    Name = schedule.Name,
                    Source = sourceName,
                };
        }
Exemplo n.º 7
0
        /// <summary>
        /// Beendet die Sammlung endgültig.
        /// </summary>
        protected override void OnStop()
        {
            // At least we tried
            ProfileState.ProgramGuide.LastUpdateTime = DateTime.UtcNow;

            // Report
            Tools.ExtendedLogging( "Converting Program Guide Entries from Card Server to VCR.NET Format" );

            // Create result
            var result = new ProgramGuideEntries();

            // Fill it
            foreach (var item in Server.BeginEndEPGCollection().Result)
            {
                // Create event
                var epg =
                    new ProgramGuideEntry
                    {
                        TransportIdentifier = item.Source.TransportStream,
                        ShortDescription = item.ShortDescription,
                        NetworkIdentifier = item.Source.Network,
                        ServiceIdentifier = item.Source.Service,
                        Description = item.Description,
                        Duration = item.Duration,
                        Language = item.Language,
                        StartTime = item.Start,
                        Name = item.Name
                    };

                // Finish
                if (item.Content != null)
                    epg.Categories.AddRange( item.Content.Select( c => c.ToString() ) );
                if (item.Ratings != null)
                    epg.Ratings.AddRange( item.Ratings );

                // Resolve
                var source = VCRProfiles.FindSource( ProfileName, item.Source );
                if (source == null)
                {
                    // Load default
                    epg.StationName = item.Source.ToString();
                }
                else
                {
                    // Attach to the station
                    var station = (Station) source.Source;

                    // Load names
                    epg.StationName = station.Name;
                }

                // Add it
                result.Add( epg );
            }

            // Report
            ProfileState.ProgramGuide.UpdateGuide( result );
        }