http get - taking samples off a database

Simon's icon

Hey I am trying to get something together for a college project involving grabbing audio samples off a database. Whats the best way to go about this? Any ideas? XML to send http get?

Luke Hall's icon

Have a look at [jit.uldl], [jit.textfile] and [jit.str.regexp] which can download files from http or ftp. There's a good example called "parser/downloader" in the latter's help file which might be of use to you.

lh

Simon's icon

Cheers for the reply luke, will give that a go.

Simon's icon

Hey I managed to get this working so I can manually load a file into the buffer after it downloads. Is there a way to get the file name from jit.uldl and then append it to the save directory information so it can be automatically loaded into a browser?

Luke Hall's icon

I'm not exactly sure what you mean. If you have the sound files in [buffer~]s you could always use [info~] to get the file name. By loading into a browser to you mean uploading a document to your web host from max?

lh

Simon's icon

the jit.udl object downloads the file to a specified location. Is there a way to get the file name and chosen download location from the udl so I can automatically load it into the buffer, without having to manually load it in??

Luke Hall's icon

If you're downloading the file with [jit.uldl] I imagine you're using the "download" message so you can just grab the filename from there. You should be able to do it with [regexp] there's some good pointers on the forum if you need help with that. There's an example included below for illustration. The "getdefaultdir" message will output the download location.

Max Patch
Copy patch and select New From Clipboard in Max.

lh

Simon's icon

Thats great cheers, got it now. Thanks a lot!

Simon's icon

Another question! Is it possible to pull down a list of everything on the database and put it in a table so users can click on entries in the table to download?

Also if each sound on the database is tagged, is it possible to add these tags to the table?

Basically I want to have a table with :

column 1 : sample file name (click on this to load into buffer)
column 2+ : sample attributes (eg source, genre, etc)

Thanks a lot for the help!!

Luke Hall's icon

That would depend entirely on how your database is organised. Is it a proper SQL database, a list of links in an HTML document or something else entirely? It probably isn't impossible but it's difficult to make suggestions without knowing a bit more. You might want to look at [jit.cellblock] for creating a table in max. The extra columns could be done if the information is stored in the database, not entirely sure how you'd go about if you want to read ID3 tags from the files themselves.

lh

Simon's icon

Sorry, was a bit braindead when I posted there! Yep its going to be a proper SQL database. I'm gonna include tags on the database with the files as opposed to using ID3 tags (although is this a possible alternative?).

I will check out jit.cellblock, still getting my head 'round jitter after coming from vvvv!

Thanks a lot for all your help, much appreciated!