http get – taking samples off a database
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?
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.
Cheers for the reply luke, will give that a go.
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?
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?
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??
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.
----------begin_max5_patcher---------- 366.3ocqS1sbBBCDE9Z3oHSldQ6TKHHVsdWeNbrchjUIsgDFRnPqiu6kD.+2 Q6XufExYWV91SHqbcvykUfBilflhbbV453XkLBNsqcvojpXNQYKCKfR47Ov8 ZRogJsUNKmIzcpKjBsh8CXxDD50uUVTjxDbPaaTPqXFQGmvDKeOGh0MfLJp9 UPiFahCrOG12qOZ111HKzc8oq4LpkiZ1dZztbHHoVNvulyHbrIwZWWSn2sMw 4vRnJC4e+z27m83C20UPCa5uyfloAi6cv0lI4F8ogOa7ll3KAWvmFdrOE8+5 SofRQVBGYTTYofKITThVmMw2urrzKA3boWrL0uTl+oOofxj9JYJrfwACJdkj uNui9mbvvK4fCZhQ8M2BFeVKL3XKL75rPaCwbl3vyZVlL566qJYQdb2z1tUg B1fEETZlfnYRwN0T+aOZK5ILJED6dBIkQyj0mRaQ.M6j6wWKQg680NMQQ2.Q 0KV69KP7YZAD -----------end_max5_patcher-----------
Thats great cheers, got it now. Thanks a lot!
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!!
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.
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!