public WebBoolResult AddScheduleDetailed(int channelId, string title, DateTime startTime, DateTime endTime, WebScheduleType scheduleType, int preRecordInterval, int postRecordInterval, string directory, int priority) { try { Log.Debug("Adding schedule on channel {0} for {1}, {2} till {3}, type {4}", channelId, title, startTime, endTime, scheduleType); ScheduleRecordingType scheduleRecType = (ScheduleRecordingType)scheduleType; Schedule schedule = _tvBusiness.AddSchedule(channelId, title, startTime, endTime, (int)scheduleRecType); schedule.ScheduleType = (int)scheduleRecType; schedule.PreRecordInterval = preRecordInterval >= 0 ? preRecordInterval : Int32.Parse(_tvBusiness.GetSetting("preRecordInterval", "5").Value); schedule.PostRecordInterval = postRecordInterval >= 0 ? postRecordInterval : Int32.Parse(_tvBusiness.GetSetting("postRecordInterval", "5").Value); if (!String.IsNullOrEmpty(directory)) { schedule.Directory = directory; } if (priority >= 0) { schedule.Priority = priority; } schedule.Persist(); _tvControl.OnNewSchedule(); return true; } catch (Exception ex) { Log.Warn("Failed to add schedule", ex); return false; } }
public static async Task <WebBoolResult> ProcessAsync(IOwinContext context, string channelId, string title, DateTime startTime, DateTime endTime, WebScheduleType scheduleType, int preRecordInterval, int postRecordInterval, string directory, int priority) { if (!ServiceRegistration.IsRegistered <ITvProvider>()) { throw new BadRequestException("AddScheduleDetailed: ITvProvider not found"); } bool result = await TVAccess.CreateScheduleAsync(context, int.Parse(channelId), title, startTime, endTime, scheduleType, preRecordInterval, postRecordInterval, directory, priority); return(new WebBoolResult { Result = result }); }
public WebBoolResult AddSchedule(int channelId, string title, DateTime startTime, DateTime endTime, WebScheduleType scheduleType) { return AddScheduleDetailed(channelId, title, startTime, endTime, scheduleType, -1, -1, "", -1); }
internal static async Task <bool> CreateScheduleAsync(IOwinContext context, int channelId, string title, DateTime startTime, DateTime endTime, WebScheduleType scheduleType) { var channel = await GetChannelAsync(channelId); if (channel != null) { var schedule = await ScheduleControl.CreateScheduleByTimeAsync(channel, title, startTime, endTime, (ScheduleRecordingType)scheduleType); return(schedule.Success); } return(false); }
public WebBoolResult EditSchedule(int scheduleId, int? channelId = null, string title = null, DateTime? startTime = null, DateTime? endTime = null, WebScheduleType? scheduleType = null, int? preRecordInterval = null, int? postRecordInterval = null, string directory = null, int? priority = null) { try { Log.Debug("Editing schedule {0} on channel {1} for {2}, {3} till {4}, type {5}", scheduleId, channelId, title, startTime, endTime, scheduleType); Schedule schedule = Schedule.Retrieve(scheduleId); if (channelId != null && channelId.HasValue) { schedule.IdChannel = channelId.Value; } if (title != null) { schedule.ProgramName = title; } if (startTime != null && startTime.HasValue) { schedule.StartTime = startTime.Value; } if (endTime != null && endTime.HasValue) { schedule.EndTime = endTime.Value; } if (scheduleType != null && scheduleType.HasValue) { ScheduleRecordingType scheduleRecType = (ScheduleRecordingType)scheduleType.Value; schedule.ScheduleType = (int)scheduleRecType; } if (preRecordInterval != null && preRecordInterval.HasValue) { schedule.PreRecordInterval = preRecordInterval.Value; } if (postRecordInterval != null && postRecordInterval.HasValue) { schedule.PostRecordInterval = postRecordInterval.Value; } if (directory != null) { schedule.Directory = directory; } if (priority != null && priority.HasValue) { schedule.Priority = priority.Value; } schedule.Persist(); _tvControl.OnNewSchedule(); // I don't think this is needed, but doesn't hurt either return true; } catch (Exception ex) { Log.Warn(String.Format("Failed to edit schedule {0}", scheduleId), ex); return false; } }
internal static async Task <bool> CreateScheduleAsync(IOwinContext context, int channelId, string title, DateTime startTime, DateTime endTime, WebScheduleType scheduleType, int preRecordInterval, int postRecordInterval, string directory, int priority) { var channel = await GetChannelAsync(channelId); if (channel != null) { var schedule = await ScheduleControl.CreateScheduleDetailedAsync(channel, title, startTime, endTime, (ScheduleRecordingType)scheduleType, preRecordInterval, postRecordInterval, directory, priority); return(schedule.Success); } return(false); }
public WebBoolResult AddScheduleDetailed(int channelId, string title, DateTime startTime, DateTime endTime, WebScheduleType scheduleType, int preRecordInterval, int postRecordInterval, string directory, int priority) { try { Log.Debug("Adding schedule on channel {0} for {1}, {2} till {3}, type {4}", channelId, title, startTime, endTime, scheduleType); ScheduleRecordingType scheduleRecType = (ScheduleRecordingType)scheduleType; Schedule schedule = _tvBusiness.AddSchedule(channelId, title, startTime, endTime, (int)scheduleRecType); schedule.ScheduleType = (int)scheduleRecType; schedule.PreRecordInterval = preRecordInterval >= 0 ? preRecordInterval : Int32.Parse(_tvBusiness.GetSetting("preRecordInterval", "5").Value); schedule.PostRecordInterval = postRecordInterval >= 0 ? postRecordInterval : Int32.Parse(_tvBusiness.GetSetting("postRecordInterval", "5").Value); if (!String.IsNullOrEmpty(directory)) { schedule.Directory = directory; } if (priority >= 0) { schedule.Priority = priority; } schedule.Persist(); _tvControl.OnNewSchedule(); return(true); } catch (Exception ex) { Log.Warn("Failed to add schedule", ex); return(false); } }
public WebBoolResult AddSchedule(int channelId, string title, DateTime startTime, DateTime endTime, WebScheduleType scheduleType) { return(AddScheduleDetailed(channelId, title, startTime, endTime, scheduleType, -1, -1, "", -1)); }
public Task <WebBoolResult> AddScheduleDetailed(string channelId, string title, DateTime startTime, DateTime endTime, WebScheduleType scheduleType, int preRecordInterval, int postRecordInterval, string directory, int priority) { Logger.Debug("TAS Request: {0}", Request.GetOwinContext().Request.Uri); return(ResourceAccess.TAS.Schedule.AddScheduleDetailed.ProcessAsync(Request.GetOwinContext(), channelId, title, startTime, endTime, scheduleType, preRecordInterval, postRecordInterval, directory, priority)); }
public Task <WebBoolResult> AddSchedule(string channelId, string title, DateTime startTime, DateTime endTime, WebScheduleType scheduleType) { Logger.Debug("TAS Request: {0}", Request.GetOwinContext().Request.Uri); return(ResourceAccess.TAS.Schedule.AddSchedule.ProcessAsync(Request.GetOwinContext(), channelId, title, startTime, endTime, scheduleType)); }