INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: SDK Improvements  (Read 5256 times)

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
SDK Improvements
« on: June 28, 2006, 12:32:02 pm »

Would this be a good time to chime in about improvements we'd like to see done to the SDK?

Here's a few:

  • (not really SDK I guess, but) It would be really nice if MC would full pass keypresses through to plugins. For instance...  I can't get Tab Stops to work in any of my plugins unless I hand-code them all. Also, Enter and Escape won't execute their respective buttons (Ok and Cancel)
  • There's some bug in the CreateFiles routine that will crash MC if it's called by more than one plugin - if those plugin are set to only run while visible.
  • Some way of sorting collections using any criteria we want - any type of collection that MC returns, whether it be files, playlists, schemes, etc.
  • Event Broadcasting - It would make so many things so much easier if MC would generate events that we could grab in our plugins
  • The ability to create different types of fields - not just simple strings
  • The ability to determine the type of a particular field - is it a string? a large value? and integer? calculated? etc
  • The ability to create playlists/smartlists
  • Better documentation of some of these functions - for instance - what does SaveToTag really do?

Anybody have any others? I'm sure I'm forgetting a bunch that I encountered while working on my plugins.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
Re: SDK Improvements
« Reply #1 on: June 28, 2006, 12:38:43 pm »

Thanks Doof.

Event broadcasting is there in MC 12.

Documentation will follow in the coming weeks.
Logged
Matt Ashland, JRiver Media Center

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: SDK Improvements
« Reply #2 on: June 28, 2006, 11:31:39 pm »

Quote
Event broadcasting is there in MC 12.

;D ;D ;D ;D ;D

Somewhere, someone is doing a happy dance.
Logged

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: SDK Improvements
« Reply #3 on: July 04, 2006, 09:11:36 am »

When you eventually do the SDK updates, this one would be nice too.

Code: [Select]
Compiling...
MJInputSource.cpp
m:\Projects\Library\MC Input SDK\MJInputSource.cpp(88) : warning C4996: 'ATL::CRegKey::QueryValue' was declared deprecated
        d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlbase.h(4740) : see declaration of 'ATL::CRegKey::QueryValue'
m:\Projects\Library\MC Input SDK\MJInputSource.cpp(103) : warning C4996: 'ATL::CRegKey::QueryValue' was declared deprecated
        d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlbase.h(4740) : see declaration of 'ATL::CRegKey::QueryValue'
m:\Projects\Library\MC Input SDK\MJInputSource.cpp(128) : warning C4996: 'ATL::CRegKey::QueryValue' was declared deprecated
        d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlbase.h(4740) : see declaration of 'ATL::CRegKey::QueryValue'
Logged

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: SDK Improvements
« Reply #4 on: August 11, 2006, 03:59:22 pm »

Just wanted to bump this up.
Logged

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: SDK Improvements
« Reply #5 on: August 16, 2006, 04:21:19 pm »

*bump*

Whoops! Didn't see that, there... :P
Logged

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: SDK Improvements
« Reply #6 on: August 29, 2006, 10:41:28 am »

*bump*
Logged

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: SDK Improvements
« Reply #7 on: October 27, 2006, 01:00:02 pm »

Any word on any of the stuff I mentioned above?

I have an idea for a plugin I'd like to write, but I can't even get started until and unless some of these are implemented...
Logged

Agonostis

  • Regular Member
  • Junior Woodchuck
  • **
  • Posts: 57
Re: SDK Improvements
« Reply #8 on: November 12, 2006, 06:05:54 pm »

bump...

really curious about event broadcasting here.
Logged

johnnyboy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 626
Re: SDK Improvements
« Reply #9 on: November 12, 2006, 06:25:36 pm »

Any word on any of the stuff I mentioned above?

I have an idea for a plugin I'd like to write, but I can't even get started until and unless some of these are implemented...

*bump* Doof - whats the plugin? :D
Logged

Agonostis

  • Regular Member
  • Junior Woodchuck
  • **
  • Posts: 57
Re: SDK Improvements
« Reply #10 on: November 18, 2006, 05:21:21 pm »

