Go Back   Winamp Forums > Developer Center > Winamp Development

Reply
Thread Tools Search this Thread Display Modes
Old 7th March 2008, 17:30   #1
Griffon
Junior Member
 
Join Date: Mar 2008
Posts: 1
Add file to library

I write program and i need add files from some directory add to winamp library. How using SDK add files?
Please help.
Griffon is offline   Reply With Quote
Old 18th March 2008, 03:39   #2
Benski
Ben Allison
Lead Developer
Winamp Dev Team
 
Benski's Avatar
 
Join Date: Jan 2005
Location: Ashburn, VA
Posts: 1,018
Like most parts of the SDK, this only works "in-process", i.e. inside a plugin.

this code snippet should work

code:

LMDB_FILE_ADD_INFO fi = {const_cast<char *>(filename), -1, -1};
// library == media library HWND
SendMessage(library, WM_ML_IPC, (WPARAM)&fi, ML_IPC_DB_ADDORUPDATEFILE);
// ML_IPC_DB_SYNCDB should be sent when you are done adding files
PostMessage(library, WM_ML_IPC, 0, ML_IPC_DB_SYNCDB);



Newer versions of Winamp with Unicode media library support also allow the following:

code:

// in case these aren't in your SDK
typedef struct
{
wchar_t* fileName; // file name to add
int meta_mode; // metadata get mode (0 - don't use metadata, 1 - use metadata; -1 - read from user settings (ini file)
int gues_mode; // metadata guessing mode (0 - smart, 1 - simple; 2 - no, -1 - read from user settings (ini file)
} LMDB_FILE_ADD_INFOW;
#define ML_IPC_DB_ADDORUPDATEITEMW 0x1707

LMDB_FILE_ADD_INFOW fi = {const_cast<wchar_t *>(filename), -1, -1};
SendMessage(library, WM_ML_IPC, (WPARAM)&fi, ML_IPC_DB_ADDORUPDATEFILEW);
PostMessage(library, WM_ML_IPC, 0, ML_IPC_DB_SYNCDB);

Benski is offline   Reply With Quote
Old 17th February 2009, 22:25   #3
videoBoy
Junior Member
 
Join Date: Dec 2006
Posts: 5
Hi Benski,

I tried this piece of code and things didn't work for me -- meaning the new entries are not added to the ML view or the ML Database is updated. Any idea as to what could be going wrong ?

HWND hwndSomeHelper3 = ::FindWindow("Winamp Gen", "Winamp Library");
LMDB_FILE_ADD_INFOW fi = {const_cast<wchar_t *>(L"C:\\ws\\test.mp3"), 0, 0};

LRESULT lr1 = ::SendMessage(hwndSomeHelper3, WM_ML_IPC, (WPARAM)&fi, ML_IPC_DB_ADDORUPDATEFILEW);
// ML_IPC_DB_SYNCDB should be sent when you are done adding files
BOOL Br= ::PostMessage(hwndSomeHelper3, WM_ML_IPC, 0, ML_IPC_DB_SYNCDB);
videoBoy is offline   Reply With Quote
Old 17th February 2009, 22:44   #4
DrO
-
 
DrO's Avatar
 
Join Date: Sep 2003
Location: UK
Posts: 22,237
that won't work as stated in your original thread due to it being sent out of process. either change to a native plugin and ipc between it and your app or look at the winampmagic/readprocessmemory examples to 'hack' around the issue.

-daz
DrO is offline   Reply With Quote
Reply
Go Back   Winamp 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