Old 11th April 2007, 03:19   #1
abu
mlipod moderator
(Senior Member)
 
abu's Avatar
 
Join Date: Jun 2005
Location: Germany
Posts: 3,457
API to enumerate smart views?

Hi, is there an API to get the names and queries for all smart views? Similar to ML_IPC_PLAYLIST_COUNT / ML_IPC_PLAYLIST_INFO for playlists...

WinAmp Pro 5.5 with ml_iPod 3.10 + dev.patches (download it)
ml_iPod documentation Wiki - ml_iPod FAQ - search ml_iPod forum - iPhone/iTouch - Found a bug?
Donations to support the ml_iPod project can be done HERE
abu is offline   Reply With Quote
Old 11th April 2007, 12:21   #2
CraigF
Passionately Apathetic
Administrator
 
CraigF's Avatar
 
Join Date: May 2000
Location: Hell
Posts: 5,435
I believe in at least one of will's plugins he parses the ini file for this information (note that there may be two locations based on unicode/not unicode)

CraigF is offline   Reply With Quote
Old 11th April 2007, 12:37   #3
abu
mlipod moderator
(Senior Member)
 
abu's Avatar
 
Join Date: Jun 2005
Location: Germany
Posts: 3,457
Yes, that's what I do, too, at the moment. But as the format of the ini-file changed at least twice over the last month, an API would be helpful

WinAmp Pro 5.5 with ml_iPod 3.10 + dev.patches (download it)
ml_iPod documentation Wiki - ml_iPod FAQ - search ml_iPod forum - iPhone/iTouch - Found a bug?
Donations to support the ml_iPod project can be done HERE
abu is offline   Reply With Quote
Old 17th April 2007, 16:13   #4
will
Nullsoft Newbie (Moderator)
 
will's Avatar
 
Join Date: Mar 2001
Location: Sheffield, England
Posts: 5,569
I've written the following API. Hopefully I can get it included for the next release.

code:

#define ML_IPC_SMARTVIEW_COUNT 0x0908 // returns the number of smartviews. no parameter required
#define ML_IPC_SMARTVIEW_INFO 0x0909 // pass a mlSmartViewInfo*. returns 1 on success and 0 on failure

typedef struct
{
// you fill these in
size_t size; // set to sizeof(mlSmartViewInfo)
size_t smartViewNum;
// ml_local fills these in
wchar_t smartViewName[128];
wchar_t smartViewQuery[512];
int mode;
int iconImgIndex;
int treeItemId;
} mlSmartViewInfo;



and here is some example code of how to use it:
code:

int n = SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,0,ML_IPC_SMARTVIEW_COUNT);
mlSmartViewInfo m={0};
m.size = sizeof(mlSmartViewInfo);
for(int i=0; i<n; i++) {
m.smartViewNum=i;
if(SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&m,ML_IPC_SMARTVIEW_INFO) == 1) {
// use contents of m
}
}


DO NOT PM ME WITH TECH SUPPORT QUESTIONS
will is offline   Reply With Quote
Old 17th April 2007, 18:47   #5
abu
mlipod moderator
(Senior Member)
 
abu's Avatar
 
Join Date: Jun 2005
Location: Germany
Posts: 3,457
Great, exactly what I wanted. How do I know whether this makes it to the next release, though?

WinAmp Pro 5.5 with ml_iPod 3.10 + dev.patches (download it)
ml_iPod documentation Wiki - ml_iPod FAQ - search ml_iPod forum - iPhone/iTouch - Found a bug?
Donations to support the ml_iPod project can be done HERE
abu is offline   Reply With Quote
Old 18th April 2007, 08:55   #6
will
Nullsoft Newbie (Moderator)
 
will's Avatar
 
Join Date: Mar 2001
Location: Sheffield, England
Posts: 5,569
ML_IPC_SMARTVIEW_COUNT will return zero if it isn't.

DO NOT PM ME WITH TECH SUPPORT QUESTIONS
will is offline   Reply With Quote
Old 18th April 2007, 09:11   #7
abu
mlipod moderator
(Senior Member)
 
abu's Avatar
 
Join Date: Jun 2005
Location: Germany
Posts: 3,457
Which "could" even be if a user removed all his smart views. The usual problem with the default "0" for non implemented API calls
-1 would have been better, but that's too late now.

WinAmp Pro 5.5 with ml_iPod 3.10 + dev.patches (download it)
ml_iPod documentation Wiki - ml_iPod FAQ - search ml_iPod forum - iPhone/iTouch - Found a bug?
Donations to support the ml_iPod project can be done HERE
abu is offline   Reply With Quote
Old 18th April 2007, 09:22   #8
will
Nullsoft Newbie (Moderator)
 
will's Avatar
 
Join Date: Mar 2001
Location: Sheffield, England
Posts: 5,569
changing that would require changing all previous versions of winamp.

DO NOT PM ME WITH TECH SUPPORT QUESTIONS
will is offline   Reply With Quote
Old 18th April 2007, 09:34   #9
abu
mlipod moderator
(Senior Member)
 
abu's Avatar
 
Join Date: Jun 2005
Location: Germany
Posts: 3,457
Yeah, that's what I wanted to say with "too late now"

WinAmp Pro 5.5 with ml_iPod 3.10 + dev.patches (download it)
ml_iPod documentation Wiki - ml_iPod FAQ - search ml_iPod forum - iPhone/iTouch - Found a bug?
Donations to support the ml_iPod project can be done HERE
abu is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump