home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 2
Plugin Development
Featured Plugins
MP2Extended
Plugin: MP2Extended
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="pünktchen" data-source="post: 1156966" data-attributes="member: 107846"><p><strong>EditSchedule</strong></p><p><a href="https://github.com//MPExtended/blob/release_0.6/Services/MPExtended.Services.TVAccessService.Interfaces/ITVAccessService.cs" target="_blank">https://github.com//MPExtended/blob/release_0.6/Services/MPExtended.Services.TVAccessService.Interfaces/ITVAccessService.cs</a></p><p>[CODE=C#][OperationContract]</p><p>[WebGet(ResponseFormat = WebMessageFormat.Json)]</p><p>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);[/CODE]</p><p></p><p><a href="https://github.com//MPExtended/blob/release_0.6/Services/MPExtended.Services.TVAccessService/TVAccessService.cs" target="_blank">https://github.com//MPExtended/blob/release_0.6/Services/MPExtended.Services.TVAccessService/TVAccessService.cs</a></p><p>[CODE=C#]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)</p><p>{</p><p>try</p><p>{</p><p>Log.Debug("Editing schedule {0} on channel {1} for {2}, {3} till {4}, type {5}", scheduleId, channelId, title, startTime, endTime, scheduleType);</p><p>Schedule schedule = Schedule.Retrieve(scheduleId);</p><p>if (channelId != null && channelId.HasValue)</p><p>{</p><p>schedule.IdChannel = channelId.Value;</p><p>}</p><p>if (title != null)</p><p>{</p><p>schedule.ProgramName = title;</p><p>}</p><p>if (startTime != null && startTime.HasValue)</p><p>{</p><p>schedule.StartTime = startTime.Value;</p><p>}</p><p>if (endTime != null && endTime.HasValue)</p><p>{</p><p>schedule.EndTime = endTime.Value;</p><p>}</p><p>if (scheduleType != null && scheduleType.HasValue)</p><p>{</p><p>ScheduleRecordingType scheduleRecType = (ScheduleRecordingType)scheduleType.Value;</p><p>schedule.ScheduleType = (int)scheduleRecType;</p><p>}</p><p>if (preRecordInterval != null && preRecordInterval.HasValue)</p><p>{</p><p>schedule.PreRecordInterval = preRecordInterval.Value;</p><p>}</p><p>if (postRecordInterval != null && postRecordInterval.HasValue)</p><p>{</p><p>schedule.PostRecordInterval = postRecordInterval.Value;</p><p>}</p><p>if (directory != null)</p><p>{</p><p>schedule.Directory = directory;</p><p>}</p><p>if (priority != null && priority.HasValue)</p><p>{</p><p>schedule.Priority = priority.Value;</p><p>}</p><p>schedule.Persist();</p><p>_tvControl.OnNewSchedule(); // I don't think this is needed, but doesn't hurt either</p><p>return true;</p><p>}</p><p>catch (Exception ex)</p><p>{</p><p>Log.Warn(String.Format("Failed to edit schedule {0}", scheduleId), ex);</p><p>return false;</p><p>}</p><p>}[/CODE][DOUBLEPOST=1445193197][/DOUBLEPOST]Btw. CancelSchedule in MPExtended doesn't work:</p><p>[CODE=C#]public WebBoolResult CancelSchedule(int programId)</p><p>{</p><p>try</p><p>{</p><p>Log.Debug("Canceling schedule for programId {0}", programId);</p><p>var program = Program.Retrieve(programId);</p><p>foreach (Schedule schedule in Schedule.ListAll().Where(schedule => schedule.IsRecordingProgram(program, true)))</p><p>{</p><p>switch (schedule.ScheduleType)</p><p>{</p><p>case (int)ScheduleRecordingType.Once:</p><p>schedule.Delete();</p><p>_tvControl.OnNewSchedule();</p><p>break;</p><p>default:</p><p>CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, schedule.IdChannel, schedule.StartTime);</p><p>canceledSchedule.Persist();</p><p>_tvControl.OnNewSchedule();</p><p>break;</p><p>}</p><p>}</p><p>return true;</p><p>}</p><p>catch (Exception ex)</p><p>{</p><p>Log.Warn(String.Format("Failed to cancel schedule for programId {0}", programId), ex);</p><p>return false;</p><p>}</p><p>}[/CODE]</p><p></p><p>It schould be:</p><p>[CODE=C#]CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, schedule.IdChannel, program.StartTime);[/CODE]</p></blockquote><p></p>
[QUOTE="pünktchen, post: 1156966, member: 107846"] [B]EditSchedule[/B] [URL]https://github.com//MPExtended/blob/release_0.6/Services/MPExtended.Services.TVAccessService.Interfaces/ITVAccessService.cs[/URL] [CODE=C#][OperationContract] [WebGet(ResponseFormat = WebMessageFormat.Json)] 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);[/CODE] [URL]https://github.com//MPExtended/blob/release_0.6/Services/MPExtended.Services.TVAccessService/TVAccessService.cs[/URL] [CODE=C#]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; } }[/CODE][DOUBLEPOST=1445193197][/DOUBLEPOST]Btw. CancelSchedule in MPExtended doesn't work: [CODE=C#]public WebBoolResult CancelSchedule(int programId) { try { Log.Debug("Canceling schedule for programId {0}", programId); var program = Program.Retrieve(programId); foreach (Schedule schedule in Schedule.ListAll().Where(schedule => schedule.IsRecordingProgram(program, true))) { switch (schedule.ScheduleType) { case (int)ScheduleRecordingType.Once: schedule.Delete(); _tvControl.OnNewSchedule(); break; default: CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, schedule.IdChannel, schedule.StartTime); canceledSchedule.Persist(); _tvControl.OnNewSchedule(); break; } } return true; } catch (Exception ex) { Log.Warn(String.Format("Failed to cancel schedule for programId {0}", programId), ex); return false; } }[/CODE] It schould be: [CODE=C#]CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, schedule.IdChannel, program.StartTime);[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
Plugin Development
Featured Plugins
MP2Extended
Plugin: MP2Extended
Contact us
RSS
Top
Bottom