INTERACT FORUM
Windows => Plug-in Development => Topic started by: skeeterfood 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
-
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() (http://wiki.jrmediacenter.com/index.php/MJFilesAutomation#void_Sort.28.29) really isn't clear to me though. Anyone know how determine/select/define the sort scheme?
-
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?
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
-
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.