Old 30th March 2005, 17:22   #1
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
ml_org: Organize Media Library

I've checked through the samples and the FAQ's and I'm still needing a little help at just getting started. This is my first Winamp plugin, so go easy on me...

I thought that I'd try to tackle the "Keep My Media Library Organized" functionallity that shows up on the wishlist. This is something that I too would love to have.

I thought that I would take the approach of having a button or menu item added to the media library that would selected by the user to do the organization (instead of trying to monitor the library for changes to tags).

Most development I've done to date has been for embedded systems, so I have very little knowledge of Windows programming.

For a basic test, I would like to be able to display the new button (or menu item) in the ML, the simply iterate through all items in the ML just to see that I can get that far

Here's what I need some help with:
  • Accessing the UI to add the button or menu item
  • Executing my function when that action occurs
  • Reading all items in the ML

Any takers?
jheddings is offline   Reply With Quote
Old 31st March 2005, 07:55   #2
saivert
Banned
 
saivert's Avatar
 
Join Date: Jan 2001
Location: Norway
Posts: 927
You can't add a button to the ML as there is no API made for this yet (well nothing is impossible, but it would require serious hacks which would take too much time). You can instead add a menu item to the menu that appears when you click the Library button below the ML tree-view control (I guess you know a litt about the basics of Win32 programming after all).

You must then replace the window procedure (function pointer) of the Media Library Window (called subclassing for some reason, in the DOS days we called it vectoring) by using the SetWindowLong (or SetWindowLongPtr for 64-bit Windows forward-compatibility) with the GWL_WNDPROC (or GWLP_WNDPROC if using SetWindowLongPtr) to set your new Window Procedure. SetWindowLong[Ptr] will return the previous Windows Procedure function pointer which you must keep in a WNDPROC type variable so you can call into the old Window Procedure from you own Windows Procedure to handle default processing (and keep Winamp from dead-locking). You do this using CallWindowProc and not calling the function pointer directly (short story: this is so Windows can handle ANSI vs. Unicode). I guess this post was a bit elaborate, and It would be easier to just tell you to buy a damn "Win32 Programming for Dummies" book.
saivert is offline   Reply With Quote
Old 31st March 2005, 16:49   #3
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
Wow... Thanks for all the information! Looks like I do need to just get a book on it, eh?

I'm a little surprised that there are not more resources on the internet for creating Winamp plugins. Oh-well... That probably helps to keep n00bs like me away from writing code when they shouldn't.

I'm definitely going to pursue this plugin, as it is the only thing missing from the media library that I need a third part prog to do.

I'd also like to get feedback on features and such... Is Winamp Discussion the best place for that?
jheddings is offline   Reply With Quote
Old 31st March 2005, 17:16   #4
saivert
Banned
 
saivert's Avatar
 
Join Date: Jan 2001
Location: Norway
Posts: 927
You may try out one of the other forums here at forums.winamp.com, but everything development related (eg.: contains a lot of code talk and in-depth explanations of things) should remain here.

Try to ask what features people want in Winamp Discussion and then decide if you want to write a plugin that does just that.
saivert is offline   Reply With Quote
Old 31st March 2005, 20:57   #5
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
I'll look for some feedback there..

While I'm here, though, any thoughts on the plugin? Here's a link to the thread in the WA Discussion...
jheddings is offline   Reply With Quote
Old 7th April 2005, 18:08   #6
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
Well, I'm trying to figure out what's wrong... I am building the ml_ex from the SDK, but I only get .lib and .exp output. I was expecting a DLL...

Any help here?
jheddings is offline   Reply With Quote
Old 7th April 2005, 18:39   #7
saivert
Banned
 
saivert's Avatar
 
Join Date: Jan 2001
Location: Norway
Posts: 927
Check project settings

Check the project settings. The project may put the compiled DLL in another folder.
saivert is offline   Reply With Quote
Old 7th April 2005, 18:59   #8
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
Duh. Sample project ouputd the DLL to the Winamp plugins dir instead of the build directory...
jheddings is offline   Reply With Quote
Old 7th April 2005, 21:47   #9
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
Woo-Hoo! I'm on my way (well, I think I am...)

I've got my plugin loading and I can see it initialize. Also, I've got a hold of the window proc pointer (many thanks so far, saivert).

Now, as far as adding to the "Library" button at the bottom of the Media Library window... No idea how to do this. I tried to track down Francis, as his ml_impex plugin would be a perfect place for me to start (just rename files instead of making XML), but no word back from him.

Any thoughts on adding this item to the menu?
jheddings is offline   Reply With Quote
Old 8th April 2005, 17:07   #10
saivert
Banned
 
saivert's Avatar
 
Join Date: Jan 2001
Location: Norway
Posts: 927
Can I check your source code? Do you intend to release it?
saivert is offline   Reply With Quote
Old 8th April 2005, 21:36   #11
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
Definitely. I hate when I can't find source code for things

You can find the plugin page (well, source code only right now) here.

Since pretty much all I have at this point is a skeleton, I released that in another thread (that I want to add to as I go) here.

PS: Thanks for all the help you have given! Once I get past this first stage of figuring out the basics of plugin programm, hopefully I can start making some real progress...
jheddings is offline   Reply With Quote
Old 8th April 2005, 22:50   #12
saivert
Banned
 
saivert's Avatar
 
Join Date: Jan 2001
Location: Norway
Posts: 927
Nullsoft has their own skeleton ml plugin in the "C:\Program Files\Winamp5.04 SDK\gen_ml\ml_ex" folder. I happened to compile this without problems using Visual C++ 6.0. And compiling it under VS .NET 2003 should be as easy as creating a new project and adding the files from ml_ex folder.
saivert is offline   Reply With Quote
Old 8th April 2005, 22:56   #13
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
I started with that, but it seemed to get a little confusing, so I wanted to make my own skeleton real quick (also just to understand how things are laid out). Probably wouldn't be confusing for someone who knows Win32 programming more than me.
jheddings is offline   Reply With Quote
Old 8th April 2005, 23:24   #14
saivert
Banned
 
saivert's Avatar
 
Join Date: Jan 2001
Location: Norway
Posts: 927
It is always nice that someone gets starting to code. Hope you learn quick.
saivert is offline   Reply With Quote
Old 9th April 2005, 00:42   #15
saivert
Banned
 
saivert's Avatar
 
Join Date: Jan 2001
Location: Norway
Posts: 927
Updated source

I have worked on your source code and this is what I did to it:

- Implemented menu item. Clicking menu item still does nothing (up to you my friend).
- Fixed project files (.sln and .vcproj) so they would build under MS Visual Studio .NET 2003 without problems (at least for me).

I have attached the updated code.
Attached Files
File Type: zip ml_org_nxs.zip (69.1 KB, 1274 views)
saivert is offline   Reply With Quote
Old 11th April 2005, 17:46   #16
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
This is awesome! Thanks so much... I have been looking through the code and it seems pretty easy to follow. I'll probably abandon my skeleton, since this is straight forward, and it should be easy to reuse.

On to the actual organization now...
jheddings is offline   Reply With Quote
Old 11th April 2005, 20:52   #17
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
Getting the entire library

I'm trying to use the mlGetTreeStruct to get the entire library (I think that is correct). I'm not sure of two things:

1. the item_start parameter wants "TREE_PLAYLISTS, TREE_DEVICES..." but I don't see any of those defines in the SDK.

2. when I get the HMENU back, do I need to loop through the whole thing and add each item to a itemRecordList?

Is there an easier way?
jheddings is offline   Reply With Quote
Old 11th April 2005, 20:56   #18
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
Ignore last post... I'm actually, I'm going to take a different approach... It looks like a good thing to do would be to run queries and look at the results.

I'll post again w/ questions.
jheddings is offline   Reply With Quote
Old 12th April 2005, 02:29   #19
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
Well, I haven't quite gotten to the renaming part, yet... I could use a little help with my progress bar dialog if someone has the time.

In the function MLOrg::Organize(itemRecordList...), I want to display a progress bar that shows progress as I loop through all the records. Right now, the dialog is not showing up. I have two questions:

1. How do I make the dialog show up modeless?

2. How do I get the progress control to set the range of it? I've tried GetDlgItem, but I'm not sure how to change the HWND to a CProgressCtrl...

Thanks!!
jheddings is offline   Reply With Quote
Old 12th April 2005, 02:30   #20
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
Here's my source code...
Attached Files
File Type: zip ml_org.zip (10.3 KB, 1273 views)
jheddings is offline   Reply With Quote
Old 13th April 2005, 18:56   #21
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
I've gotten past a lot of the Win32 stuff that was holding me up. Now, the plugin even pops up a progress bar as if it's actually doing something...

I'll be keeping my site updated for this plugin as I go... I've gotten a bit of it done, but it is still a ways from complete.

Feel free to visit: http://winamp.heddway.com/ml_org/
jheddings is offline   Reply With Quote
Old 27th April 2005, 15:17   #22
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
Development is going very well... Just a couple final things before release 1.0.

Right now the plugin is running quite slowly. The bottle neck is in some querying I am doing. I am trying to take a particular record and see if it matches a query string.

So do this, currently I am taking that query string, appending "filename == pRecord->filename" and running that query. This takes a while to run in large databases.

Any thoughts on how to make this faster? That's really the last thing for v1.0!
jheddings is offline   Reply With Quote
Old 28th April 2005, 06:31   #23
saivert
Banned
 
saivert's Avatar
 
Join Date: Jan 2001
Location: Norway
Posts: 927
Nice. I have been unable to follow your progress for a long time (seeing noe replies between your posts). But I guess you have progressed nicely. You actually start to know what you are doing.

You already know this by now, but anyways
code:

CProgressCtrl c;
c.FromHandle((HWND)hwnd_your_progress_ctrl);
c.SetRange(0, 100);


Just so other people can know.

I don't know exactly how you are "organizing" the ML, but If I can get your lates source code I might have a look.
saivert is offline   Reply With Quote
Old 1st May 2005, 22:42   #24
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
BETA VERSION AVAILABLE

Get the beta 1 version of the plugin here. The source code is also available from that page.

THIS IS BETA!! I have run it many times without a problem, but make sure that you have a backup of your library before running this plugin. You should have a backup anyway...

There are only two issues that remain outstanding to test:
  • The "Remove Empty Directories" option needs more thorough testing. (this is not as easy as you might think)
  • Right now, the move is slow for large libraries. I know what the problem is, but I need to find an alternative.
jheddings is offline   Reply With Quote
Old 2nd May 2005, 05:54   #25
saivert
Banned
 
saivert's Avatar
 
Join Date: Jan 2001
Location: Norway
Posts: 927
What about switching to Windows Template Library instead of using old MFC for your code?

Download the WTL from here:
http://www.sourceforge.net/projects/wtl

The best would be to use neither MFC nor WTL, and just plain old Win32 calls. Makes your plugins smaller and more efficient.

I'll also check out the new code to see how you progressed.
saivert is offline   Reply With Quote
Old 2nd May 2005, 06:16   #26
saivert
Banned
 
saivert's Avatar
 
Join Date: Jan 2001
Location: Norway
Posts: 927
NSIS Installer

Here's a NSIS script file I made for your plugin.

Just download NSIS from http://nsis.sf.net and compile it. It should compile with the standard stuff that is included with NSIS (i.e. no 3rd party dependencies).
Attached Files
File Type: nsi ml_org.nsi (1.7 KB, 1107 views)
saivert is offline   Reply With Quote
Old 2nd May 2005, 13:26   #27
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
Quote:
Originally posted by saivert
The best would be to use neither MFC nor WTL, and just plain old Win32 calls.
I thought that's what I did I'm not using any MFC (as far as I know) in the plugin. Can you give me an example?

Quote:
Originally posted by saivert
Here's a NSIS script file I made for your plugin.
Thanks! I was going to package it as soon as it is out of beta... Hopefully that will be this week.
jheddings is offline   Reply With Quote
Old 2nd May 2005, 13:30   #28
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
Re: NSIS Installer

