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: 1162684" data-attributes="member: 107846"><p>If you are bored <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" /> i have some special wishes for some changes i've made to MPExtended for Emby</p><p>that i'd like to see in MP2Extended also:</p><p><span style="color: #0080ff"><a href="https://github.com/puenktchen/MPExtended/commit/01563d4126768ec153f6e14fbb0989e4f84f0bca" target="_blank">Services/MPExtended.Services.TVAccessService/TVAccessService.cs</a></span></p><p><span style="color: #0080ff">[CODE=C#]public WebBoolResult UnCancelSchedule(int programId)</span></p><p><span style="color: #0080ff">{</span></p><p><span style="color: #0080ff"> try</span></p><p><span style="color: #0080ff"> {</span></p><p><span style="color: #0080ff"> Log.Debug("Uncancelling schedule for programId {0}", programId);</span></p><p><span style="color: #0080ff"> var program = Program.Retrieve(programId);</span></p><p><span style="color: #0080ff"> foreach (Schedule schedule in Schedule.ListAll().Where(schedule => schedule.IsSerieIsCanceled(program.StartTime, program.IdChannel)))</span></p><p><span style="color: #0080ff"> {</span></p><p><span style="color: #0080ff"> schedule.UnCancelSerie(program.StartTime, program.IdChannel);</span></p><p><span style="color: #0080ff"> schedule.Persist();</span></p><p><span style="color: #0080ff"> }</span></p><p><span style="color: #0080ff"></span></p><p><span style="color: #0080ff"> return true;</span></p><p><span style="color: #0080ff"> }</span></p><p><span style="color: #0080ff"> catch (Exception ex)</span></p><p><span style="color: #0080ff"> {</span></p><p><span style="color: #0080ff"> Log.Warn(String.Format("Failed to uncancel schedule for programId {0}", programId), ex);</span></p><p><span style="color: #0080ff"> return false;</span></p><p><span style="color: #0080ff"> }</span></p><p><span style="color: #0080ff">}[/CODE]</span></p><p><span style="color: #0080ff"></span></p><p><span style="color: #0080ff"><a href="https://github.com/puenktchen/MPExtended/commit/2d22d6b3e9da9ba965495c5bd3aa8162c93b89a2" target="_blank">Services/MPExtended.Services.TVAccessService.Interfaces/ITVAccessService.cs</a></span></p><p><span style="color: #0080ff">[CODE=C#][OperationContract]</span></p><p><span style="color: #0080ff">[WebGet(ResponseFormat = WebMessageFormat.Json)]</span></p><p><span style="color: #0080ff">WebBoolResult UnCancelSchedule(int programId);[/CODE]</span></p><p><span style="color: #0080ff"></span></p><p><span style="color: #0080ff"><a href="https://github.com/puenktchen/MPExtended/commit/c8ff72e89c1c1e1608bab0cba331334126f8e6af" target="_blank">Services/MPExtended.Services.StreamingService/StreamingService.cs</a></span></p><p><span style="color: #0080ff">[CODE=C#]public Stream DoStream(WebMediaType type, int? provider, string itemId, string identifier, string clientDescription, string profileName, long startPosition, int? idleTimeout)</span></p><p><span style="color: #0080ff">{</span></p><p><span style="color: #0080ff"> if (!IsClientAuthorized())</span></p><p><span style="color: #0080ff"> {</span></p><p><span style="color: #0080ff"> Log.Warn("Host {0} isn't authorized to call DoStream", WCFUtil.GetClientIPAddress());</span></p><p><span style="color: #0080ff"> WCFUtil.SetResponseCode(HttpStatusCode.Unauthorized);</span></p><p><span style="color: #0080ff"> return Stream.Null;</span></p><p><span style="color: #0080ff"> }</span></p><p><span style="color: #0080ff"></span></p><p><span style="color: #0080ff"> // calculate timeout, which is by default 5 minutes for direct streaming and 5 seconds for transcoded streams</span></p><p><span style="color: #0080ff"> var profile = Configuration.StreamingProfiles.Transcoders.FirstOrDefault(x => x.Name == profileName);</span></p><p><span style="color: #0080ff"> if(profile == null)</span></p><p><span style="color: #0080ff"> {</span></p><p><span style="color: #0080ff"> Log.Warn("Called DoStream with non-existing profile {0}", profileName);</span></p><p><span style="color: #0080ff"> return Stream.Null;</span></p><p><span style="color: #0080ff"> }</span></p><p><span style="color: #0080ff"> int timeout = profile.Transcoder == typeof(Transcoders.Direct).FullName ? 5 * 60 : 5;</span></p><p><span style="color: #0080ff"> if (idleTimeout.HasValue)</span></p><p><span style="color: #0080ff"> timeout = idleTimeout.Value;</span></p><p><span style="color: #0080ff"></span></p><p><span style="color: #0080ff"> // This only works with profiles that actually return something in the RetrieveStream method (i.e. no RTSP or CustomTranscoderData)</span></p><p><span style="color: #0080ff"> StreamLog.Debug(identifier, "DoStream: using timeout={0}", timeout);</span></p><p><span style="color: #0080ff"></span></p><p><span style="color: #0080ff"> if (!InitStream(type, provider, itemId, null, clientDescription, identifier, timeout))</span></p><p><span style="color: #0080ff"> {</span></p><p><span style="color: #0080ff"> StreamLog.Info(identifier, "DoStream: InitStream() failed");</span></p><p><span style="color: #0080ff"> FinishStream(identifier);</span></p><p><span style="color: #0080ff"> return Stream.Null;</span></p><p><span style="color: #0080ff"> }</span></p><p><span style="color: #0080ff"></span></p><p><span style="color: #0080ff"> if (String.IsNullOrEmpty(StartStream(identifier, profileName, startPosition)))</span></p><p><span style="color: #0080ff"> {</span></p><p><span style="color: #0080ff"> StreamLog.Info(identifier, "DoStream: StartStream failed");</span></p><p><span style="color: #0080ff"> FinishStream(identifier);</span></p><p><span style="color: #0080ff"> return Stream.Null;</span></p><p><span style="color: #0080ff"> }</span></p><p><span style="color: #0080ff"></span></p><p><span style="color: #0080ff"> StreamLog.Info(identifier, "DoStream: succeeded, returning stream");</span></p><p><span style="color: #0080ff"> return RetrieveStream(identifier);</span></p><p><span style="color: #0080ff">}[/CODE]</span></p><p><span style="color: #0080ff"></span></p><p><span style="color: #0080ff"></span></p></blockquote><p></p>
[QUOTE="pünktchen, post: 1162684, member: 107846"] If you are bored :D i have some special wishes for some changes i've made to MPExtended for Emby that i'd like to see in MP2Extended also: [COLOR=#0080ff][URL='https://github.com/puenktchen/MPExtended/commit/01563d4126768ec153f6e14fbb0989e4f84f0bca']Services/MPExtended.Services.TVAccessService/TVAccessService.cs[/URL][/COLOR] [COLOR=#0080ff][CODE=C#]public WebBoolResult UnCancelSchedule(int programId) { try { Log.Debug("Uncancelling schedule for programId {0}", programId); var program = Program.Retrieve(programId); foreach (Schedule schedule in Schedule.ListAll().Where(schedule => schedule.IsSerieIsCanceled(program.StartTime, program.IdChannel))) { schedule.UnCancelSerie(program.StartTime, program.IdChannel); schedule.Persist(); } return true; } catch (Exception ex) { Log.Warn(String.Format("Failed to uncancel schedule for programId {0}", programId), ex); return false; } }[/CODE] [URL='https://github.com/puenktchen/MPExtended/commit/2d22d6b3e9da9ba965495c5bd3aa8162c93b89a2']Services/MPExtended.Services.TVAccessService.Interfaces/ITVAccessService.cs[/URL] [CODE=C#][OperationContract] [WebGet(ResponseFormat = WebMessageFormat.Json)] WebBoolResult UnCancelSchedule(int programId);[/CODE] [URL='https://github.com/puenktchen/MPExtended/commit/c8ff72e89c1c1e1608bab0cba331334126f8e6af']Services/MPExtended.Services.StreamingService/StreamingService.cs[/URL] [CODE=C#]public Stream DoStream(WebMediaType type, int? provider, string itemId, string identifier, string clientDescription, string profileName, long startPosition, int? idleTimeout) { if (!IsClientAuthorized()) { Log.Warn("Host {0} isn't authorized to call DoStream", WCFUtil.GetClientIPAddress()); WCFUtil.SetResponseCode(HttpStatusCode.Unauthorized); return Stream.Null; } // calculate timeout, which is by default 5 minutes for direct streaming and 5 seconds for transcoded streams var profile = Configuration.StreamingProfiles.Transcoders.FirstOrDefault(x => x.Name == profileName); if(profile == null) { Log.Warn("Called DoStream with non-existing profile {0}", profileName); return Stream.Null; } int timeout = profile.Transcoder == typeof(Transcoders.Direct).FullName ? 5 * 60 : 5; if (idleTimeout.HasValue) timeout = idleTimeout.Value; // This only works with profiles that actually return something in the RetrieveStream method (i.e. no RTSP or CustomTranscoderData) StreamLog.Debug(identifier, "DoStream: using timeout={0}", timeout); if (!InitStream(type, provider, itemId, null, clientDescription, identifier, timeout)) { StreamLog.Info(identifier, "DoStream: InitStream() failed"); FinishStream(identifier); return Stream.Null; } if (String.IsNullOrEmpty(StartStream(identifier, profileName, startPosition))) { StreamLog.Info(identifier, "DoStream: StartStream failed"); FinishStream(identifier); return Stream.Null; } StreamLog.Info(identifier, "DoStream: succeeded, returning stream"); return RetrieveStream(identifier); }[/CODE] [/COLOR] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
Plugin Development
Featured Plugins
MP2Extended
Plugin: MP2Extended
Contact us
RSS
Top
Bottom