another bump for event broadcasting documentation
Logged

KingSparta

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 20062
Re: SDK Improvements
« Reply #11 on: November 19, 2006, 08:38:58 am »

with all them bumps you may get a bruise
Logged
Retired Military, Airborne, Air Assault, And Flight Wings.
Model Trains, Internet, Ham Radio, Music
https://MyAAGrapevines.com
https://centercitybbs.com
Fayetteville, NC, USA

Agonostis

  • Regular Member
  • Junior Woodchuck
  • **
  • Posts: 57
Re: SDK Improvements
« Reply #12 on: November 19, 2006, 09:14:15 pm »

as long as we get some documentation too, i'll take it!
Logged

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: SDK Improvements
« Reply #13 on: November 26, 2006, 10:24:51 pm »

Just another bump...
Logged

JohnT

  • Citizen of the Universe
  • *****
  • Posts: 4627
Re: SDK Improvements
« Reply #14 on: November 29, 2006, 11:38:40 am »

Sorry for the long wait on this. So far we've only been using the events in our own plugins, and only for playlist change notifications. I've pasted below some preliminary documentation referring to handling events from VB.NET. Let me know if you need help sinking events in JavaScript or C++. With anything else, you're on your own :-)
The one event you're probably interested in (track change) was just added, so you won't see those until the next build (12.0.121?). You can get started now though and just rename a playlist to get an event to come through.

Bear with me in the following documentation. I never use VB but I did build a test program and it did catch events. Here you go...


MediaCenter 12 fires an event with three string parameters:
FireMJEvent(string1, string2, string3)

The first parameter is the event type and currently there is just one event type, namely "MJEvent type: MCCommand"
The second parameter identifies the MCC command. See the list below.
The third parameter is optional and may contain information specific to the command.

Here are the commands currently sent to the event handler:
"MCC: NOTIFY_TRACK_CHANGE"
"MCC: NOTIFY_PLAYLIST_ADDED"
"MCC: NOTIFY_PLAYLIST_INFO_CHANGED"
"MCC: NOTIFY_PLAYLIST_FILES_CHANGED"
"MCC: NOTIFY_PLAYLIST_REMOVED"
"MCC: NOTIFY_PLAYLIST_COLLECTION_CHANGED"
"MCC: NOTIFY_PLAYLIST_PROPERTIES_CHANGED"
The track change event is fired whenever a new track starts to play. Please let us know additional event notifications you would like and we can add them to the list. This is just a starting point.


To add a handler in VB.NET for events coming from Media Center:

1. Add a reference to Media Center's type library ("Media Center 12.tlb"). In VB.NET use the Projects/Add Reference option, select the "COM" tab, then select "MediaCenter" from the list.

2. Add the "Imports MediaCenter" statement to your code.

3. Declare your MC automation variable to handle events, like this:
   Dim WithEvents MC As MCAutomation

4. Set the MC variable using either GetObject or CreateObject as outlined in the SDK documentation.

5. Declare a handler function for the event like this:
    Private Sub MJEvent(ByVal s1 As String, ByVal s2 As String, ByVal s3 As String) Handles MC.FireMJEvent
        MsgBox(s1 + "   " + s2)
    End Sub

6. That's it. Any event fired from MediaCenter should come to your function.
Logged
John Thompson, JRiver Media Center

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: SDK Improvements
« Reply #15 on: November 30, 2006, 08:08:12 am »

That's awesome. Off the top of my head, the only other events I could think of that would be useful would be playstate changes.

Any word on whether or not any of the other things I suggested will make it in there?
Logged

Craig

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 612
Re: SDK Improvements
« Reply #16 on: November 30, 2006, 05:39:57 pm »

I'll second Doofs request for playstate changes and add that I would find it useful if there was an event for the queueing period, ie the last 5 seconds of the song.

I've had a quick play with MCC: NOTIFY_TRACK_CHANGE and the third parameter appears to always be 64. It would be useful if this could indicate which zone just changed.

Thanks
Craig
Logged
MC2Slim - Windows Shell and JRiver Media Center Integration for Squeezebox.

