• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# LiveTv.SeriesTimerInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MediaBrowser.Controller.LiveTv.SeriesTimerInfo的典型用法代码示例。如果您正苦于以下问题:C# SeriesTimerInfo类的具体用法?C# SeriesTimerInfo怎么用?C# SeriesTimerInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SeriesTimerInfo类属于MediaBrowser.Controller.LiveTv命名空间,在下文中一共展示了SeriesTimerInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetTimersForSeries

        public static List<TimerInfo> GetTimersForSeries(SeriesTimerInfo seriesTimer, IEnumerable<ProgramInfo> epgData, IReadOnlyList<RecordingInfo> currentRecordings, ILogger logger)
        {
            List<TimerInfo> timers = new List<TimerInfo>();

            // Filtered Per Show
            var filteredEpg = epgData.Where(epg => epg.Id.Substring(0, 10) == seriesTimer.Id); 

            if (!seriesTimer.RecordAnyTime)
            {
                filteredEpg = filteredEpg.Where(epg => (seriesTimer.StartDate.TimeOfDay == epg.StartDate.TimeOfDay));
            }

            if (seriesTimer.RecordNewOnly)
            {
                filteredEpg = filteredEpg.Where(epg => !epg.IsRepeat); //Filtered by New only
            }

            if (!seriesTimer.RecordAnyChannel)
            {
                filteredEpg = filteredEpg.Where(epg => string.Equals(epg.ChannelId, seriesTimer.ChannelId, StringComparison.OrdinalIgnoreCase));
            }

            filteredEpg = filteredEpg.Where(epg => seriesTimer.Days.Contains(epg.StartDate.DayOfWeek)); 
         
            filteredEpg = filteredEpg.Where(epg => currentRecordings.All(r => r.Id.Substring(0, 14) != epg.Id.Substring(0, 14))); //filtered recordings already running
            
            filteredEpg = filteredEpg.GroupBy(epg => epg.Id.Substring(0, 14)).Select(g => g.First()).ToList();

            foreach (var epg in filteredEpg)
            {
                timers.Add(CreateTimer(epg, seriesTimer));
            }

            return timers;
        }
开发者ID:Inspirony,项目名称:Emby.Plugins,代码行数:35,代码来源:RecordingHelper.cs


示例2: GetSeriesTimers

        public static List<SeriesTimerInfo> GetSeriesTimers(Stream stream, IJsonSerializer json, ILogger logger)
        {
            List<SeriesTimerInfo> ret = new List<SeriesTimerInfo>();

            var root = ParseRecRules(stream, json);
            foreach (var item in root.RecRuleList.RecRules)
            {
                if (!item.Inactive && string.Compare(item.Type, "Single Record", true) != 0 && string.Compare(item.Type, "Not Recording", true) != 0)
                {
                    SeriesTimerInfo val = new SeriesTimerInfo()
                    {
                        Name = item.Title,
                        //Overview = item.Description,
                        ChannelId = item.ChanId.ToString(),
                        EndDate = (DateTime)item.EndTime,
                        StartDate = (DateTime)item.StartTime,
                        //Overview = item.Description,
                        Id = item.Id,
                        PrePaddingSeconds = item.StartOffset * 60,
                        PostPaddingSeconds = item.EndOffset * 60,
                        RecordAnyChannel = !((item.Filter & RecFilter.ThisChannel) == RecFilter.ThisChannel),
                        RecordAnyTime = !((item.Filter & RecFilter.ThisDayTime) == RecFilter.ThisDayTime),
                        RecordNewOnly = ((item.Filter & RecFilter.NewEpisode) == RecFilter.NewEpisode),
                        //IsPostPaddingRequired = item.EndOffset != 0,
                        //IsPrePaddingRequired = item.StartOffset != 0,                    
                        ProgramId = item.ProgramId
                    };

                    ret.Add(val);
                }
            }

            return ret;
        }
开发者ID:babgvant,项目名称:Emby.MythTv,代码行数:34,代码来源:DvrResponse.cs


