ProcessPlugin - which song is playing in MyMusic? (1 Viewer)

yazybones

New Member
December 13, 2004
2
0
Hi,

To get myself up to speed with how the MediaPortal code works I thought I'd write a very simple process plugin that would display MyMusic's currently playing song/album on my VFD display.

What's the best way to do this? I've tried registering with GUIWindowManager for event notifications, however the GUIMessage objects I receive don't seem to contain the information I need.

Thanks for any help,

Yazybones
 

samuel337

Portal Pro
August 25, 2004
772
0
Melbourne, Australia
I just finished programming the Party Shuffle function a few weeks ago, so I can give you some code to help you along:

Firstly, as you did, register yourself for the event notifications like so:
Code:
GUIWindowManager.Receivers += new SendMessageHandler(this.OnThreadMessage);

Now write some code to handle that event notification (note that if you change the name of this method, you will have to change the above code as well to this.thenewname) :
Code:
		void OnThreadMessage(GUIMessage message)
		{
			switch (message.Message)
			{
				case GUIMessage.MessageType.GUI_MSG_PLAYBACK_STARTED:
						PlayList pl = PlayListPlayer.GetPlaylist(PlayListPlayer.CurrentPlaylist);
						/*Now using pl[PlayListPlayer.CurrentSong] you can get the Description, Duration and FileName of the current song so you can pass it off to your VFD etc. If you want to get the song's album or artist information, you'll have to look it up from the database, using the filename as the search string. */
					} 
					break;
			}
		}

Hope this helps - reply to this topic if you don't get some of the code, I think I know the playlist/music system fairly well...if not, there's always frodo to ask ;-)

Sam
 

Users who are viewing this thread

Top Bottom