INTERACT FORUM

Please login or register.

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

Author Topic: can't find play playlist SDK function ?  (Read 3072 times)

mhwlng

  • Regular Member
  • World Citizen
  • ***
  • Posts: 235
  • nothing more to say...
can't find play playlist SDK function ?
« on: December 28, 2003, 09:05:52 am »

Hello,

I can't find a 'play playlist' in the SDK documentation

e.g.

PLAY "Media Library\Audio\Album\Top Hits -- haven't heard for over a year "

Am I missing something ?

I know that I can read all the tracks in the required playlist and then add them one by one to the playing now list but this is very slow....


Marcel


Logged

scott_r

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 306
Re:can't find play playlist SDK function ?
« Reply #1 on: January 02, 2004, 12:29:04 am »

The MJPlaylistAutomation interface has a GetFiles() fuction that returns a MJFilesAutomation interface. This in turn has a Play() function that plays the list of files.

So, if you're using VB, to play the playlist "Top Hits -- haven't heard for over a year". you'd do this:

Code: [Select]
Dim n as Integer = 0
Dim pls as MJPlaylistsAutomation = g_MJ.getPlaylists()
Dim pl as MJPlaylistAutomation
'Iterate through playlists till you find the right one
For n = 0 to (pls.GetNumberPlaylists() - 1)
  pl = pls.getPlaylist(n)
  If pl.Name = "Top Hits -- haven't heard for over a year" Then
     pl.getFiles().Play()
     Exit Sub
  End If
Next n
'Add code to handle not finding the playlist here

I haven't tested this code, but I'm pretty sure it will work. Note that due to SDK limitations, the Play() command will replace what's playing now. You can't customise it, eg. Add to playing now, instead of replace.

Scott.
Logged

mhwlng

  • Regular Member
  • World Citizen
  • ***
  • Posts: 235
  • nothing more to say...
Re:can't find play playlist SDK function ?
« Reply #2 on: January 02, 2004, 02:46:03 am »

thanks scott

Marcel
Logged

scott_r

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 306
Re:can't find play playlist SDK function ?
« Reply #3 on: January 02, 2004, 02:56:04 am »

You could also turn that code into a function that takes a string (playlist name or path) and returns an MJPlaylistAutomation object. You could even go as far as calling it getPlaylist.

Scott

Logged

RhinoBanga

  • Citizen of the Universe
  • *****
  • Posts: 1703
  • Developer
Re:can't find play playlist SDK function ?
« Reply #4 on: January 02, 2004, 10:02:02 am »

Note that due to SDK limitations, the Play() command will replace what's playing now. You can't customise it, eg. Add to playing now, instead of replace.

Scott.


But you can call pMJCurPlaylist->AddFile to append onto playing now.
Logged

scott_r

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 306
Re:can't find play playlist SDK function ?
« Reply #5 on: January 02, 2004, 02:45:31 pm »

Quote
But you can call pMJCurPlaylist->AddFile to append onto playing now.
True, but it only add's one file, not an entire MJFilesAutomation object.

Scott
Logged

RhinoBanga

  • Citizen of the Universe
  • *****
  • Posts: 1703
  • Developer
Re:can't find play playlist SDK function ?
« Reply #6 on: January 02, 2004, 04:30:47 pm »

Yes, but you iterate over the collection adding them ... it's very trivial to do.
Logged

scott_r

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 306
Re:can't find play playlist SDK function ?
« Reply #7 on: January 03, 2004, 12:07:10 am »

I'm aware it's possible, and also quite trivial, but it's an iteration that doesn't really need to be there, and if you're iterating over hundreds or thousands of files, it's a huge overhead. It would be much cleaner and easier (and faster because MC would be handling it) if there was a parameter in the Play() command that told MC what to do with the files collection.
Logged

RhinoBanga

  • Citizen of the Universe
  • *****
  • Posts: 1703
  • Developer
Re:can't find play playlist SDK function ?
« Reply #8 on: January 03, 2004, 02:35:25 am »

But what I am pointing out is that when you said:

Quote
Note that due to SDK limitations, the Play() command will replace what's playing now. You can't customise it, eg. Add to playing now, instead of replace.

There is a solution to what you said can't be done.

There are more pressing SDK issues that need to be addressed by J River than wasting time on something that can be easily implemented in user code.
Logged

scott_r

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 306
Re:can't find play playlist SDK function ?
« Reply #9 on: January 03, 2004, 02:59:01 am »

When I said:
Quote
Note that due to SDK limitations, the Play() command will replace what's playing now. You can't customise it, eg. Add to playing now, instead of replace.
I was meaning in the context of the MJFilesAutomation interface and the code snippet that I provided. Also, Marcel said in his original post:
Quote
I know that I can read all the tracks in the required playlist and then add them one by one to the playing now list but this is very slow....
So I figured he'd already tried the way you mentioned and wanted a quick way to play a playlist.

Quote
There are more pressing SDK issues that need to be addressed by J River than wasting time on something that can be easily implemented in user code.
I'm aware there are more pressing issues, and I never intended for my comments to make it sound like it was a pressing issue. The reason I mentioned the limitations of the SDK in the first place is that I've seen a request for this functionality a couple of times from other users. I have also asked a number of questions of the SDK and had no response. I would have liked at least a "we're working on it" or some sort of acknowledgement instead of just complete silence.
I'll try not let my personal frustrations get in the way of what I'm trying to say from now on. Sorry if I offended anyone.

Scott.
Logged

sraymond

  • Guest
Re:can't find play playlist SDK function ?
« Reply #10 on: January 05, 2004, 01:09:42 pm »

There are more pressing SDK issues that need to be addressed by J River than wasting time on something that can be easily implemented in user code.

This is none of my business, really, but I'll butt-in anyway.

I disagree with the perspective that because JRiver has been slow in the past with SDK enhancements, we (well, you all, not me) should limit ourselves to only the most important and pressing fixes/additions.  JRiver should commit to making the SDK as good as it needs to be - not just the top three/five/ten fixes and enhancements.

Most people would agree that the value of MC is more than just the installable product....  it's the value of the community - and the plugin-writers provide great value.  Moreso, because I think my two favorite plugins (PlayingNow and MCXMLExport) should have been included internal to MC in the first place.

Let's hope JRiver steps up to the plate and makes *all* the needed/wanted/useful changes to the SDK.  Oh, and they don't call it low-hanging-fruit for nothing.  

Scott-
Logged

KingSparta

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 20063
Re:can't find play playlist SDK function ?
« Reply #11 on: January 05, 2004, 01:16:08 pm »

Quote
you all

You Be from the South? ((SAP Translation) Younder them there hills?)
Logged
Retired Military, Airborne, Air Assault, And Flight Wings.
Model Trains, Internet, Ham Radio, Music
https://MyAAGrapevines.com
https://centercitybbs.com
Fayetteville, NC, USA
Pages: [1]   Go Up