示例3: SingleTimer

 public SingleTimer(ProgramInfo parent, SeriesTimerInfo series)
 {
     ChannelId = parent.ChannelId;
     Id = parent.Id;
     StartDate = parent.StartDate;
     EndDate = parent.EndDate;
     ProgramId = parent.Id;
     PrePaddingSeconds = series.PrePaddingSeconds;
     PostPaddingSeconds = series.PostPaddingSeconds;
     IsPostPaddingRequired = series.IsPostPaddingRequired;
     IsPrePaddingRequired = series.IsPrePaddingRequired;
     Priority = series.Priority;
     Name = parent.Name;
     Overview = parent.Overview;
     SeriesTimerId = series.Id;
 }
开发者ID:ryu4000,项目名称:MediaBrowser.Plugins,代码行数:16,代码来源:RecordingHelper.cs


示例4: CreateTimer

        public static TimerInfo CreateTimer(ProgramInfo parent, SeriesTimerInfo series)
        {
            var timer = new TimerInfo();

            timer.ChannelId = parent.ChannelId;
            timer.Id = (series.Id + parent.Id).GetMD5().ToString("N");
            timer.StartDate = parent.StartDate;
            timer.EndDate = parent.EndDate;
            timer.ProgramId = parent.Id;
            timer.PrePaddingSeconds = series.PrePaddingSeconds;
            timer.PostPaddingSeconds = series.PostPaddingSeconds;
            timer.IsPostPaddingRequired = series.IsPostPaddingRequired;
            timer.IsPrePaddingRequired = series.IsPrePaddingRequired;
            timer.Priority = series.Priority;
            timer.Name = parent.Name;
            timer.Overview = parent.Overview;
            timer.SeriesTimerId = series.Id;

            return timer;
        }
开发者ID:7illusions,项目名称:Emby,代码行数:20,代码来源:RecordingHelper.cs


示例5: GetSeriesTimerInfoDto

        public SeriesTimerInfoDto GetSeriesTimerInfoDto(SeriesTimerInfo info, ILiveTvService service, string channelName)
        {
            var dto = new SeriesTimerInfoDto
            {
                Id = GetInternalSeriesTimerId(service.Name, info.Id).ToString("N"),
                Overview = info.Overview,
                EndDate = info.EndDate,
                Name = info.Name,
                StartDate = info.StartDate,
                ExternalId = info.Id,
                PrePaddingSeconds = info.PrePaddingSeconds,
                PostPaddingSeconds = info.PostPaddingSeconds,
                IsPostPaddingRequired = info.IsPostPaddingRequired,
                IsPrePaddingRequired = info.IsPrePaddingRequired,
                Days = info.Days,
                Priority = info.Priority,
                RecordAnyChannel = info.RecordAnyChannel,
                RecordAnyTime = info.RecordAnyTime,
                RecordNewOnly = info.RecordNewOnly,
                ExternalChannelId = info.ChannelId,
                ExternalProgramId = info.ProgramId,
                ServiceName = service.Name,
                ChannelName = channelName,
                ServerId = _appHost.SystemId
            };

            if (!string.IsNullOrEmpty(info.ChannelId))
            {
                dto.ChannelId = GetInternalChannelId(service.Name, info.ChannelId).ToString("N");
            }

            if (!string.IsNullOrEmpty(info.ProgramId))
            {
                dto.ProgramId = GetInternalProgramId(service.Name, info.ProgramId).ToString("N");
            }

            dto.DayPattern = info.Days == null ? null : GetDayPattern(info.Days);

            return dto;
        }
开发者ID:paul-777,项目名称:Emby,代码行数:40,代码来源:LiveTvDtoService.cs


