INTERACT FORUM

Windows => Plug-in Development => Topic started by: Messiahs on February 01, 2008, 10:10:14 am

Title: Update smartlist (SDK)
Post by: Messiahs on February 01, 2008, 10:10:14 am
Hi,

is it possible to update a smartlist via SDK ?

eg. If i select the smartlist "100 Random songs" 5 times (via SDK), every result is the same.
If i open JR and select the view "100 Random songs" the result is different.

Is there a way like "MJPlaylistAutomation.update()" ?

thanks
Markus
Title: Re: Update smartlist (SDK)
Post by: GrantDG on August 18, 2009, 04:06:39 am
*bump*

Any response from the JRiver team on this one?
Title: Re: Update smartlist (SDK)
Post by: cncb on August 18, 2009, 07:22:46 am
If you access the files via a ViewItem then the file list is updated each time.  For example:  MJAutomation.GetViewItem("Playlists\\Smartlists\\100 Random Songs").GetFiles()
Title: Re: Update smartlist (SDK)
Post by: prod on September 16, 2009, 05:41:24 am
For the sake of complete-ness, you can refresh all smartlists by sending a command to MC using the Windows PostMessage method.

Here's a couple of C# code segments... first you've got to declare the PostMessage method in your chosen class so you can use it (and also declare the MC constants you want to use);

Code: [Select]
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool PostMessage(IntPtr hWnd, uint Msg, uint wParam, uint lParam);

// MC specific constants
public const uint WM_MC_COMMAND = 33768;
public const uint MCC_REFRESH = 22007;

Then use the method to send the refresh command to MC;

Code: [Select]
PostMessage(new IntPtr(mc.GetWindowHandle()), WM_MC_COMMAND, MCC_REFRESH, 0);

Where mc is your MCAutomation object.

This can be used for loads of other stuff, there's more info here in the wiki (http://wiki.jrmediacenter.com/index.php/Media_Center_Core_Commands).