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="FreakyJ" data-source="post: 1161337" data-attributes="member: 106003"><p>Nice!</p><p></p><p></p><p>My fault, forgot to request the information from the DB <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite27" alt=":whistle:" title="Whistling :whistle:" loading="lazy" data-shortname=":whistle:" /> Thought I already fixed it <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" /></p><p></p><p></p><p></p><p>I do:</p><p>[code]public dynamic Process(IHttpRequest request)</p><p> {</p><p> HttpParam httpParam = request.Param;</p><p> string programId = httpParam["programId"].Value;</p><p></p><p> if (programId == null)</p><p> throw new BadRequestException("CancelSchedule: programId is null");</p><p></p><p> int programIdInt;</p><p> if (!int.TryParse(programId, out programIdInt))</p><p> throw new BadRequestException(string.Format("CancelSchedule: Couldn't parse programId to int: {0}", programId));</p><p></p><p> if (!ServiceRegistration.IsRegistered<ITvProvider>())</p><p> throw new BadRequestException("CancelSchedule: ITvProvider not found");</p><p></p><p> IProgramInfo programInfo = ServiceRegistration.Get<ITvProvider>() as IProgramInfo;</p><p> IScheduleControl scheduleControl = ServiceRegistration.Get<ITvProvider>() as IScheduleControl;</p><p></p><p> IProgram program;</p><p> programInfo.GetProgram(programIdInt, out program);</p><p></p><p> bool result = scheduleControl.RemoveScheduleForProgram(program, ScheduleRecordingType.Once); // TODO: not sure if ScheduleRecordingType is right</p><p></p><p></p><p> return new WebBoolResult { Result = result };</p><p> }[/code]</p><p>I only throw the error if the id is null or couldn't be parsed. I will create a new build with the Genre fix <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p></blockquote><p></p>
[QUOTE="FreakyJ, post: 1161337, member: 106003"] Nice! My fault, forgot to request the information from the DB :whistle: Thought I already fixed it :D I do: [code]public dynamic Process(IHttpRequest request) { HttpParam httpParam = request.Param; string programId = httpParam["programId"].Value; if (programId == null) throw new BadRequestException("CancelSchedule: programId is null"); int programIdInt; if (!int.TryParse(programId, out programIdInt)) throw new BadRequestException(string.Format("CancelSchedule: Couldn't parse programId to int: {0}", programId)); if (!ServiceRegistration.IsRegistered<ITvProvider>()) throw new BadRequestException("CancelSchedule: ITvProvider not found"); IProgramInfo programInfo = ServiceRegistration.Get<ITvProvider>() as IProgramInfo; IScheduleControl scheduleControl = ServiceRegistration.Get<ITvProvider>() as IScheduleControl; IProgram program; programInfo.GetProgram(programIdInt, out program); bool result = scheduleControl.RemoveScheduleForProgram(program, ScheduleRecordingType.Once); // TODO: not sure if ScheduleRecordingType is right return new WebBoolResult { Result = result }; }[/code] I only throw the error if the id is null or couldn't be parsed. I will create a new build with the Genre fix :) [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
Plugin Development
Featured Plugins
MP2Extended
Plugin: MP2Extended
Contact us
RSS
Top
Bottom