http://www.duff-zapp.co.uk

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
Re: SDK Improvements
« Reply #17 on: December 01, 2006, 08:44:20 am »

  • Some way of sorting collections using any criteria we want - any type of collection that MC returns, whether it be files, playlists, schemes, etc.
In case you missed it, we added a Sort2(...) function to a files object that takes a string.  The formatting of the sort works just like smartlists.  (i.e. "[Artist]-d,[Album]")
Logged
Matt Ashland, JRiver Media Center

JohnT

  • Citizen of the Universe
  • *****
  • Posts: 4627
Re: SDK Improvements
« Reply #18 on: December 01, 2006, 01:24:17 pm »

  • (not really SDK I guess, but) It would be really nice if MC would full pass keypresses through to plugins. For instance...  I can't get Tab Stops to work in any of my plugins unless I hand-code them all. Also, Enter and Escape won't execute their respective buttons (Ok and Cancel)
  • The ability to create different types of fields - not just simple strings
  • The ability to determine the type of a particular field - is it a string? a large value? and integer? calculated? etc
These are probably not going to make it in for version 12.

Quote
  • The ability to create playlists/smartlists
You can create standard playlists with MJPlaylistsAutomation. If you just want to create smartlists as well, we could easily add a parameter for that. Is that what you're looking for?
Logged
John Thompson, JRiver Media Center

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: SDK Improvements
« Reply #19 on: December 01, 2006, 05:16:28 pm »

You can create standard playlists with MJPlaylistsAutomation. If you just want to create smartlists as well, we could easily add a parameter for that. Is that what you're looking for?

Ok, here's the thing. I've been toying with the idea of writing a smartlist creation wizard plugin, taking a cue from iTunes. In order to do it, I really need to be able to determine the type of a field. Without that, my plugin won't be able to tell if it's supposed to offer the user a "greater than/equals/less than" or "contains" etc comparison for the various fields. I could hardcode it for the built in database fields, but then I'm screwed when it comes to the user defined fields. Thus the need for some method of getting the type of a field.

As for smartlist creation, a parameter that takes a search string would be all that's needed. My plugin could generate the string based on what the user picked from the wizard, then pass that string to MC to create the playlist.

Of course, if you don't implement the former request, then the latter really doesn't matter to me.  ;)
Logged

Agonostis

  • Regular Member
  • Junior Woodchuck
  • **
  • Posts: 57
Re: SDK Improvements
« Reply #20 on: December 08, 2006, 12:08:52 pm »

Any chance of getting an event fired when an IR signal is received?
Logged

avpman

  • Galactic Citizen
  • ****
  • Posts: 445
  • Dad to three beatuiful Boxers by rescue.
Re: SDK Improvements
« Reply #21 on: December 08, 2006, 08:29:41 pm »

Sorry for the long wait on this. So far we've only been using the events in our own plugins, and only for playlist change notifications. I've pasted below some preliminary documentation referring to handling events from VB.NET. Let me know if you need help sinking events in JavaScript or C++. With anything else, you're on your own :-)
The one event you're probably interested in (track change) was just added, so you won't see those until the next build (12.0.121?). You can get started now though and just rename a playlist to get an event to come through.

Bear with me in the following documentation. I never use VB but I did build a test program and it did catch events. Here you go...


MediaCenter 12 fires an event with three string parameters:
FireMJEvent(string1, string2, string3)

The first parameter is the event type and currently there is just one event type, namely "MJEvent type: MCCommand"
The second parameter identifies the MCC command. See the list below.
The third parameter is optional and may contain information specific to the command.

Here are the commands currently sent to the event handler:
"MCC: NOTIFY_TRACK_CHANGE"
"MCC: NOTIFY_PLAYLIST_ADDED"
"MCC: NOTIFY_PLAYLIST_INFO_CHANGED"
"MCC: NOTIFY_PLAYLIST_FILES_CHANGED"
"MCC: NOTIFY_PLAYLIST_REMOVED"
"MCC: NOTIFY_PLAYLIST_COLLECTION_CHANGED"
"MCC: NOTIFY_PLAYLIST_PROPERTIES_CHANGED"
The track change event is fired whenever a new track starts to play. Please let us know additional event notifications you would like and we can add them to the list. This is just a starting point.


