Question

I've got a project which requires a fairly complicated process and I want to make sure I know the best way to do this. I'm using ASP.net C# with Adobe Flex 3. The app server is Mosso (cloud server) and the file storage server is Amazon S3. The existing site can be viewed at NoiseTrade.com

I need to do this:

  • Allow users to upload MP3 files to an album "widget"
  • After the user has uploaded their album/widget, I need to automatically zip the mp3 (for other users to download) and upload the zip along with the mp3 tracks to Amazon S3

I actually have this working already (using client side processing in Flex) but this no longer works because of Adobe's flash 10 "security" update. So now I need to implement this server-side.

The way I am thinking of doing this is:

  • Store the mp3 in a temporary folder on the app server
  • When the artist "publishes" create a zip of the files in that folder using a c# library
  • Start the amazon S3 upload process (zip and mp3s) and email the user when it is finished (as well as deleting the temporary folder)

The major problem I see with this approach is that if a user deletes or adds a track later on I'll have to update the zip file but the temporary files will not longer exist.

I'm at a loss at the best way to do this and would appreciate any advice you might have.

Thanks!

Was it helpful?

Solution

The bit about updating the zip but not having the temporary files if the user adds or removes a track leads me to suspect that you want to build zips containing multiple tracks, possibly complete albums. If this is incorrect and you're just putting a single mp3 into each zip, then StingyJack is right and you'll probably end up making the file (slightly) larger rather than smaller by zipping it.

If my interpretation is correct, then you're in luck. Command-line zip tools frequently have flags which can be used to add files to or delete files from an existing zip archive. You have not stated which library or other method you're using to do the zipping, but I expect that it probably has this capability as well.

OTHER TIPS

MP3's are compressed. Why bother zipping them?

I would say it is not necessary to zip a compressed file format, you are only gong to get a five percent reduction in filesize, give or take a little. Mp3's dont really zip up by their nature the have compressed most of the possible data already.

DotNetZip can zip up files from C#/ASP.NET. I concur with the prior posters regarding compressibility of MP3s. DotNetZip will automatically skip compression on MP3, and just store the file, just for this reason. It still may be interesting to use a zip as a packaging/archive container, aside from the compression.

If you change the zip file later (user adds a track), you could grab the .zip file from S3, and just update it. DotNetZip can update zip files, too. But in this case you would have to pay for the transfer cost into and out of S3.

DotNetZip can do all of this with in-memory handling of the zips - though that may not be feasible for large archives with lots of MP3s and lots of concurrent users.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top