示例6: ChangeSeriesSchedule

        public void ChangeSeriesSchedule(CancellationToken cancellationToken, SeriesTimerInfo schedule)
        {
            var timerData = GetSchedule(cancellationToken, schedule.Id);
            if (timerData == null)
            {
                throw ExceptionHelper.CreateArgumentException("schedule.Id", "The schedule id {0} could not be found", schedule.Id);
            }

            var builder = new StringBuilder("AddScheduleDetailed?");
            builder.AppendFormat("channelid={0}&", timerData.ChannelId);
            builder.AppendFormat("title={0}&", timerData.Title);
            builder.AppendFormat("starttime={0}&", timerData.StartTime.ToLocalTime().ToUrlDate());
            builder.AppendFormat("endtime={0}&", timerData.EndTime.ToLocalTime().ToUrlDate());
            builder.AppendFormat("scheduletype={0}&", (Int32)schedule.ToScheduleType());

            if (schedule.IsPrePaddingRequired & schedule.PrePaddingSeconds > 0)
            {
                builder.AppendFormat("preRecordInterval={0}&", TimeSpan.FromSeconds(schedule.PrePaddingSeconds).RoundUpMinutes());
            }

            if (schedule.IsPostPaddingRequired & schedule.PostPaddingSeconds > 0)
            {
                builder.AppendFormat("postRecordInterval={0}&", TimeSpan.FromSeconds(schedule.PostPaddingSeconds).RoundUpMinutes());
            }

            builder.Remove(builder.Length - 1, 1);

            Plugin.Logger.Info("Creating series schedule with StartTime: {0}, EndTime: {1}, ProgramData from MP: {2}",
                schedule.StartDate, schedule.EndDate, builder.ToString());

            Plugin.TvProxy.DeleteSchedule(cancellationToken, schedule.Id);

            var response = GetFromService<WebBoolResult>(cancellationToken, builder.ToString());
            if (!response.Result)
            {
                throw new LiveTvConflictException();
            }
        }
开发者ID:francoislepage,项目名称:MediaPortalTVPlugin,代码行数:38,代码来源:TVServiceProxy.cs


示例7: GetNewTimerDefaultsAsync

        public Task<SeriesTimerInfo> GetNewTimerDefaultsAsync(CancellationToken cancellationToken, ProgramInfo program = null)
        {
            var config = GetConfiguration();

            var defaults = new SeriesTimerInfo()
            {
                PostPaddingSeconds = Math.Max(config.PostPaddingSeconds, 0),
                PrePaddingSeconds = Math.Max(config.PrePaddingSeconds, 0),
                RecordAnyChannel = true,
                RecordAnyTime = true,
                RecordNewOnly = false,

                Days = new List<DayOfWeek>
                {
                    DayOfWeek.Sunday,
                    DayOfWeek.Monday,
                    DayOfWeek.Tuesday,
                    DayOfWeek.Wednesday,
                    DayOfWeek.Thursday,
                    DayOfWeek.Friday,
                    DayOfWeek.Saturday
                }
            };

            if (program != null)
            {
                defaults.SeriesId = program.SeriesId;
                defaults.ProgramId = program.Id;
            }

            return Task.FromResult(defaults);
        }
开发者ID:softworkz,项目名称:Emby,代码行数:32,代码来源:EmbyTV.cs


示例8: UpdateSeriesTimerAsync

        public async Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
        {
            var instance = _seriesTimerProvider.GetAll().FirstOrDefault(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase));

            if (instance != null)
            {
                instance.ChannelId = info.ChannelId;
                instance.Days = info.Days;
                instance.EndDate = info.EndDate;
                instance.IsPostPaddingRequired = info.IsPostPaddingRequired;
                instance.IsPrePaddingRequired = info.IsPrePaddingRequired;
                instance.PostPaddingSeconds = info.PostPaddingSeconds;
                instance.PrePaddingSeconds = info.PrePaddingSeconds;
                instance.Priority = info.Priority;
                instance.RecordAnyChannel = info.RecordAnyChannel;
                instance.RecordAnyTime = info.RecordAnyTime;
                instance.RecordNewOnly = info.RecordNewOnly;
                instance.StartDate = info.StartDate;

                _seriesTimerProvider.Update(instance);

                List<ProgramInfo> epgData;
                if (instance.RecordAnyChannel)
                {
                    var channels = await GetChannelsAsync(true, CancellationToken.None).ConfigureAwait(false);
                    var channelIds = channels.Select(i => i.Id).ToList();
                    epgData = GetEpgDataForChannels(channelIds);
                }
                else
                {
                    epgData = GetEpgDataForChannel(instance.ChannelId);
                }

                await UpdateTimersForSeriesTimer(epgData, instance, true).ConfigureAwait(false);
            }
        }
开发者ID:softworkz,项目名称:Emby,代码行数:36,代码来源:EmbyTV.cs