To add a handler in VB.NET for events coming from Media Center:

1. Add a reference to Media Center's type library ("Media Center 12.tlb"). In VB.NET use the Projects/Add Reference option, select the "COM" tab, then select "MediaCenter" from the list.

2. Add the "Imports MediaCenter" statement to your code.

3. Declare your MC automation variable to handle events, like this:
   Dim WithEvents MC As MCAutomation

4. Set the MC variable using either GetObject or CreateObject as outlined in the SDK documentation.

5. Declare a handler function for the event like this:
    Private Sub MJEvent(ByVal s1 As String, ByVal s2 As String, ByVal s3 As String) Handles MC.FireMJEvent
        MsgBox(s1 + "   " + s2)
    End Sub

6. That's it. Any event fired from MediaCenter should come to your function.

How about:
# playlist_play
# playlist_stop
# playlist_pause
# playlist_filename
Logged

Craig

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 612
Re: SDK Improvements
« Reply #22 on: December 09, 2006, 12:37:55 pm »

How about:
# playlist_play
# playlist_stop
# playlist_pause
# playlist_filename

They would be useful but they are easy enough to get after the Change_Playstate event has been fired.
If it's not too expensive then I'd like to see playback position changed events. I guess that would fire every second for an active zone but that would then be everything I need to stop using polling :-)

Craig
Logged
MC2Slim - Windows Shell and JRiver Media Center Integration for Squeezebox.

http://www.duff-zapp.co.uk

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: SDK Improvements
« Reply #23 on: December 09, 2006, 03:22:38 pm »

I still really just want the ability to determine the type of a library field. I really don't understand why that would have to wait for version 13, especially since I've been asking for it since version 11. There's already a GetName function for fields. Why not a GetType?
Logged

avpman

  • Galactic Citizen
  • ****
  • Posts: 445
  • Dad to three beatuiful Boxers by rescue.
Re: SDK Improvements - IR events
« Reply #24 on: February 04, 2007, 07:06:48 pm »

Is it possible to add some additional Remote Control commands that when received would raise events in the SDK? For example, perhaps have the IR commands in MC named Automation1, Automation2, etcetra. When MC detects the corresponding IR code, it would raise a corresponding event within the SDK:
"MCC: NOTIFY_AUTOMATION_IR1"
"MCC: NOTIFY_AUTOMATION_IR2"
and so forth. Ten of these would be great.

I'd like to create some code that could be triggered by IR keys. I had a similar function in the old derelict CD changer program "CDJ" I was using before converting to H/D based music. You could write all kinds of macros that would trigger when kicked off by an IR code.

Right now, I'm trying to write a routine that would let me update a custom tag "MyFavorites" by tapping an IR key on the remote control when I'm listening to a playlist. I'd also like to do some others things, like "Remove a track from a current playlist". Lots of potential here.
Logged

Craig

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 612
Re: SDK Improvements
« Reply #25 on: February 08, 2007, 10:08:00 am »

I've been playing with the events again and have come across a couple of problems.

"MCC: NOTIFY_TRACK_CHANGE" and "MCC: NOTIFY_PLAYERSTATE_CHANGE" only seem to trigger on the active zone, IE if I right click a song and send to Play zone 2 then the event does not trigger.

"MCC: NOTIFY_PLAYLIST...." events do trigger in the same circumstances but do not return the zone number.

And a couple of questions

MCC: NOTIFY_PLAYLIST_CHANGED seems to trigger twice, the first time with a param of 0, this is where I would expect the zone number to be but the second time the second parameter is a large integer, what does this mean?

Do I need to keep reimporting the type library for each new build of MC12 or are the changes made in MC12 itself?

I've also just noticed that a Track Changed event is recieved from the new active zone whenever the active zone is changed.

Thanks
Craig
Logged
MC2Slim - Windows Shell and JRiver Media Center Integration for Squeezebox.

http://www.duff-zapp.co.uk
Pages: [1]   Go Up