External Control Plugin for MP (1 Viewer)

samuel337

Portal Pro
August 25, 2004
772
0
Melbourne, Australia
I have noticed heaps and heaps of threads on these forums about controlling MP from outside of it, whether from a web interface, another program etc.

I have wanted to do this for a while, and I have finally had a bit of time to pull together something. I have created a plugin for MP that allows other programs to communicate with it via a HTTP port. Only basic functionality has been included at the time being (right now you can do all the actions you can normally do with a remote), but given that the plugin has full access to MP, there is basically no limit to what it can control in MP. It works regardless of whether MP has focus or not.

For those technically minded, I have used .NET remoting to accomplish this.

Anyway, here's the plugin so far for you guys to have a go!

Download it at http://members.dinkum.net.au/plai33/MPExtControlPlugin.zip

Instructions are in the readme file in the zip.

I have a web service version running on my computer as well, but I'm trying to make it easier to install first. But with the web service, the problem that people are having with making MP refresh recording data can be solved!

This plugin can also help with people making a Pocket PC remote for MP that works via WiFi.

Hope it works! Please post back thoughts/comments/bugs/errors etc.

It is not finished and further testing by me has shown that it is not 100% workable - it can bring down MP. So please try this, but be aware that it can crash MP.

BTW, jadz is this sort of overlapping what the winlirc plugin does?, because after reading some stuff on that I still don't get what all the server and client stuff it can do. I don't want to create something that you're already doing, that's all.

Sam
 

johnbobjamesson

Portal Pro
June 17, 2004
91
0
Crailsheim
if this is going to work on a web based client, I'll lift you up right on position 3 in my personal list of MP heros. Right after frodo and fred ;-) Can only be beaten by agree and a working mail plugin with spam filter...

J.
 

samuel337

Portal Pro
August 25, 2004
772
0
Melbourne, Australia
frodo, if you're reading this, is there a better way trigger actions in MP? Right now, the plugin receives the message from an external source, then uses the GUIWindowManager.OnAction function to trigger the action. The action class given to OnAction only contains the action number. Are the other parameters required?

This causes problems sometimes e.g. when sending the SELECT_ITEM action to MyTVHome to go to the TVGuide screen - it crashes MP for some reason, I'll have to investigate later.

Is there a better way to trigger actions (apart from using SendKeys)?

Sam
 
A

Anonymous

Guest
http://www.xlobby.com/

maybe it helps to look at Xlobby,
i'm not sure but it looks like a way to cover the communication via http on a pocketpc using hardkey's and soft(web) key's.

greetings
 

samuel337

Portal Pro
August 25, 2004
772
0
Melbourne, Australia
Just thought I'd let you guys know, I'm working on a web interface for MP which uses my plugin. I know maschine is doing this as well, and I would have loved to use his code, however my solution is in ASP.NET and his is in PHP, so I couldn't. The difference between my solution and his is that my one can communicate with MP - I'm working on controlling the music playlists in MP at the moment.

Maschine - I didn't want to undermine your efforts, but I don't think my plugin works with non-.net languages.

Sam
 

FullMoon

Portal Member
October 10, 2004
38
0
Tested it out on the same machine, some observations

Move up and down work fine

The first time I had it select a song it played. The second time and every time after, this exception came up (at bottom)

play, music play, ff, rew stop pause all don't work but no exception

Did not try over network yet. Skin is crystal

I am thrilled you are working on this. An app where you can assign the commands to buttons would be awesome. If you could have it send the contents of the page you are in so we could see it (I think this is what you had in mind) on our pocket pc or networked pc, then we could control a playlist (actually see the playlist and choose accordingly). I am thinking of Webamp and the way it works with Winamp. I currently use that to control my music collection from my PocketPC, this would be superior. You could control movie playback, etc.

It would be great to be able to see info from plugins like the recipe plugin on a pocketpc etc.

Anyway, here's that exception.

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.InvalidCastException: QueryInterface for interface Microsoft.MediaPlayer.Interop.IWMPPlayer4 failed.

Server stack trace:
at Microsoft.MediaPlayer.Interop.WindowsMediaPlayerClass.get_controls()
at AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer.get_Ctlcontrols()
at MediaPortal.Player.AudioPlayerWMP9.Stop()
at MediaPortal.Player.g_Player.Play(String strFile)
at MediaPortal.Playlists.PlayListPlayer.Play(Int32 iSong)
at MediaPortal.GUI.Music.GUIMusicFiles.OnClick(Int32 iItem)
at MediaPortal.GUI.Music.GUIMusicFiles.OnMessage(GUIMessage message)
at MediaPortal.GUI.Library.GUIWindowManager.SendMessage(GUIMessage message)
at MediaPortal.GUI.Library.GUIListControl.OnAction(Action action)
at MediaPortal.GUI.Library.GUIFacadeControl.OnAction(Action action)
at MediaPortal.GUI.Library.GUIWindow.OnAction(Action action)
at MediaPortal.GUI.Music.GUIMusicFiles.OnAction(Action action)
at MediaPortal.GUI.Library.GUIWindowManager.OnAction(Action action)
at ExtControlAssembly.DataTransport.SendCommand(CommandTypes CommandType, String Argument)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at ExtControlAssembly.DataTransport.SendCommand(CommandTypes CommandType, String Argument)
at ExtControlLocalDemo.Form1.Button1_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
ExtControlLocalDemo
Assembly Version: 1.0.1792.42650
Win32 Version: 1.0.1792.42650
CodeBase: file:///C:/Documents%20and%20Settings/rskurato.ARGLTUSG80836/My%20Documents/A/bm/MPExtControlPlugin/Demo%20Utility/ExtControlDemo.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Data
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.runtime.remoting/1.0.5000.0__b77a5c561934e089/system.runtime.remoting.dll
----------------------------------------
ExtControlAssembly
Assembly Version: 1.0.1793.3847
Win32 Version: 1.0.1793.3847
CodeBase: file:///C:/Documents%20and%20Settings/rskurato.ARGLTUSG80836/My%20Documents/A/bm/MPExtControlPlugin/Demo%20Utility/ExtControlAssembly.DLL
----------------------------------------
Core
Assembly Version: 1.0.1792.40931
Win32 Version: 1.0.1792.40931
CodeBase: file:///C:/Documents%20and%20Settings/rskurato.ARGLTUSG80836/My%20Documents/A/bm/MPExtControlPlugin/Demo%20Utility/Core.DLL
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.3052.4
CodeBase: file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
----------------------------------------
amrfm-gy
Assembly Version: 0.0.0.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Runtime.Serialization.Formatters.Soap
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.runtime.serialization.formatters.soap/1.0.5000.0__b03f5f7f11d50a3a/system.runtime.serialization.formatters.soap.dll
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
 

samuel337

Portal Pro
August 25, 2004
772
0
Melbourne, Australia
That's the whole point edgarmoon!

As of yet, I do not have a pocket pc, so there is little point for me to develop a program for that (it is possible with an emulator though, but its pointless). If any one wants to give it a go, I'd be happy to help them.

I have noticed that the action thing doesn't work properly all the time - I'm suspecting that I'm not send the actions properly. I will have another look at that and will fix it. Doing it over the network will make no difference. The exceptions are all different (I get one when I try to view the tvguide) so I must be doing something wrong...

I have recently implemented methods into the plugin which allow you to control playlists. But I haven't tested it yet.

My overall goal is to enable all of mediaportal's functionality to be available from external devices, be it from a pocket pc, or a website. Currently my immediate goal is to work with Maschine to implement it with his webscheduler. I hope that that interface will be expanded and will incorporate facilities to change playlists, select music, select videos, view video info etc.

Sam
 

Users who are viewing this thread

Top Bottom