diff --git a/Installer/WifiRemote_1_2_Installer.xmp2 b/Installer/WifiRemote_1_2_Installer.xmp2 index d10c1ef..715289e 100644 --- a/Installer/WifiRemote_1_2_Installer.xmp2 +++ b/Installer/WifiRemote_1_2_Installer.xmp2 @@ -187,7 +187,7 @@ Click Next to continue or Cancel to exit Setup. 0 8 - 0 + 1 0 WifiRemote is a process plugin for the popular opensource mediacenter software "MediaPortal". @@ -197,28 +197,17 @@ Click Next to continue or Cancel to exit Setup. It publishes a Bonjour Service on your local network which allows clients (for example an iPhone or Android app) to list all found MediaPortal installations and connect to it. Developers: The WifiRemote source code moved to github! Please go to https://github.com/MPExtended/WifiRemote to check it out and feel free to fork and submit pull requests! -New in 0.8: -- api level increased to 14 -- MediaPortal 1.6 only, switched to .NET 4 -- Request a screenshot with the screenshot command -- Fixed missing text in dialogs -- Fixed crash related to music db changes in MediaPortal 1.6 (thanks, sebastiii!) -- Fixed crash when encountering music with special chars in it (thanks, Martin K.!) -- Added Artist to now playing radio message (thanks, johanj!) -- Added methods for setting playlist repeat and shuffle (thanks, johanj!) -- Improved starting radio channel (thanks, johanj!) -- Send open dialogs to connecting clients -- Send facade info to connecting clients -- Added ViewType property to FacadeInfo message -- Added support for the trakt plugin rating dialog - - - +New in 0.8.1: +- api level increased to 15 +- added "ok" dialog to ShowDialogs +- fixed tv now playing message braking zero button for switching to previous channels (thanks johanj!) +- fixed crash when using MediaPortal screen blanking (thanks johanj!) +- added MediaPortal compatibility checks Stable - https://github.com/MPExtended/WifiRemote/releases/download/0.8/WifiRemote_0.8.mpe1 - 2014-01-03T20:16:04 + https://github.com/MPExtended/WifiRemote/releases/download/0.8.1/WifiRemote_0.8.1.mpe1 + 2014-02-15T20:16:04 remote, wifi, json, client control - WifiRemote_0.8.mpe1 + WifiRemote_0.8.1.mpe1 diff --git a/Libs/TvControl.dll b/Libs/TvControl.dll new file mode 100644 index 0000000..d26dcbc Binary files /dev/null and b/Libs/TvControl.dll differ diff --git a/Sources/DemoClient/DemoClient.csproj b/Sources/DemoClient/DemoClient.csproj index 11afcbc..311c882 100644 --- a/Sources/DemoClient/DemoClient.csproj +++ b/Sources/DemoClient/DemoClient.csproj @@ -51,6 +51,7 @@ + Form diff --git a/Sources/DemoClient/Messages/MessageShowDialog.cs b/Sources/DemoClient/Messages/MessageShowDialog.cs new file mode 100644 index 0000000..39e6e84 --- /dev/null +++ b/Sources/DemoClient/Messages/MessageShowDialog.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace DemoClient +{ + class MessageShowDialog : IMessage + { + String type = "showdialog"; + public String Type + { + get { return type; } + } + + public String AutologinKey + { + get; + set; + } + + public String DialogType + { + get { return "ok"; } + } + + public String Title + { + get { return "Message from DemoClient"; } + } + + public String Text + { + get { return "This is an OK dialog. Oh myy!"; } + } + } +} diff --git a/Sources/DemoClient/Remote.Designer.cs b/Sources/DemoClient/Remote.Designer.cs index 6b80206..b25c808 100644 --- a/Sources/DemoClient/Remote.Designer.cs +++ b/Sources/DemoClient/Remote.Designer.cs @@ -60,6 +60,7 @@ private void InitializeComponent() this.sQLMusicTestToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.loadPlaylistToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); + this.showOKDialogToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); @@ -393,7 +394,8 @@ private void InitializeComponent() this.requestNowPlayingInfoToolStripMenuItem, this.tVChannelSwitchToolStripMenuItem, this.sQLMusicTestToolStripMenuItem, - this.loadPlaylistToolStripMenuItem}); + this.loadPlaylistToolStripMenuItem, + this.showOKDialogToolStripMenuItem}); this.toolStripDropDownButton1.Image = global::DemoClient.Properties.Resources.options; this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripDropDownButton1.Name = "toolStripDropDownButton1"; @@ -447,6 +449,13 @@ private void InitializeComponent() this.toolStripStatusLabel1.Text = "Select server to connect"; this.toolStripStatusLabel1.Click += new System.EventHandler(this.toolStripStatusLabel1_Click); // + // showOKDialogToolStripMenuItem + // + this.showOKDialogToolStripMenuItem.Name = "showOKDialogToolStripMenuItem"; + this.showOKDialogToolStripMenuItem.Size = new System.Drawing.Size(208, 22); + this.showOKDialogToolStripMenuItem.Text = "Show OK Dialog"; + this.showOKDialogToolStripMenuItem.Click += new System.EventHandler(this.showOKDialogToolStripMenuItem_Click); + // // Remote // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -509,6 +518,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem tVChannelSwitchToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem sQLMusicTestToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem loadPlaylistToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem showOKDialogToolStripMenuItem; } } diff --git a/Sources/DemoClient/Remote.cs b/Sources/DemoClient/Remote.cs index 3de6235..80817eb 100644 --- a/Sources/DemoClient/Remote.cs +++ b/Sources/DemoClient/Remote.cs @@ -430,6 +430,11 @@ private void requestNowPlayingInfoToolStripMenuItem_Click(object sender, EventAr SendCommand(new MessageRequestNowPlaying(), socket); } + private void showOKDialogToolStripMenuItem_Click(object sender, EventArgs e) + { + SendCommand(new MessageShowDialog(), socket); + } + private void showConsoleWindowToolStripMenuItem_Click(object sender, EventArgs e) { if (logWindow.Visible) @@ -659,5 +664,7 @@ public void Log(string statusLabelText, string logWindowText, string toolStripTe } #endregion + + } } diff --git a/Sources/WifiRemote/Core/SocketServer.cs b/Sources/WifiRemote/Core/SocketServer.cs index b6acbbd..c6e405c 100644 --- a/Sources/WifiRemote/Core/SocketServer.cs +++ b/Sources/WifiRemote/Core/SocketServer.cs @@ -573,6 +573,12 @@ void newSocket_DidRead(AsyncSocket sender, byte[] data, long tag) { // Turn on display keybd_event(VK_LSHIFT, 0x45, KEYEVENTF_KEYUP, 0); + if (GUIGraphicsContext.BlankScreen) + { + WifiRemote.LogMessage("Blank screen active, turn on screen", WifiRemote.LogType.Debug); + GUIGraphicsContext.BlankScreen = false; + GUIGraphicsContext.ResetLastActivity(); + } // Send a command if (type == "command") @@ -914,6 +920,13 @@ void newSocket_DidRead(AsyncSocket sender, byte[] data, long tag) // Turn on display keybd_event(VK_LSHIFT, 0x45, KEYEVENTF_KEYUP, 0); + if (GUIGraphicsContext.BlankScreen) + { + WifiRemote.LogMessage("Blank screen active, turn on screen", WifiRemote.LogType.Debug); + GUIGraphicsContext.BlankScreen = false; + GUIGraphicsContext.ResetLastActivity(); + } + if (WifiRemote.IsAvailableNotificationBar && ShowNotifications) { diff --git a/Sources/WifiRemote/Core/WifiRemote.cs b/Sources/WifiRemote/Core/WifiRemote.cs index 973e0f2..4b8d3be 100644 --- a/Sources/WifiRemote/Core/WifiRemote.cs +++ b/Sources/WifiRemote/Core/WifiRemote.cs @@ -18,6 +18,7 @@ using MediaPortal.Dialogs; using WifiRemote.MPDialogs; using WifiRemote.Messages; +using WifiRemote.PluginConnection; namespace WifiRemote { @@ -333,7 +334,14 @@ public void Start() g_Player.PlayBackEnded += new g_Player.EndedHandler(g_Player_PlayBackEnded); g_Player.PlayBackStopped += new g_Player.StoppedHandler(g_Player_PlayBackStopped); g_Player.PlayBackChanged += new g_Player.ChangedHandler(g_Player_PlayBackChanged); - g_Player.TVChannelChanged += new g_Player.TVChannelChangeHandler(g_Player_TVPlayBackChanged); + + // Only subscribe to the tv channel changed callback if the tv plugin is installed. + // Argus users will experience crashes otherwise. + if (WifiRemote.IsAvailableTVPlugin) + { + g_Player.TVChannelChanged += new g_Player.TVChannelChangeHandler(g_Player_TVPlayBackChanged); + } + GUIWindowManager.Receivers += new SendMessageHandler(GUIWindowManager_Receivers); @@ -606,10 +614,9 @@ void g_Player_PlayBackChanged(g_Player.MediaType type, int stoptime, string file /// void g_Player_TVPlayBackChanged() { - TvPlugin.TVHome.Navigator.UpdateCurrentChannel(); - TvDatabase.Channel current = TvPlugin.TVHome.Navigator.Channel; + TvDatabase.Channel current = MpTvServerHelper.GetCurrentTimeShiftingTVChannel(); - if (socketServer != null && (LatestChannelId == -1 || LatestChannelId != current.IdChannel)) + if (socketServer != null && current != null && (LatestChannelId == -1 || LatestChannelId != current.IdChannel)) { LatestChannelId = current.IdChannel; LogMessage("TV Playback changed!", LogType.Debug); diff --git a/Sources/WifiRemote/MPDialogs/ShowDialogHelper.cs b/Sources/WifiRemote/MPDialogs/ShowDialogHelper.cs index 047f32f..5b8d3eb 100644 --- a/Sources/WifiRemote/MPDialogs/ShowDialogHelper.cs +++ b/Sources/WifiRemote/MPDialogs/ShowDialogHelper.cs @@ -38,6 +38,24 @@ internal static void ShowYesNoDialog(string dialogId, string title, string text, socketServer.SendMessageToClient(result, sender); } } + + /// + /// Show an ok dialog in MediaPortal + /// + /// Dialog title + /// Dialog text + internal static void ShowOkDialog(string title, string text) + { + GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); + if (dlg != null) + { + dlg.Reset(); + dlg.SetHeading(title); + dlg.SetLine(1, text); + dlg.DoModal(GUIWindowManager.ActiveWindow); + } + } + /// /// Show a select dialog in MediaPortal. After that, send the result to the sender. /// diff --git a/Sources/WifiRemote/MPDialogs/ShowDialogMessageHandler.cs b/Sources/WifiRemote/MPDialogs/ShowDialogMessageHandler.cs index 1c8dbe2..c6b01c5 100644 --- a/Sources/WifiRemote/MPDialogs/ShowDialogMessageHandler.cs +++ b/Sources/WifiRemote/MPDialogs/ShowDialogMessageHandler.cs @@ -33,6 +33,10 @@ internal static void HandleShowDialogMessage(Newtonsoft.Json.Linq.JObject messag //show dialog in new thread so we don't block the tcp thread new Thread(new ParameterizedThreadStart(ShowYesNoThreaded)).Start(new object[] { dialogId, title, text, socketServer, sender }); } + else if (dialogType.Equals("ok")) + { + new Thread(new ParameterizedThreadStart(ShowOkDialogThreaded)).Start(new object[] { title, text }); + } else if (dialogType.Equals("yesnoselect")) { List options = new List(); @@ -46,7 +50,7 @@ internal static void HandleShowDialogMessage(Newtonsoft.Json.Linq.JObject messag } //show dialog in new thread so we don't block the tcp thread - new Thread(new ParameterizedThreadStart(ShowYesNoThenSelectThreaded)).Start(new object[] { dialogId, title, text, options, socketServer, sender }); + new Thread(new ParameterizedThreadStart(ShowYesNoThenSelectThreaded)).Start(new object[] { dialogId, title, text, options, socketServer, sender }); } else if (dialogType.Equals("select")) { @@ -84,6 +88,12 @@ private static void ShowYesNoThreaded(object pars) ShowDialogHelper.ShowYesNoDialog((string)parameters[0], (string)parameters[1], (string)parameters[2], (SocketServer)parameters[3], (Deusty.Net.AsyncSocket)parameters[4]); } + private static void ShowOkDialogThreaded(object pars) + { + object[] parameters = (object[])pars; + ShowDialogHelper.ShowOkDialog((string)parameters[0], (string)parameters[1]); + } + /// /// Show yes/no-then-select dialog from a new thread /// diff --git a/Sources/WifiRemote/Messages/MessageNowPlaying.cs b/Sources/WifiRemote/Messages/MessageNowPlaying.cs index e57e2b0..7d893f3 100644 --- a/Sources/WifiRemote/Messages/MessageNowPlaying.cs +++ b/Sources/WifiRemote/Messages/MessageNowPlaying.cs @@ -187,27 +187,20 @@ public IAdditionalNowPlayingInfo MediaInfo } } } - else if (g_Player.IsTV) + else if (g_Player.IsTV && WifiRemote.IsAvailableTVPlugin) { - if (!WifiRemote.IsAvailableTVPlugin) + if (g_Player.IsTVRecording) { - WifiRemote.LogMessage("No TVPlugin installed: can't add now playing", WifiRemote.LogType.Error); + NowPlayingRecording recording = MpTvServerHelper.GetNowPlayingRecording(); + + if (recording.IsRecording()) + { + return recording; + } } else { - if (g_Player.IsTVRecording) - { - NowPlayingRecording recording = MpTvServerHelper.GetNowPlayingRecording(); - - if (recording.IsRecording()) - { - return recording; - } - } - else - { - return MpTvServerHelper.GetNowPlayingTv(); - } + return MpTvServerHelper.GetNowPlayingTv(); } } } diff --git a/Sources/WifiRemote/Messages/MessageWelcome.cs b/Sources/WifiRemote/Messages/MessageWelcome.cs index 66ceaaf..0121cb1 100644 --- a/Sources/WifiRemote/Messages/MessageWelcome.cs +++ b/Sources/WifiRemote/Messages/MessageWelcome.cs @@ -10,7 +10,7 @@ namespace WifiRemote class MessageWelcome : IMessage { string type = "welcome"; - int server_version = 14; + int server_version = 15; AuthMethod authMethod = AuthMethod.UserPassword; /// diff --git a/Sources/WifiRemote/Messages/Now Playing/NowPlayingTv.cs b/Sources/WifiRemote/Messages/Now Playing/NowPlayingTv.cs index 5288e2c..7c996b2 100644 --- a/Sources/WifiRemote/Messages/Now Playing/NowPlayingTv.cs +++ b/Sources/WifiRemote/Messages/Now Playing/NowPlayingTv.cs @@ -6,6 +6,7 @@ using System.IO; using System.Drawing; using WifiRemote.MpExtended; +using WifiRemote.PluginConnection; namespace WifiRemote { @@ -145,29 +146,31 @@ public DateTime NextProgramEnd /// public NowPlayingTv() { - TvPlugin.TVHome.Navigator.UpdateCurrentChannel(); - TvDatabase.Channel current = TvPlugin.TVHome.Navigator.Channel; - ChannelId = current.IdChannel; - ChannelName = current.DisplayName; - - if (current.CurrentProgram != null) + TvDatabase.Channel current = MpTvServerHelper.GetCurrentTimeShiftingTVChannel(); + if (current != null) { - CurrentProgramId = current.CurrentProgram.IdProgram; - CurrentProgramName = current.CurrentProgram.Title; - CurrentProgramDescription = current.CurrentProgram.Description; - CurrentProgramBegin = current.CurrentProgram.StartTime; - CurrentProgramEnd = current.CurrentProgram.EndTime; - } - if (current.NextProgram != null) - { - NextProgramId = current.NextProgram.IdProgram; - NextProgramName = current.NextProgram.Title; - NextProgramDescription = current.NextProgram.Description; - NextProgramBegin = current.NextProgram.StartTime; - NextProgramEnd = current.NextProgram.EndTime; + ChannelId = current.IdChannel; + ChannelName = current.DisplayName; + + if (current.CurrentProgram != null) + { + CurrentProgramId = current.CurrentProgram.IdProgram; + CurrentProgramName = current.CurrentProgram.Title; + CurrentProgramDescription = current.CurrentProgram.Description; + CurrentProgramBegin = current.CurrentProgram.StartTime; + CurrentProgramEnd = current.CurrentProgram.EndTime; + } + + if (current.NextProgram != null) + { + NextProgramId = current.NextProgram.IdProgram; + NextProgramName = current.NextProgram.Title; + NextProgramDescription = current.NextProgram.Description; + NextProgramBegin = current.NextProgram.StartTime; + NextProgramEnd = current.NextProgram.EndTime; + } } - } } } diff --git a/Sources/WifiRemote/PluginConnection/MpTvServerHelper.cs b/Sources/WifiRemote/PluginConnection/MpTvServerHelper.cs index eaffbfc..81e8c39 100644 --- a/Sources/WifiRemote/PluginConnection/MpTvServerHelper.cs +++ b/Sources/WifiRemote/PluginConnection/MpTvServerHelper.cs @@ -6,6 +6,7 @@ using MediaPortal.Player; using TvDatabase; using MediaPortal.Util; +using TvPlugin; namespace WifiRemote.PluginConnection { @@ -224,6 +225,20 @@ internal static NowPlayingRadio GetNowPlayingRadio() NowPlayingRadio radio = new NowPlayingRadio(); return radio; } - + + internal static TvDatabase.Channel GetCurrentTimeShiftingTVChannel() + { + if (TVHome.Connected && TVHome.Card.IsTimeShifting) + { + int id = TVHome.Card.IdChannel; + if (id >= 0) + { + TvDatabase.Channel current = TvDatabase.Channel.Retrieve(id); + return current; + } + } + return null; + } + } } diff --git a/Sources/WifiRemote/Properties/AssemblyInfo.cs b/Sources/WifiRemote/Properties/AssemblyInfo.cs index db485b5..a97b70b 100644 --- a/Sources/WifiRemote/Properties/AssemblyInfo.cs +++ b/Sources/WifiRemote/Properties/AssemblyInfo.cs @@ -7,11 +7,17 @@ // Version Compatibility // http://wiki.team-mediaportal.com/1_MEDIAPORTAL_1/18_Contribute/6_Plugins/Plugin_Related_Changes/1.1.0_to_1.2.0/Version_Compatibility [assembly: CompatibleVersion("1.5.100.0", "1.1.6.27644")] -//[assembly: UsesSubsystem("MP.DB.Music")] -//[assembly: UsesSubsystem("MP.DB.Videos")] -//[assembly: UsesSubsystem("MP.Config")] -//[assembly: UsesSubsystem("MP.Input.Mapping")] -//[assembly: UsesSubsystem("MP.Players")] +[assembly: UsesSubsystem("MP.SkinEngine")] +[assembly: UsesSubsystem("MP.Input")] +[assembly: UsesSubsystem("MP.Players")] +[assembly: UsesSubsystem("MP.Config")] +[assembly: UsesSubsystem("MP.Plugins.Music")] +[assembly: UsesSubsystem("MP.Plugins.Videos")] +[assembly: UsesSubsystem("MP.Plugins.TV")] + +// Makes the plugin incompatible when no tv server installed +// Need to find a solution for that. +// [assembly: UsesSubsystem("MP.TVE")] // Allgemeine Informationen über eine Assembly werden über die folgenden // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, @@ -43,5 +49,5 @@ // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.8.0.0")] -[assembly: AssemblyFileVersion("0.8.0.0")] +[assembly: AssemblyVersion("0.8.1.0")] +[assembly: AssemblyFileVersion("0.8.1.0")] diff --git a/Sources/WifiRemote/WifiRemote.csproj b/Sources/WifiRemote/WifiRemote.csproj index 5c0e6c0..e29a6b7 100644 --- a/Sources/WifiRemote/WifiRemote.csproj +++ b/Sources/WifiRemote/WifiRemote.csproj @@ -110,6 +110,10 @@ ..\..\Libs\TraktPlugin.dll + + False + ..\..\Libs\TvControl.dll + False ..\..\Libs\TVDatabase.dll