INTERACT FORUM

Please login or register.

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

Author Topic: Play playlist through MJAutomation  (Read 1686 times)

skeeterfood

  • Citizen of the Universe
  • *****
  • Posts: 779
  • We're all just food for the skeeters.
Play playlist through MJAutomation
« on: September 29, 2009, 11:03:36 pm »

If I know the path to the playlist I want to play I can use mc14.exec to play it like this:
mc14.exe /Play TREEPATH=Playlists\Random\Songs\Everyone

How would I play the same playlist using MJAutomation?

It seems like I have to do something crazy like this (in crappy c-like pseudocode):

playlists = mcRef.GetPlaylists()
for (i=0; i < playlists.GetNumberPlaylists(); i++) {
  playlist = GetPlayList(i);
  if (playlist.Name() = "Random\Songs\Everyone") {
    files = playlist.GetFiles();
    files.Play();
  }
}

-John
Logged

pbair

  • Recent member
  • *
  • Posts: 33
Re: Play playlist through MJAutomation
« Reply #1 on: September 30, 2009, 04:20:07 am »

Will something like this work?

files = mcRef.GetViewItem("Playlists\\Random\\Songs\\Everyone").GetFiles()
files.Play();

files.Sort([your sort scheme]) may also be needed to get the files in the order you want.  The wiki for .Sort() really isn't clear to me though.  Anyone know how determine/select/define the sort scheme?
Logged

johnnynine

  • Guest
Re: Play playlist through MJAutomation
« Reply #2 on: October 10, 2009, 10:26:32 pm »

Yes mcRef.GetViewItem() works.

How would you go about playing them in a specific zone? I assume files.Play() just plays the files in the active GUI zone?

I'm currently copying all the files to a specific zone's current playlist? This following works, but there must be a much simpler way to do it?

Code: [Select]
files = mcRef.GetViewItem("Playlists\\Random\\Songs\\Everyone").GetFiles();

int fileCount = files.GetNumberFiles();
for (int i=0; i<fileCount; i++)
{
    IMJFileAutomation file = files.GetFile(i);
    int key = file.GetKey();
    zonePlaylist.AddFileByKey(key, -1);
}
zonePlaylist.Play();

Thanks,
Johnny
Logged

pbair

  • Recent member
  • *
  • Posts: 33
Re: Play playlist through MJAutomation
« Reply #3 on: October 11, 2009, 06:49:02 am »

Code: [Select]
files = mcRef.GetViewItem("Playlists\\Random\\Songs\\Everyone").GetFiles();

int fileCount = files.GetNumberFiles();
for (int i=0; i<fileCount; i++)
{
    IMJFileAutomation file = files.GetFile(i);
    int key = file.GetKey();
    zonePlaylist.AddFileByKey(key, -1);
}
zonePlaylist.Play();

I haven't dealt with zones yet.  Would be nice if you could simply specify the zone as an optional argument of the MJFilesAutomation Play() function.  For example, Files.Play(ZoneNumber).  If no ZoneNumber is specified, then the active zone could be assumed.
Logged
Pages: [1]   Go Up