Ejemplo n.º 1
0
        /// <summary>
        /// Erstellt einen neuen Zugriff.
        /// </summary>
        /// <param name="profile">Das zu verwendende Geräteprofil.</param>
        /// <param name="target">Die aktuelle Zieladresse für die Nutzdaten.</param>
        /// <returns>Die gewünschte Steuerung.</returns>
        /// <exception cref="ArgumentNullException">Mindestens ein Parameter wurde nicht angegeben.</exception>
        public static ZappingProxy Create(ProfileState profile, string target)
        {
            // Validate
            if (profile == null)
            {
                throw new ArgumentNullException(nameof(profile));
            }
            if (string.IsNullOrEmpty(target))
            {
                throw new ArgumentNullException(nameof(target));
            }

            // Create controlling information
            var now     = DateTime.UtcNow;
            var primary =
                new VCRRecordingInfo
            {
                Source = new SourceSelection {
                    ProfileName = profile.ProfileName, DisplayName = VCRJob.ZappingName
                },
                FileName           = Path.Combine(profile.Server.JobManager.CollectorDirectory.FullName, "zapping.live"),
                ScheduleUniqueID   = Guid.NewGuid(),
                EndsAt             = now.AddMinutes(2),
                Name               = VCRJob.ZappingName,
                DisableHibernation = true,
                StartsLate         = false,
                IsHidden           = false,
                StartsAt           = now,
            };

            // Forward
            return(new ZappingProxy(profile, primary, target));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Kovertiert einen Protokolleintrag in ein für den Client nützliches Format.
        /// </summary>
        /// <param name="entry">Der originale Eintrag.</param>
        /// <returns>Der zugehörige Protokolleintrag.</returns>
        public static ProtocolEntry Create( VCRRecordingInfo entry )
        {
            // Single recording - typically a task
            var source = entry.Source;
            var sourceName = source.DisplayName;

            // Create
            var protocol =
                new ProtocolEntry
                {
                    PrimaryFile = string.IsNullOrEmpty( entry.FileName ) ? null : Path.GetFileName( entry.FileName ),
                    Files = entry.RecordingFiles.Select( file => file.Path ).Where( File.Exists ).ToArray(),
                    Source = entry.Source.DisplayName,
                    StartTime = entry.PhysicalStart,
                    EndTime = entry.EndsAt,
                };

            // Finish            
            if (VCRJob.ProgramGuideName.Equals( sourceName ))
                protocol.SizeHint = $"{entry.TotalSize:N0} Einträge";
            else if (VCRJob.SourceScanName.Equals( sourceName ))
                protocol.SizeHint = $"{entry.TotalSize:N0} Quellen";
            else
                protocol.SizeHint = PlanCurrent.GetSizeHint( entry.TotalSize );

            // Report
            return protocol;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Kovertiert einen Protokolleintrag in ein für den Client nützliches Format.
        /// </summary>
        /// <param name="entry">Der originale Eintrag.</param>
        /// <returns>Der zugehörige Protokolleintrag.</returns>
        public static ProtocolEntry Create(VCRRecordingInfo entry)
        {
            // Single recording - typically a task
            var source     = entry.Source;
            var sourceName = source.DisplayName;

            // Create
            var protocol =
                new ProtocolEntry
            {
                PrimaryFile = string.IsNullOrEmpty(entry.FileName) ? null : Path.GetFileName(entry.FileName),
                Files       = entry.RecordingFiles.Select(file => file.Path).Where(File.Exists).ToArray(),
                Source      = entry.Source.DisplayName,
                StartTime   = entry.PhysicalStart,
                EndTime     = entry.EndsAt,
            };

            // Finish
            if (VCRJob.ProgramGuideName.Equals(sourceName))
            {
                protocol.SizeHint = $"{entry.TotalSize:N0} Einträge";
            }
            else if (VCRJob.SourceScanName.Equals(sourceName))
            {
                protocol.SizeHint = $"{entry.TotalSize:N0} Quellen";
            }
            else
            {
                protocol.SizeHint = PlanCurrent.GetSizeHint(entry.TotalSize);
            }

            // Report
            return(protocol);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Legt nach einer abgeschlossenen Aufzeichnung fest, wann frühestens eine Wiederholung
 /// stattfinden darf.
 /// </summary>
 /// <param name="recording">Alle Informationen zur ausgeführten Aufzeichnung.</param>
 public void SetRestartThreshold(VCRRecordingInfo recording)
 {
     // Forward
     if (recording != null)
     {
         SetRestartThreshold(recording, recording.EndsAt);
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Erstellt eine neue Sammlung.
        /// </summary>
        /// <param name="state">Das zugehörige Geräteprofil.</param>
        /// <param name="recording">Die Beschreibung der Aufgabe.</param>
        /// <returns>Die gewünschte Steuerung.</returns>
        public static SourceScanProxy Create( ProfileState state, VCRRecordingInfo recording )
        {
            // Validate
            if (state == null)
                throw new ArgumentNullException( nameof( state ) );
            if (recording == null)
                throw new ArgumentNullException( nameof( recording ) );

            // Forward
            return new SourceScanProxy( state, recording );
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Erzeugt einen Protokolleintrag.
 /// </summary>
 /// <param name="logEntry">Der Protokolleintrag.</param>
 public void CreateLogEntry(VCRRecordingInfo logEntry)
 {
     // Store
     if (logEntry.Source != null)
     {
         if (!string.IsNullOrEmpty(logEntry.Source.ProfileName))
         {
             SerializationTools.SafeSave(logEntry, Path.Combine(LogDirectory.FullName, DateTime.UtcNow.ToString(LogEntryDateFormat + LogEntryTimeFormat) + logEntry.Source.ProfileName + VCRRecordingInfo.FileSuffix));
         }
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Erzeugt eine neue Beschreibung.
 /// </summary>
 /// <param name="primary">Die primäre Aufzeichnung für die Quelle, in der auch der Dateiname
 /// festgelegt ist.</param>
 /// <param name="target">Das aktuelle Ziel eines Netzwerkversands.</param>
 /// <param name="fileMap">Die Liste aller Dateien zur Gesamtaktivität.</param>
 /// <returns>Die neue Beschreibung.</returns>
 public static StreamInfo Create( VCRRecordingInfo primary, string target, Dictionary<Guid, string[]> fileMap )
 {
     // Create new
     return
         new StreamInfo
         {
             Schedules = { ScheduleInfo.Create( primary, fileMap ) },
             LiveStream = string.IsNullOrEmpty( primary.FileName ),
             TargetFile = primary.FileName,
             StreamsTo = target,
         };
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Erzeugt eine neue Beschreibung.
 /// </summary>
 /// <param name="primary">Die primäre Aufzeichnung für die Quelle, in der auch der Dateiname
 /// festgelegt ist.</param>
 /// <param name="target">Das aktuelle Ziel eines Netzwerkversands.</param>
 /// <param name="fileMap">Die Liste aller Dateien zur Gesamtaktivität.</param>
 /// <returns>Die neue Beschreibung.</returns>
 public static StreamInfo Create(VCRRecordingInfo primary, string target, Dictionary <Guid, string[]> fileMap)
 {
     // Create new
     return
         (new StreamInfo
     {
         Schedules = { ScheduleInfo.Create(primary, fileMap) },
         LiveStream = string.IsNullOrEmpty(primary.FileName),
         TargetFile = primary.FileName,
         StreamsTo = target,
     });
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Legt nach einer abgeschlossenen Aufzeichnung fest, wann frühestens eine Wiederholung
 /// stattfinden darf.
 /// </summary>
 /// <param name="recording">Alle Informationen zur ausgeführten Aufzeichnung.</param>
 /// <param name="endsAt">Der Endzeitpunkt der Aufzeichnung.</param>
 public void SetRestartThreshold(VCRRecordingInfo recording, DateTime endsAt)
 {
     // Forward
     if (recording != null)
     {
         if (recording.JobUniqueID.HasValue)
         {
             if (recording.ScheduleUniqueID.HasValue)
             {
                 SetRestartThreshold(recording.JobUniqueID.Value, recording.ScheduleUniqueID.Value, endsAt);
             }
         }
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Erstellt eine neue Sammlung.
        /// </summary>
        /// <param name="state">Das zugehörige Geräteprofil.</param>
        /// <param name="recording">Die Beschreibung der Aufgabe.</param>
        /// <returns>Die gewünschte Steuerung.</returns>
        public static SourceScanProxy Create(ProfileState state, VCRRecordingInfo recording)
        {
            // Validate
            if (state == null)
            {
                throw new ArgumentNullException(nameof(state));
            }
            if (recording == null)
            {
                throw new ArgumentNullException(nameof(recording));
            }

            // Forward
            return(new SourceScanProxy(state, recording));
        }
        /// <summary>
        /// Erstellt eine neue Aktualisierung.
        /// </summary>
        /// <param name="state">Das zugehörige Geräteprofil.</param>
        /// <param name="recording">Daten der primären Aufzeichnung.</param>
        private ProgramGuideProxy(ProfileState state, VCRRecordingInfo recording)
            : base(state, recording)
        {
            // Reset fields
            if (VCRConfiguration.Current.EnableFreeSat)
            {
                m_extensions = EPGExtensions.FreeSatUK;
            }
            else
            {
                m_extensions = EPGExtensions.None;
            }

            // All sources we know about
            var allSources = new Dictionary <string, SourceSelection>(StringComparer.InvariantCultureIgnoreCase);

            // Load all sources of this profile
            foreach (var source in VCRProfiles.GetSources(ProfileName))
            {
                // Remember by direct name
                allSources[source.DisplayName] = source;

                // allSources by unique name
                allSources[source.QualifiedName] = source;
            }

            // Fill in all
            foreach (var legacyName in VCRConfiguration.Current.ProgramGuideSources)
            {
                // Skip if empty
                if (string.IsNullOrEmpty(legacyName))
                {
                    continue;
                }

                // Locate
                SourceSelection realSource;
                if (allSources.TryGetValue(legacyName, out realSource))
                {
                    m_selected.Add(realSource.Source);
                }
                else
                {
                    VCRServer.Log(LoggingLevel.Full, Properties.Resources.BadEPGStation, legacyName);
                }
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Erzeugt eine neue Zugriffsinstanz.
        /// </summary>
        /// <param name="state">Der Zustands des zugehörigen Geräteprofils.</param>
        /// <param name="primary">Die primäre Aufzeichnung, auf Grund derer der Aufzeichnungsprozeß aktiviert wurde.</param>
        /// <exception cref="ArgumentNullException">Es wurde kein Profil angegeben.</exception>
        protected CardServerProxy(ProfileState state, VCRRecordingInfo primary)
        {
            // Validate
            if (state == null)
            {
                throw new ArgumentNullException("state");
            }

            // Finish setup of fields and properties
            RequestFinished = new ManualResetEvent(false);

            // Remember
            Representative = primary.Clone();
            ProfileState   = state;

            // Make sure that we report the start
            m_start = primary;
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Ergänzt eine weitere Aufzeichnung.
        /// </summary>
        /// <param name="recording">Die Daten der neuen Aufzeichnung.</param>
        public virtual void Start(VCRRecordingInfo recording)
        {
            // Validate
            if (recording == null)
            {
                throw new ArgumentNullException("recording");
            }

            // Remember synchronized
            lock (m_active)
                if ((m_start == null) && !m_stop.HasValue)
                {
                    m_start = recording;
                }

            // Do the wakeup call
            m_wakeUp.Set();
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Erzeugt eine neue Beschreibung.
        /// </summary>
        /// <param name="recording">Die Aufzeichnung, deren Daten übernommen werden sollen.</param>
        /// <param name="fileMap">Alle Dateien zur Gesamtaktivität.</param>
        /// <returns>Die neue Beschreibung.</returns>
        public static ScheduleInfo Create( VCRRecordingInfo recording, Dictionary<Guid, string[]> fileMap )
        {
            // Find files
            string[] files = null;
            if (recording.ScheduleUniqueID.HasValue)
                fileMap?.TryGetValue( recording.ScheduleUniqueID.Value, out files );

            // Create new
            return
                new ScheduleInfo
                {
                    ScheduleUniqueID = recording.ScheduleUniqueID.HasValue ? recording.ScheduleUniqueID.Value.ToString( "N" ).ToUpper() : null,
                    JobUniqueID = recording.JobUniqueID.HasValue ? recording.JobUniqueID.Value.ToString( "N" ).ToUpper() : null,
                    StartsAt = recording.StartsAt.GetValueOrDefault( DateTime.UtcNow ),
                    TotalSize = recording.TotalSize,
                    Source = recording.Source,
                    EndsAt = recording.EndsAt,
                    Files = files ?? _NoFiles,
                    Name = recording.Name,
                };
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Ergänzt eine weitere Aufzeichnung. Ein Aufruf dieser Methode erfolgt nur, wenn
        /// keine Antworten vom Aufzeichnunsprozeß ausstehen.
        /// </summary>
        /// <param name="recording">Die Detaildaten der Aufzeichnung.</param>
        protected override void OnStartRecording(VCRRecordingInfo recording)
        {
            // Be safe
            lock (m_recordings)
            {
                // Always stamp time to recording
                recording.PhysicalStart = DateTime.UtcNow;

                // Remember for further processing
                m_allRecordings.Add(recording);
                m_recordings.Add(recording);

                // Make sure that all paths are unique
                EnforceUniqueFileNames();

                // Update end time
                CalculateNewEndOfRecording();
            }

            // Enqueue
            m_startPending = Server.BeginAddSources(new[] { recording.ToReceiveInformation() });
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Beginnt eine Aufzeichnung auf diesem Geräteprofil. Eventuell wird diese mit
        /// einer anderen zusammen geführt.
        /// </summary>
        /// <param name="recording">Die gewünschte Aufzeichnung.</param>
        public void StartRecording(VCRRecordingInfo recording)
        {
            // Protect current request against transistions
            lock (m_RequestLock)
                for (;;)
                {
                    // Attach to the current request
                    var current = m_CurrentRequest;

                    // In best case we are just doing nothing
                    if (ReferenceEquals(current, null))
                    {
                        // Create a brand new regular recording request
                        var request = new RecordingProxy(this, recording);

                        // Activate the request
                        request.Start();

                        // We dit it
                        break;
                    }
                    else if (current is ZappingProxy)
                    {
                        // Regular recordings have priority over LIVE mode so request stop and try again later
                        current.Stop(false);
                    }
                    else if (!current.IsShuttingDown)
                    {
                        // There is a current recording  which is not terminating so just join it
                        current.Start(recording);

                        // We dit it
                        break;
                    }

                    // Wait for transition notification
                    Monitor.Wait(m_RequestLock);
                }
        }
Ejemplo n.º 17
0
        static void Main3(string[] args)
        {
            // Attach to job manager
            VCRServer  server = new VCRServer(new DirectoryInfo(@"C:\temp\VCR.NET 3.9 Alpha\Jobs"));
            JobManager jobs   = server.JobManager;

            // Get the profile
            Profile nexus = VCRProfiles.FindProfile("Nexus");

            // Find the next recording
            VCRRecordingInfo rec = jobs.FindNextJob(new DateTime(2009, 2, 19, 20, 0, 0), null, nexus);

            if (null != rec)
            {
                if (rec.StartsAt.HasValue)
                {
                    using (RecordingRequest recording = jobs.CreateRecording(rec, rec.StartsAt.Value, nexus))
                    {
                        // Get the information
                        FullInfo info0 = recording.CreateFullInformation();

                        // Start it
                        recording.BeginExecute(false);

                        // Report
                        Console.WriteLine("Recording...");
                        Console.ReadLine();

                        // Get the information
                        FullInfo info1 = recording.CreateFullInformation();
                    }
                }
            }

            // Done
            Console.WriteLine("Done");
            Console.ReadLine();
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Erzeugt eine neue Beschreibung.
        /// </summary>
        /// <param name="recording">Die Aufzeichnung, deren Daten übernommen werden sollen.</param>
        /// <param name="fileMap">Alle Dateien zur Gesamtaktivität.</param>
        /// <returns>Die neue Beschreibung.</returns>
        public static ScheduleInfo Create(VCRRecordingInfo recording, Dictionary <Guid, string[]> fileMap)
        {
            // Find files
            string[] files = null;
            if (recording.ScheduleUniqueID.HasValue)
            {
                fileMap?.TryGetValue(recording.ScheduleUniqueID.Value, out files);
            }

            // Create new
            return
                (new ScheduleInfo
            {
                ScheduleUniqueID = recording.ScheduleUniqueID.HasValue ? recording.ScheduleUniqueID.Value.ToString("N").ToUpper() : null,
                JobUniqueID = recording.JobUniqueID.HasValue ? recording.JobUniqueID.Value.ToString("N").ToUpper() : null,
                StartsAt = recording.StartsAt.GetValueOrDefault(DateTime.UtcNow),
                TotalSize = recording.TotalSize,
                Source = recording.Source,
                EndsAt = recording.EndsAt,
                Files = files ?? _NoFiles,
                Name = recording.Name,
            });
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Erstellt eine neue Aktualisierung.
        /// </summary>
        /// <param name="state">Das zugehörige Geräteprofil.</param>
        /// <param name="recording">Daten der primären Aufzeichnung.</param>
        private ProgramGuideProxy( ProfileState state, VCRRecordingInfo recording )
            : base( state, recording )
        {
            // Reset fields
            if (VCRConfiguration.Current.EnableFreeSat)
                m_extensions = EPGExtensions.FreeSatUK;
            else
                m_extensions = EPGExtensions.None;

            // All sources we know about
            var allSources = new Dictionary<string, SourceSelection>( StringComparer.InvariantCultureIgnoreCase );

            // Load all sources of this profile
            foreach (var source in VCRProfiles.GetSources( ProfileName ))
            {
                // Remember by direct name
                allSources[source.DisplayName] = source;

                // allSources by unique name
                allSources[source.QualifiedName] = source;
            }

            // Fill in all
            foreach (var legacyName in VCRConfiguration.Current.ProgramGuideSources)
            {
                // Skip if empty
                if (string.IsNullOrEmpty( legacyName ))
                    continue;

                // Locate
                SourceSelection realSource;
                if (allSources.TryGetValue( legacyName, out realSource ))
                    m_selected.Add( realSource.Source );
                else
                    VCRServer.Log( LoggingLevel.Full, Properties.Resources.BadEPGStation, legacyName );
            }
        }
Ejemplo n.º 20
0
        static void Main_FindRecording(string[] args)
        {
            // Create the server
            using (VCRServer server = new VCRServer(new DirectoryInfo(@"C:\temp\VCR.NET 3.9 Alpha\Jobs")))
            {
                // Attach to the state of a profile
                ProfileState nexus = server.FindProfile("Nexus");

                // Get the next job to execute
                VCRRecordingInfo next = nexus.NextJob;

                // Get recording information for the next jon
                bool incomplete;
                VCRRecordingInfo[] hidden;
                FullInfo           full = nexus.FindNextRecording(DateTime.UtcNow, out incomplete, out hidden);

                // Prepare it
                using (HardwareRequest request = nexus.CreateRecordingRequest(next, DateTime.UtcNow))
                {
                    // Set end time
                    request.Recording.EndsAt = DateTime.UtcNow.AddSeconds(30);

                    // Report
                    Console.WriteLine("Recording {0}", request.Recording.FileName);

                    // Process it
                    request.Start();

                    // Wait
                    while (request.IsRunning)
                    {
                        Thread.Sleep(100);
                    }
                }
            }
        }
Ejemplo n.º 21
0
 /// <summary>
 /// Erstellt eine neue Sammlung.
 /// </summary>
 /// <param name="state">Das zugehörige Geräteprofil.</param>
 /// <param name="recording">Die Beschreibung der Aufgabe.</param>
 private SourceScanProxy(ProfileState state, VCRRecordingInfo recording)
     : base(state, recording)
 {
     // Finish
     m_mergeSources = VCRConfiguration.Current.MergeSourceListUpdateResult;
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Erzeugt einen neuen Auftrag.
 /// </summary>
 /// <param name="state">Der Zustands des zugehörigen Geräteprofils.</param>
 /// <param name="firstRecording">Die erste Aufzeichnung, auf Grund derer dieser Zugriff angelegt wurde.</param>
 public RecordingProxy( ProfileState state, VCRRecordingInfo firstRecording )
     : base( state, firstRecording )
 {
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Ergänzt eine weitere Aufzeichnung. Ein Aufruf dieser Methode erfolgt nur, wenn
        /// keine Antworten vom Aufzeichnunsprozeß ausstehen.
        /// </summary>
        /// <param name="recording">Die Detaildaten der Aufzeichnung.</param>
        protected override void OnStartRecording( VCRRecordingInfo recording )
        {
            // Be safe
            lock (m_recordings)
            {
                // Always stamp time to recording
                recording.PhysicalStart = DateTime.UtcNow;

                // Remember for further processing
                m_allRecordings.Add( recording );
                m_recordings.Add( recording );

                // Make sure that all paths are unique
                EnforceUniqueFileNames();

                // Update end time
                CalculateNewEndOfRecording();
            }

            // Enqueue
            m_startPending = Server.BeginAddSources( new[] { recording.ToReceiveInformation() } );
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Erzeugt einen Protokolleintrag.
 /// </summary>
 /// <param name="logEntry">Der Protokolleintrag.</param>
 public void CreateLogEntry( VCRRecordingInfo logEntry )
 {
     // Store
     if (logEntry.Source != null)
         if (!string.IsNullOrEmpty( logEntry.Source.ProfileName ))
             SerializationTools.SafeSave( logEntry, Path.Combine( LogDirectory.FullName, DateTime.UtcNow.ToString( LogEntryDateFormat + LogEntryTimeFormat ) + logEntry.Source.ProfileName + VCRRecordingInfo.FileSuffix ) );
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Legt nach einer abgeschlossenen Aufzeichnung fest, wann frühestens eine Wiederholung
 /// stattfinden darf.
 /// </summary>
 /// <param name="recording">Alle Informationen zur ausgeführten Aufzeichnung.</param>
 /// <param name="endsAt">Der Endzeitpunkt der Aufzeichnung.</param>
 public void SetRestartThreshold( VCRRecordingInfo recording, DateTime endsAt )
 {
     // Forward
     if (recording != null)
         if (recording.JobUniqueID.HasValue)
             if (recording.ScheduleUniqueID.HasValue)
                 SetRestartThreshold( recording.JobUniqueID.Value, recording.ScheduleUniqueID.Value, endsAt );
 }
Ejemplo n.º 26
0
 /// <summary>
 /// Legt nach einer abgeschlossenen Aufzeichnung fest, wann frühestens eine Wiederholung
 /// stattfinden darf.
 /// </summary>
 /// <param name="recording">Alle Informationen zur ausgeführten Aufzeichnung.</param>
 public void SetRestartThreshold( VCRRecordingInfo recording )
 {
     // Forward
     if (recording != null)
         SetRestartThreshold( recording, recording.EndsAt );
 }
        /// <summary>
        /// Meldet, dass eine Aufzeichnung nun beginnen sollte.
        /// </summary>
        /// <param name="item">Die zu startende Aufzeichnung.</param>
        /// <param name="planner">Die Planungsinstanz.</param>
        /// <param name="context">Zusatzinformationen zur Aufzeichnungsplanung.</param>
        void IRecordingPlannerSite.Start(IScheduleInformation item, RecordingPlanner planner, PlanContext context)
        {
            // We are no longer active - simulate start and do nothing
            if (!m_plannerActive)
            {
                // Make planner believe we did it
                planner.Start(item);

                // Make sure that we wake up after the grace period
                if (PowerManager.IsSuspended && VCRConfiguration.Current.SuppressDelayAfterForcedHibernation)
                {
                    Tools.ExtendedLogging("Hibernation Delay is disabled and can not be enforced");
                }
                else
                {
                    m_timer.SecondsToWait = VCRConfiguration.Current.DelayAfterForcedHibernation.TotalSeconds;
                }

                // Done
                return;
            }

            // Report
            VCRServer.Log(LoggingLevel.Schedules, "Start recording '{0}'", item.Definition.Name);

            // Locate the profile - if we don't find it we are in big trouble!
            ProfileState profile;

            if (!m_profiles.TryGetValue(item.Resource.Name, out profile))
            {
                return;
            }

            // Mark as pending
            m_pendingSchedule = item;
            m_pendingStart    = true;

            // Create the recording
            var recording = VCRRecordingInfo.Create(item, context);

            // Check for EPG
            var guideUpdate = item.Definition as ProgramGuideTask;

            if (guideUpdate != null)
            {
                // Start a new guide collector
                m_pendingActions += ProgramGuideProxy.Create(profile, recording).Start;
            }
            else
            {
                // Check for PSI
                var sourceUpdate = item.Definition as SourceListTask;
                if (sourceUpdate != null)
                {
                    // Start a new update
                    m_pendingActions += SourceScanProxy.Create(profile, recording).Start;
                }
                else
                {
                    // Start a regular recording - profile will decide if to join an existing recording
                    m_pendingActions += () => profile.StartRecording(recording);
                }
            }
        }
Ejemplo n.º 28
0
 /// <summary>
 /// Erzeugt einen neuen Auftrag.
 /// </summary>
 /// <param name="state">Der Zustands des zugehörigen Geräteprofils.</param>
 /// <param name="firstRecording">Die erste Aufzeichnung, auf Grund derer dieser Zugriff angelegt wurde.</param>
 public RecordingProxy(ProfileState state, VCRRecordingInfo firstRecording)
     : base(state, firstRecording)
 {
 }
Ejemplo n.º 29
0
        static void Main1(string[] args)
        {
            // Attach to job manager
            VCRServer  server = new VCRServer(new DirectoryInfo(@"C:\temp\VCR.NET 3.9 Alpha\Jobs"));
            JobManager jobs   = server.JobManager;

            // Process all profiles
            foreach (Profile profile in VCRProfiles.Profiles)
            {
                // Report
                Console.WriteLine(profile.Name);

                // Start time
                DateTime start = DateTime.UtcNow;

                // Process a bit
                for (int i = 10; i-- > 0;)
                {
                    // Helper data
                    VCRRecordingInfo[] included;
                    bool inComplete;

                    // Find the recording
                    FullInfo         info  = jobs.FindNextRecording(start, profile, out inComplete, out included);
                    VCRRecordingInfo rec   = info.Recording;
                    VCRJob           job   = jobs[rec.JobUniqueID.Value];
                    VCRSchedule      sched = job[rec.ScheduleUniqueID.Value];

                    // Report
                    Console.WriteLine("\t{0} {1} {2} ({3}) {4} {5} {6} {7}", rec.StartsAt.Value.ToLocalTime(), rec.EndsAt.ToLocalTime().TimeOfDay, job.Name, sched.Name, inComplete, included.Length, rec.JobUniqueID, rec.ScheduleUniqueID);

                    // Report
                    foreach (VCRRecordingInfo include in included)
                    {
                        Console.WriteLine("\t\t{0} {1} {2} {3} {4}", include.Source.GetUniqueName(), include.StartsAt.Value.ToLocalTime(), include.EndsAt.ToLocalTime().TimeOfDay, include.JobUniqueID, include.ScheduleUniqueID);
                    }

                    // Report
                    foreach (StreamInfo stream in info.Streams)
                    {
                        foreach (ScheduleInfo schedule in stream.Schedules)
                        {
                            Console.WriteLine("\t\t{0} {1} {2} {3}", schedule.JobUniqueID, schedule.ScheduleUniqueID, schedule.StartsAt.ToLocalTime(), schedule.EndsAt.ToLocalTime().TimeOfDay);
                        }
                    }

                    // Advance
                    start = rec.EndsAt;
                }

                // Helper data
                VCRRecordingInfo[] incDummy;
                bool dummyFlag;

                // Start timer
                Stopwatch timer = Stopwatch.StartNew();

                // Measure
                for (int n = 0; ++n > 0;)
                {
                    // Find the recording
                    jobs.FindNextRecording(DateTime.UtcNow, profile, out dummyFlag, out incDummy);

                    // Get the time
                    TimeSpan delta = timer.Elapsed;
                    if (delta.TotalSeconds >= 5)
                    {
                        // Report
                        Console.WriteLine("{0}ms", delta.TotalMilliseconds / n);

                        // Done
                        break;
                    }
                }
            }

            // Get the profile
            Profile nexus = VCRProfiles.FindProfile("Nexus");

            // Find the next recording
            VCRRecordingInfo rec2 = jobs.FindNextJob(new DateTime(2009, 2, 19, 20, 0, 0), null, nexus);

            if (null != rec2)
            {
                if (rec2.StartsAt.HasValue)
                {
                    using (RecordingRequest recording = jobs.CreateRecording(rec2, rec2.StartsAt.Value, nexus))
                    {
                        // Get the information
                        FullInfo info0 = recording.CreateFullInformation();

#if EXEC
                        // Start it
                        recording.BeginExecute(false);

                        // Report
                        Console.WriteLine("Recording...");
                        Console.ReadLine();

                        // Get the information
                        FullInfo info1 = recording.CreateFullInformation();
#endif
                    }
                }
            }

            // Done
            Console.WriteLine("Done");
            Console.ReadLine();
        }
Ejemplo n.º 30
0
 /// <summary>
 /// Beginnt eine neue Aufzeichnung.
 /// </summary>
 /// <param name="recording">Die Daten der Aufzeichung.</param>
 protected virtual void OnStartRecording(VCRRecordingInfo recording)
 {
 }
Ejemplo n.º 31
0
        /// <summary>
        /// Bestätigt die Bearbeitung des zuletzt erhaltenen Aufzeichnungsauftrags.
        /// </summary>
        /// <param name="notifyOnly">Gesetzt, wenn nur eine Benachrichtigung ausgelöst werden soll.</param>
        private void ConfirmPendingRequest(bool notifyOnly = false)
        {
            // Current settings
            VCRRecordingInfo start = null;
            Guid             scheduleIdentifier;

            // Protect against change and check mode
            lock (m_active)
                if (m_start != null)
                {
                    // Load the current value
                    start = m_start;
                    scheduleIdentifier = start.ScheduleUniqueID.Value;

                    // Reset it
                    m_start = null;

                    // Add to map
                    m_active.Add(scheduleIdentifier, start);
                }
                else if (m_stop.HasValue)
                {
                    // Load the current value
                    scheduleIdentifier = m_stop.Value;

                    // Reset it
                    m_stop = null;

                    // Remove from to map
                    m_active.Remove(scheduleIdentifier);

                    // We did it
                    if (m_active.Count < 1)
                    {
                        m_running = false;
                    }
                }
                else
                {
                    // We are idle - nothing more to do
                    return;
                }

            // Check mode
            var isStart = (start != null);

            // Notify derived class if we are not in shutdown mode
            if (!notifyOnly)
            {
                if (isStart)
                {
                    OnStartRecording(start);
                }
                else
                {
                    OnEndRecording(scheduleIdentifier);
                }
            }

            // Inform scheduler outside the lock
            ProfileState.Collection.ConfirmOperation(scheduleIdentifier, isStart);
        }
Ejemplo n.º 32
0
 /// <summary>
 /// Erstellt eine neue Sammlung.
 /// </summary>
 /// <param name="state">Das zugehörige Geräteprofil.</param>
 /// <param name="recording">Die Beschreibung der Aufgabe.</param>
 private SourceScanProxy( ProfileState state, VCRRecordingInfo recording )
     : base( state, recording )
 {
     // Finish
     m_mergeSources = VCRConfiguration.Current.MergeSourceListUpdateResult;
 }
Ejemplo n.º 33
0
 /// <summary>
 /// Erstellt einen neuen Zugriff.
 /// </summary>
 /// <param name="profile">Das zu verwendende Geräteprofil.</param>
 /// <param name="primary">Informationen zur Aufzeichnung als Ganzes.</param>
 /// <param name="target">Die aktuelle Zieladresse für die Nutzdaten.</param>
 private ZappingProxy(ProfileState profile, VCRRecordingInfo primary, string target)
     : base(profile, primary)
 {
     // Remember
     m_target = target;
 }