示例9: buildAutorecInfos

        public Task<IEnumerable<SeriesTimerInfo>> buildAutorecInfos(CancellationToken cancellationToken)
        {
            return Task.Factory.StartNew<IEnumerable<SeriesTimerInfo>>(() =>
            {
                lock (_data)
                {
                    List<SeriesTimerInfo> result = new List<SeriesTimerInfo>();

                    foreach (KeyValuePair<string, Message> entry in _data)
                    {
                        if (cancellationToken.IsCancellationRequested)
                        {
                            _logger.Info("[TVHclient] DvrDataHelper.buildDvrInfos, call canceled - returning part list.");
                            return result;
                        }

                        Message m = entry.Value;
                        SeriesTimerInfo sti = new SeriesTimerInfo();

                        try
                        {
                            if (m.containsField("id"))
                            {
                                sti.Id = m.getString("id");
                            }
                        }
                        catch (InvalidCastException)
                        {
                        }

                        try
                        {
                            if (m.containsField("daysOfWeek"))
                            {
                                int daysOfWeek = m.getInt("daysOfWeek");
                                sti.Days = getDayOfWeekListFromInt(daysOfWeek);
                            }
                        }
                        catch (InvalidCastException)
                        {
                        }

                        sti.StartDate = DateTime.Now.ToUniversalTime();

                        try
                        {
                            if (m.containsField("retention"))
                            {
                                int retentionInDays = m.getInt("retention");
                                sti.EndDate = DateTime.Now.AddDays(retentionInDays).ToUniversalTime();
                            }
                        }
                        catch (InvalidCastException)
                        {
                        }

                        try
                        {
                            if (m.containsField("channel"))
                            {
                                sti.ChannelId = "" + m.getInt("channel");
                            }
                        }
                        catch (InvalidCastException)
                        {
                        }

                        try
                        {
                            if (m.containsField("startExtra"))
                            {
                                sti.PrePaddingSeconds = (int)m.getLong("startExtra") * 60;
                                sti.IsPrePaddingRequired = true;
                            }
                        }
                        catch (InvalidCastException)
                        {
                        }

                        try
                        {
                            if (m.containsField("stopExtra"))
                            {
                                sti.PostPaddingSeconds = (int)m.getLong("stopExtra") * 60;
                                sti.IsPostPaddingRequired = true;
                            }
                        }
                        catch (InvalidCastException)
                        {
                        }

                        try
                        {
                            if (m.containsField("title"))
                            {
                                sti.Name = m.getString("title");
                            }
                        }
                        catch (InvalidCastException)
                        {
//.........这里部分代码省略.........
开发者ID:FabioDeMiranda,项目名称:tvheadend-api-emby,代码行数:101,代码来源:Autorec.cs


示例10: UpdateSeriesTimerAsync

 public Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
 {
     UpdateTimersForSeriesTimer(info);
     _seriesTimerProvider.Update(info);
     return Task.FromResult(true);
 }
开发者ID:heksesang,项目名称:Emby.Plugins,代码行数:6,代码来源:LiveTVService.cs


示例11: CreateSeriesTimerAsync

        public Task CreateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
        {
            info.Id = info.ProgramId.Substring(0, 10);

            UpdateTimersForSeriesTimer(info);
            _seriesTimerProvider.Add(info);
            return Task.FromResult(true);
        }
开发者ID:heksesang,项目名称:Emby.Plugins,代码行数:8,代码来源:LiveTVService.cs


示例12: GetSeriesTimerInfo

        private SeriesTimerInfo GetSeriesTimerInfo(EpgEventJSONObject i)
        {
            var info = new SeriesTimerInfo();

            var recurr = i.recurr;
            if (recurr != null)
            {
                info.ChannelId = GetChannelId(recurr);

                info.Id = recurr.OID.ToString(_usCulture);

                info.StartDate = DateTime.Parse(recurr.StartTime).ToUniversalTime();
                info.EndDate = DateTime.Parse(recurr.EndTime).ToUniversalTime();

                info.PrePaddingSeconds = int.Parse(recurr.PrePadding, _usCulture) * 60;
                info.PostPaddingSeconds = int.Parse(recurr.PostPadding, _usCulture) * 60;

                info.Name = recurr.RecurringName ?? recurr.EPGTitle;
                info.RecordNewOnly = recurr.OnlyNew;
                info.RecordAnyChannel = recurr.allChannels;

                info.Days = (recurr.Day ?? string.Empty).Split(',')
                    .Select(d => (DayOfWeek)Enum.Parse(typeof(DayOfWeek), d.Trim(), true))
                    .ToList();

                info.Priority = recurr.Priority;
            }

            var epg = i.epgEvent;

            if (epg != null)
            {
                info.ProgramId = epg.OID.ToString(_usCulture);
                info.Overview = epg.Desc;
            }

            return info;
        }
开发者ID:SvenVandenbrande,项目名称:Emby.Plugins,代码行数:38,代码来源:RecordingResponse.cs


示例13: UpdateScheduling

        private void UpdateScheduling(SeriesTimerInfo seriesTimerInfo, Schedule schedule)
        {
            var schedulingType = (WebScheduleType)schedule.ScheduleType;

            // Initialise
            seriesTimerInfo.Days = new List<DayOfWeek>();
            seriesTimerInfo.RecordAnyChannel = false;
            seriesTimerInfo.RecordAnyTime = false;
            seriesTimerInfo.RecordNewOnly = false;

            switch (schedulingType)
            {
                case WebScheduleType.EveryTimeOnThisChannel:
                    seriesTimerInfo.RecordAnyTime = true;
                    break;
                case WebScheduleType.EveryTimeOnEveryChannel:
                    seriesTimerInfo.RecordAnyTime = true;
                    seriesTimerInfo.RecordAnyChannel = true;
                    break;
                case WebScheduleType.WeeklyEveryTimeOnThisChannel:
                    seriesTimerInfo.Days.Add(schedule.StartTime.DayOfWeek);
                    seriesTimerInfo.RecordAnyTime = true;
                    break;
                case WebScheduleType.Daily:
                    seriesTimerInfo.Days.AddRange(new[]
                        {
                            DayOfWeek.Monday,
                            DayOfWeek.Tuesday,
                            DayOfWeek.Wednesday,
                            DayOfWeek.Thursday,
                            DayOfWeek.Friday,
                            DayOfWeek.Saturday,
                            DayOfWeek.Sunday,
                        });
                    break;
                case WebScheduleType.WorkingDays:
                        seriesTimerInfo.Days.AddRange(new[]
                        {
                            DayOfWeek.Monday,
                            DayOfWeek.Tuesday,
                            DayOfWeek.Wednesday,
                            DayOfWeek.Thursday,
                            DayOfWeek.Friday,
                        });
                    break;
                case WebScheduleType.Weekends:
                        seriesTimerInfo.Days.AddRange(new[]
                        {
                           DayOfWeek.Saturday,
                           DayOfWeek.Sunday,
                        });
                    break;
                case WebScheduleType.Weekly:
                    seriesTimerInfo.Days.Add(schedule.StartTime.DayOfWeek);
                    break;

                default:
                    throw new InvalidOperationException(String.Format("Should not be processing scheduling for ScheduleType={0}", schedulingType));
            }
        }
开发者ID:francoislepage,项目名称:MediaPortalTVPlugin,代码行数:60,代码来源:TVServiceProxy.cs


示例14: GetSeriesSchedules

        public IEnumerable<SeriesTimerInfo> GetSeriesSchedules(CancellationToken cancellationToken)
        {
            var response = GetFromService<List<Schedule>>(cancellationToken, "GetSchedules");

            var recordings = response.Where(r => r.ScheduleType > 0).Select(r =>
            {
                var seriesTimerInfo = new SeriesTimerInfo()
                {
                    ChannelId = r.ChannelId.ToString(CultureInfo.InvariantCulture),
                    EndDate = r.EndTime,
                    Id = r.Id.ToString(CultureInfo.InvariantCulture),
                    SeriesId = r.Id.ToString(CultureInfo.InvariantCulture),
                    ProgramId = r.Id.ToString(CultureInfo.InvariantCulture),
                    Name = r.Title,
                    IsPostPaddingRequired = (r.PostRecordInterval > 0),
                    IsPrePaddingRequired = (r.PreRecordInterval > 0),
                    PostPaddingSeconds = r.PostRecordInterval * 60,
                    PrePaddingSeconds = r.PreRecordInterval * 60,
                    StartDate = r.StartTime,
                };

                UpdateScheduling(seriesTimerInfo, r);

                return seriesTimerInfo;
            });

            return recordings;
        }
开发者ID:francoislepage,项目名称:MediaPortalTVPlugin,代码行数:28,代码来源:TVServiceProxy.cs


示例15: GetTimersForSeries

        private IEnumerable<TimerInfo> GetTimersForSeries(SeriesTimerInfo seriesTimer, IEnumerable<ProgramInfo> allPrograms, IReadOnlyList<RecordingInfo> currentRecordings)
        {
            // Exclude programs that have already ended
            allPrograms = allPrograms.Where(i => i.EndDate > DateTime.UtcNow);

            allPrograms = GetProgramsForSeries(seriesTimer, allPrograms);

            var recordingShowIds = currentRecordings.Select(i => i.ProgramId).Where(i => !string.IsNullOrWhiteSpace(i)).ToList();

            allPrograms = allPrograms.Where(i => !recordingShowIds.Contains(i.Id, StringComparer.OrdinalIgnoreCase));

            return allPrograms.Select(i => RecordingHelper.CreateTimer(i, seriesTimer));
        }
开发者ID:raven-au,项目名称:Emby,代码行数:13,代码来源:EmbyTV.cs


示例16: UpdateTimersForSeriesTimer

        private async Task UpdateTimersForSeriesTimer(List<ProgramInfo> epgData, SeriesTimerInfo seriesTimer)
        {
            var registration = await GetRegistrationInfo("seriesrecordings").ConfigureAwait(false);

            if (registration.IsValid)
            {
                var newTimers = GetTimersForSeries(seriesTimer, epgData, _recordingProvider.GetAll()).ToList();

                foreach (var timer in newTimers)
                {
                    _timerProvider.AddOrUpdate(timer);
                }
            }
        }
开发者ID:raven-au,项目名称:Emby,代码行数:14,代码来源:EmbyTV.cs


示例17: GetNewTimerDefaultsAsync

        public Task<SeriesTimerInfo> GetNewTimerDefaultsAsync(CancellationToken cancellationToken, ProgramInfo program = null)
        {
            var config = GetConfiguration();

            var defaults = new SeriesTimerInfo()
            {
                PostPaddingSeconds = Math.Max(config.PostPaddingSeconds, 0),
                PrePaddingSeconds = Math.Max(config.PrePaddingSeconds, 0),
                RecordAnyChannel = false,
                RecordAnyTime = false,
                RecordNewOnly = false
            };

            if (program != null)
            {
                defaults.SeriesId = program.SeriesId;
                defaults.ProgramId = program.Id;
            }

            return Task.FromResult(defaults);
        }
开发者ID:raven-au,项目名称:Emby,代码行数:21,代码来源:EmbyTV.cs


示例18: UpdateSeriesTimerAsync

        public async Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
        {
            _seriesTimerProvider.Update(info);
            List<ProgramInfo> epgData;
            if (info.RecordAnyChannel)
            {
                var channels = await GetChannelsAsync(true, CancellationToken.None).ConfigureAwait(false);
                var channelIds = channels.Select(i => i.Id).ToList();
                epgData = GetEpgDataForChannels(channelIds);
            }
            else
            {
                epgData = GetEpgDataForChannel(info.ChannelId);
            }

            await UpdateTimersForSeriesTimer(epgData, info).ConfigureAwait(false);
        }
开发者ID:raven-au,项目名称:Emby,代码行数:17,代码来源:EmbyTV.cs


示例19: CreateSeriesTimerAsync

        /// <summary>
        /// Create a recurrent recording
        /// </summary>
        /// <param name="info">The recurrend program info</param>
        /// <param name="cancellationToken">The CancelationToken</param>
        /// <returns></returns>
        public async Task CreateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
        {
            _logger.Info(string.Format("[NextPvr] Start CreateSeriesTimer Async for ChannelId: {0} & Name: {1}", info.ChannelId, info.Name));
            await EnsureConnectionAsync(cancellationToken).ConfigureAwait(false);
            var baseUrl = Plugin.Instance.Configuration.WebServiceUrl;

            var options = new HttpRequestOptions
            {
                CancellationToken = cancellationToken,
                Url = string.Format("{0}/public/ScheduleService/Record?sid={1}", baseUrl, Sid)
            };

            var timerSettings = await GetDefaultScheduleSettings(cancellationToken).ConfigureAwait(false);

            timerSettings.allChannels = info.RecordAnyChannel;
            timerSettings.onlyNew = info.RecordNewOnly;
            timerSettings.recurringName = info.Name;
            timerSettings.recordAnyTimeslot = info.RecordAnyTime;

            if (!info.RecordAnyTime)
            {
                timerSettings.startDate = info.StartDate.ToString(_usCulture);
                timerSettings.endDate = info.EndDate.ToString(_usCulture);
                timerSettings.recordThisTimeslot = true;
            }

            if (info.Days.Count == 1)
            {
                timerSettings.recordThisDay = true;
            }

            if (info.Days.Count > 1 && info.Days.Count < 7)
            {
                timerSettings.recordSpecificdays = true;
            }

            timerSettings.recordAnyDay = info.Days.Count == 7;
            timerSettings.daySunday = info.Days.Contains(DayOfWeek.Sunday);
            timerSettings.dayMonday = info.Days.Contains(DayOfWeek.Monday);
            timerSettings.dayTuesday = info.Days.Contains(DayOfWeek.Tuesday);
            timerSettings.dayWednesday = info.Days.Contains(DayOfWeek.Wednesday);
            timerSettings.dayThursday = info.Days.Contains(DayOfWeek.Thursday);
            timerSettings.dayFriday = info.Days.Contains(DayOfWeek.Friday);
            timerSettings.daySaturday = info.Days.Contains(DayOfWeek.Saturday);

            if (!info.RecordAnyChannel)
            {
                timerSettings.ChannelOID = int.Parse(info.ChannelId, _usCulture);
            }

            if (!string.IsNullOrEmpty(info.ProgramId))
            {
                timerSettings.epgeventOID = int.Parse(info.ProgramId, _usCulture);
            }

            timerSettings.post_padding_min = info.PostPaddingSeconds / 60;
            timerSettings.pre_padding_min = info.PrePaddingSeconds / 60;

            var postContent = _jsonSerializer.SerializeToString(timerSettings);
            UtilsHelper.DebugInformation(_logger, string.Format("[NextPvr] TimerSettings CreateSeriesTimer: {0} for ChannelId: {1} & Name: {2}", postContent, info.ChannelId, info.Name));

            options.RequestContent = postContent;
            options.RequestContentType = "application/json";

            try
            {
                await _httpClient.Post(options).ConfigureAwait((false));
            }
            catch (HttpException ex)
            {
                _logger.Error(string.Format("[NextPvr] CreateSeries async with exception: {0} ", ex.Message));
                throw new LiveTvConflictException();
            }
        }
开发者ID:SvenVandenbrande,项目名称:Emby.Plugins,代码行数:80,代码来源:LiveTvService.cs


示例20: UpdateTimersForSeriesTimer

        private async Task UpdateTimersForSeriesTimer(List<ProgramInfo> epgData, SeriesTimerInfo seriesTimer, bool deleteInvalidTimers)
        {
            var newTimers = GetTimersForSeries(seriesTimer, epgData, true).ToList();

            var registration = await GetRegistrationInfo("seriesrecordings").ConfigureAwait(false);

            if (registration.IsValid)
            {
                foreach (var timer in newTimers)
                {
                    _timerProvider.AddOrUpdate(timer);
                }
            }

            if (deleteInvalidTimers)
            {
                var allTimers = GetTimersForSeries(seriesTimer, epgData, false)
                    .Select(i => i.Id)
                    .ToList();

                var deletes = _timerProvider.GetAll()
                    .Where(i => string.Equals(i.SeriesTimerId, seriesTimer.Id, StringComparison.OrdinalIgnoreCase))
                    .Where(i => !allTimers.Contains(i.Id, StringComparer.OrdinalIgnoreCase) && i.StartDate > DateTime.UtcNow)
                    .ToList();

                foreach (var timer in deletes)
                {
                    await CancelTimerAsync(timer.Id, CancellationToken.None).ConfigureAwait(false);
                }
            }
        }
开发者ID:softworkz,项目名称:Emby,代码行数:31,代码来源:EmbyTV.cs



注:本文中的MediaBrowser.Controller.LiveTv.SeriesTimerInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# LiveTv.TimerInfo类代码示例发布时间:2022-05-26
下一篇:
C# Library.ItemResolveArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap