PDA

View Full Version : Search for Artist, Album, or Song


itsr0y
5th July 2002, 05:24
I'm a relatively new programmer and I would like to make a program (or plugin) that allows the user to search for an Artist, Album, or Song and have that playlist or song loaded into winamp and played. I really do not know how to implement such a program.

I will probably have my songs organized on my hard drive in the format \Artist\Album\Song.mp3 or \Artist\Album - Song.mp3, as well as a few miscellaneous folders (e.g. Rap, Rock, TV Themes). All the artists and albums will have their own .m3u files (i.e. each artist folder will have a playlist for each album as well as a playlist containing all of the albums.) I will have all my songs have information in ID3 tags if needed. I don't care whether I use Winamp2 or Winamp3 - whichever one is easier to work with is the one I'll use.

The end goal of this project is to be able to say "Artist Mr. Bungle" and Winamp will load a playlist with all of the Mr. Bungle songs, or "Album Make Yourself" and it will load Incubus's "Make Yourself", but for now simply typing the search string into a textbox would be fine.

Does anyone have any ideas how to set this up? I suppose I could have a database or text file with all of the album names, artist names, and song names, but the song name list would get rather large, and it would be a pain to add every single song to the database. Maybe if, whenever I add a new file, I can run a program to update the database... If winamp3's media browser could handle it, I just need some info on how to set up the program to actually load winamp's playlist with the search results (and I want the albums to be in order by track, not alphabetical by track name.)

Any thoughts on this topic would be greatly appreciated!

Thanks for reading this!
itsr0y

itsr0y
5th July 2002, 14:07
I was thinking, since Winamp 3 has the ability to load multiple playlists at the same time, is there any way to manipulate those playlists, such as searching through them and selecting which one is to be played? I was thinking I could load every album's .m3u into there and write a plugin to search through the names of the loaded playlists. The only problem (besides the facts that I can't program and that I don't know how to write plugins for Winamp 3) is that it may be slow. Does anyone have any thoughts on this?

Another idea was to keep a .txt file of all the .m3u files I have and just load that into memory when the plugin starts. When the user does a search, it just searches through that list and loads the playlist. If a user wants a specific song, the user must first select the playlist, then the song. If the above doesn't work, does this seem like the best idea?

Thanks a lot!

Gourou
11th July 2002, 02:42
if you have a HUGE collection, then you might want to consider a database, but something on the order of 10,000 songs would take only a couple moments to search for on a fast computer, the text file would be quite fast enough I think

itsr0y
12th July 2002, 14:51
ok, I ended up doing it like this:

I have one list box with all my artists (or whatever you call artists, could be "Rock" or whatever you choose.) This list box is loaded from a file, artists.txt, located wherever you set your configuration to be. The format of the file is one artist on each line in the format: "display;path", where display is what is shown on screen (and what must be spoken) and the path is the path to the albums.txt file.

I have another list box with all the albums from whatever artists is currently selected. It is the same format as the artists.txt, except the path points to a winamp playlist.

For both artists.txt and albums.txt, if you don't specify the path, the display name is used as the path, relative to the location of the file. E.g. In c:\music\artists.txt you have an entry "Album123". Since no path is specified, it loads c:\music\Album123.m3u

To use it, you speak (into the microphone) one of the following:
"Artist <name>" or "Artist <number>" - Loads the album list into the other listbox.
"Album <name>" or "Album <number>" - Loads winamp with all the albums for the selected artist, starting with the one you specify.
"Winamp <command>" - Tells Winamp to do whatever you specify. e.g. "Winamp play" presses the play button; "Winamp volume one half" sets the volume to one half.
You can edit the winamp commands in an XML file located in the plugin directory. You can add your own commands, add new phrases for current commands, or get rid of commands.

The whole thing uses Microsoft's Speech API (SAPI5.1).

Everything is working fine - I just have to added a few small features (like detecting Winamp directory and plugin directory.)