示例#1
0
        private static void RemoveScheduleEntry(ScheduleEntry wmc)
        {
            if (wmc.ProgramContent == null)
            {
                goto RemoveEntry;
            }
            using (var allRecordings = new Recordings(WmcStore.WmcObjectStore))
            {
                var programContentKey = new ProgramContentKey(wmc.ProgramContent);
                var recordings        = (Recordings)allRecordings.WhereKeyIsInRange(programContentKey, programContentKey);
                if (recordings.Any())
                {
                    var enumerator = recordings.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        var recordingAffected = (Recording)enumerator.Current;
                        if (recordingAffected?.Request is OneTimeRequest)
                        {
                            Logger.WriteWarning($"OneTimeRequest recording on {wmc.Service.CallSign} at {wmc.StartTime.ToLocalTime()} for [{wmc.Program.Title}]-[{wmc.Program.EpisodeTitle}] may have been rescheduled or is no longer valid. Check your guide.");
                        }
                    }
                }
            }

RemoveEntry:
            wmc.Unlock();
            wmc.Update(delegate
            {
                wmc.Service = null;
                wmc.Program = null;
            });
        }
示例#2
0
        private static void UpdateOneTimeRequest(ScheduleEntry wmc)
        {
            using (var allRecordings = new Recordings(WmcStore.WmcObjectStore))
            {
                var programContentKey = new ProgramContentKey(wmc.ProgramContent);
                var recordings        = (Recordings)allRecordings.WhereKeyIsInRange(programContentKey, programContentKey);
                if (!recordings.Any())
                {
                    return;
                }

                var enumerator = recordings.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    var recordingToUpdate = (Recording)enumerator.Current;
                    if (!(recordingToUpdate?.Request is OneTimeRequest))
                    {
                        continue;
                    }
                    recordingToUpdate.Update(delegate
                    {
                        recordingToUpdate.Program = wmc.Program;
                    });
                    Logger.WriteWarning($"OneTimeRequest recording on {wmc.Service.CallSign} at {wmc.StartTime.ToLocalTime()} was updated to record [{wmc.Program.Title}]-[{wmc.Program.EpisodeTitle}].");
                }
            }
        }