Quote:
Originally posted by saivert
Why are you using a reference (& for the allocRecordList call?
The function wanted a pointer for the allocation... That's what I was giving it.

(Sorry for the new thread... I was trying to help reduce clutter in this thread)
jheddings is offline   Reply With Quote
Old 3rd May 2005, 08:04   #29
saivert
Banned
 
saivert's Avatar
 
Join Date: Jan 2001
Location: Norway
Posts: 927
Oh. I see. I thought it was a reference (sorry, lame mistake). but & is used to declare references, but can be used to turn a variable into a pointer. okay. Now that's sorted out.
saivert is offline   Reply With Quote
Old 3rd May 2005, 14:27   #30
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
No worries. I make lots of those.
jheddings is offline   Reply With Quote
Old 30th May 2005, 02:36   #31
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
Anyone have any ideas why my plugin is running so slow? (see thread for link).
jheddings is offline   Reply With Quote
Old 20th April 2006, 02:48   #32
ignitionnight
Registered User
 
Join Date: May 2005
Posts: 6
Any updates? It has been a year almost...

I just found this plugin and it suits EXACTLY what I need in winamp to be able to fully abandon iTunes.
ignitionnight is offline   Reply With Quote
Old 21st April 2006, 00:04   #33
jheddings
Member
 
Join Date: Nov 2004
Posts: 63
I haven't made any updates to this plugin since the version posted. I'll take a look at your email to see if I can make the changes you requested, but please be patient with me... I'm at a new job that doesn't afford me quite as much free time.
jheddings is offline   Reply With Quote
Old 21st April 2006, 08:43   #34
will
Nullsoft Newbie (Moderator)
 
will's Avatar
 
Join Date: Mar 2001
Location: Sheffield, England
Posts: 5,569
What I'd really like is a "Send to -> Organise to library"

So I can right click some mp3s i've downloaded and have it move them into my library file naming structure.

DO NOT PM ME WITH TECH SUPPORT QUESTIONS
will is offline   Reply With Quote
Old 12th January 2008, 00:02   #35
Mega Masha
Junior Member
 
Join Date: Jun 2001
Posts: 4
Send a message via ICQ to Mega Masha
I hope this gets a reply, considering the thread has been inactive a year or so.

I downloaded the plugin, and find it incredibly useful, but there are times when I really don't want to change the filename, or just append something to the existing filename. This could be fixed by having an <OriginalFilename> parameter in the file renaming string options.

This would surely be a very small amount of work, yet I unfortunately lack the programming skills necessary.

Anyone willing to take this one on?

MM

P.S. I don't seem to get to the plugin website...
Mega Masha is offline   Reply With Quote
Old 23rd January 2008, 06:07   #36
tadakan
Junior Member
 
Join Date: Jan 2008
Posts: 1
winamp 5.52?

It's possible that it's just my system, but I just updated to 5.52 and it doesn't seem to work. It's killing winamp as soon as it starts to run.
what's the chance of an update to support 5.52? I suppose I could try an earlier version but I prefer not to do that...

the ability to remove duplicate tracks is something that itunes sorely lacks, and part of why I wanted to switch to another media player. Sorting through all 45+ GB of music isn't something I want to do.
tadakan is offline   Reply With Quote
Old 24th January 2009, 02:33   #37
narfnarfsilly
Junior Member
 
Join Date: Jul 2007
Posts: 22
Re: winamp 5.52?

Quote:
Originally posted by tadakan
It's possible that it's just my system, but I just updated to 5.52 and it doesn't seem to work.
I believe this here thread is related to an older version of the plugin. A newer version is here:

http://forums.winamp.com/showthread....=&pagenumber=2

My comment on that thread, and to anyone who uses this plugin: BACK UP YOUR FILES FIRST! That's a basic rule for any situation where you attempt to make drastic changes to your files.

That said, this plugin has worked beautifully for me.

You refer to the prophecy of the pastry that will bring balance to the Force. And you believe it's this.. donut?
narfnarfsilly 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