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 1
Development
Improvement Suggestions
4994: Automatically Change Channel on Program Reminder
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="vapourEyes" data-source="post: 1305479" data-attributes="member: 143065"><p>I'm very sorry I have not done a GIT Merge etc. I'm posting the code that now works here, for my reference too.</p><p></p><p>Code Vector: TvHome.cs:1835.</p><p></p><p>[CODE=csharp] case GUIMessage.MessageType.GUI_MSG_NOTIFY_TV_PROGRAM:</p><p> {</p><p> bool isPaused = g_Player.Paused;</p><p> </p><p> TVNotifyYesNoDialog tvNotifyDlg = (TVNotifyYesNoDialog)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_TVNOTIFYYESNO);</p><p></p><p> TVProgramDescription notify = message.Object as TVProgramDescription;</p><p> if (tvNotifyDlg == null || notify == null)</p><p> {</p><p> return;</p><p> }</p><p> int minUntilStart = _preNotifyConfig / 60;</p><p> if (notify.StartTime > DateTime.Now)</p><p> {</p><p> if (minUntilStart > 1)</p><p> {</p><p> tvNotifyDlg.SetHeading(String.Format(GUILocalizeStrings.Get(1018), minUntilStart));</p><p> }</p><p> else</p><p> {</p><p> tvNotifyDlg.SetHeading(1019); // Program is about to begin</p><p> }</p><p> }</p><p> else</p><p> {</p><p> tvNotifyDlg.SetHeading(String.Format(GUILocalizeStrings.Get(1206), (DateTime.Now - notify.StartTime).Minutes.ToString()));</p><p> }</p><p> tvNotifyDlg.SetLine(1, notify.Title);</p><p> tvNotifyDlg.SetLine(2, notify.Description);</p><p> tvNotifyDlg.SetLine(4, String.Format(GUILocalizeStrings.Get(1207), notify.Channel.DisplayName));</p><p> Channel c = notify.Channel;</p><p> string strLogo = string.Empty;</p><p> if (c.IsTv)</p><p> {</p><p> strLogo = MediaPortal.Util.Utils.GetCoverArt(Thumbs.TVChannel, c.DisplayName);</p><p> }</p><p> else if (c.IsRadio)</p><p> {</p><p> strLogo = MediaPortal.Util.Utils.GetCoverArt(Thumbs.Radio, c.DisplayName);</p><p> }</p><p></p><p> tvNotifyDlg.SetImage(strLogo);</p><p> tvNotifyDlg.TimeOut = _notifyTVTimeout;</p><p> if (_playNotifyBeep)</p><p> {</p><p> MediaPortal.Util.Utils.PlaySound("notify.wav", false, true);</p><p> }</p><p> tvNotifyDlg.SetDefaultToYes(_changeChannelOnNotifyTimeout);</p><p> tvNotifyDlg.DoModal(GUIWindowManager.ActiveWindow);</p><p></p><p> if (tvNotifyDlg.IsConfirmed)</p><p> {</p><p> try</p><p> {</p><p> //MediaPortal.Player.g_Player.Stop();</p><p></p><p> if (c.IsTv)</p><p> {</p><p> MediaPortal.GUI.Library.GUIWindowManager.ActivateWindow((int)MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_TV);</p><p> g_Player.ShowFullScreenWindow();</p><p> TVHome.ViewChannelAndCheck(c);</p><p> //if (TVHome.Card.IsTimeShifting && TVHome.Card.IdChannel == c.IdChannel)</p><p> //{</p><p> //}</p><p> }</p><p> else if (c.IsRadio)</p><p> {</p><p> MediaPortal.GUI.Library.GUIWindowManager.ActivateWindow((int)MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_RADIO);</p><p> Radio.CurrentChannel = c;</p><p> Radio.Play();</p><p> }</p><p></p><p> if (isPaused)</p><p> {</p><p> Thread.Sleep(5000);</p><p> g_Player.Pause();</p><p> }</p><p> }</p><p></p><p> catch (Exception e)</p><p> {</p><p> Log.Error("TVHome: TVNotification: Error on starting channel {0} after notification: {1} {2} {3}", notify.Channel.DisplayName, e.Message, e.Source, e.StackTrace);</p><p> }</p><p></p><p> }</p><p> break;</p><p> }</p><p> }</p><p> }[/CODE]</p></blockquote><p></p>
[QUOTE="vapourEyes, post: 1305479, member: 143065"] I'm very sorry I have not done a GIT Merge etc. I'm posting the code that now works here, for my reference too. Code Vector: TvHome.cs:1835. [CODE=csharp] case GUIMessage.MessageType.GUI_MSG_NOTIFY_TV_PROGRAM: { bool isPaused = g_Player.Paused; TVNotifyYesNoDialog tvNotifyDlg = (TVNotifyYesNoDialog)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_TVNOTIFYYESNO); TVProgramDescription notify = message.Object as TVProgramDescription; if (tvNotifyDlg == null || notify == null) { return; } int minUntilStart = _preNotifyConfig / 60; if (notify.StartTime > DateTime.Now) { if (minUntilStart > 1) { tvNotifyDlg.SetHeading(String.Format(GUILocalizeStrings.Get(1018), minUntilStart)); } else { tvNotifyDlg.SetHeading(1019); // Program is about to begin } } else { tvNotifyDlg.SetHeading(String.Format(GUILocalizeStrings.Get(1206), (DateTime.Now - notify.StartTime).Minutes.ToString())); } tvNotifyDlg.SetLine(1, notify.Title); tvNotifyDlg.SetLine(2, notify.Description); tvNotifyDlg.SetLine(4, String.Format(GUILocalizeStrings.Get(1207), notify.Channel.DisplayName)); Channel c = notify.Channel; string strLogo = string.Empty; if (c.IsTv) { strLogo = MediaPortal.Util.Utils.GetCoverArt(Thumbs.TVChannel, c.DisplayName); } else if (c.IsRadio) { strLogo = MediaPortal.Util.Utils.GetCoverArt(Thumbs.Radio, c.DisplayName); } tvNotifyDlg.SetImage(strLogo); tvNotifyDlg.TimeOut = _notifyTVTimeout; if (_playNotifyBeep) { MediaPortal.Util.Utils.PlaySound("notify.wav", false, true); } tvNotifyDlg.SetDefaultToYes(_changeChannelOnNotifyTimeout); tvNotifyDlg.DoModal(GUIWindowManager.ActiveWindow); if (tvNotifyDlg.IsConfirmed) { try { //MediaPortal.Player.g_Player.Stop(); if (c.IsTv) { MediaPortal.GUI.Library.GUIWindowManager.ActivateWindow((int)MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_TV); g_Player.ShowFullScreenWindow(); TVHome.ViewChannelAndCheck(c); //if (TVHome.Card.IsTimeShifting && TVHome.Card.IdChannel == c.IdChannel) //{ //} } else if (c.IsRadio) { MediaPortal.GUI.Library.GUIWindowManager.ActivateWindow((int)MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_RADIO); Radio.CurrentChannel = c; Radio.Play(); } if (isPaused) { Thread.Sleep(5000); g_Player.Pause(); } } catch (Exception e) { Log.Error("TVHome: TVNotification: Error on starting channel {0} after notification: {1} {2} {3}", notify.Channel.DisplayName, e.Message, e.Source, e.StackTrace); } } break; } } }[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
Improvement Suggestions
4994: Automatically Change Channel on Program Reminder
Contact us
RSS
Top
Bottom