[MOD] MP3 Upload Module

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 08-06-2007, 09:51 PM
cent's Avatar
Constant Pligger
 
Join Date: Jan 2007
Location: New York, NY
Posts: 180
Hi All,

I've uploaded MP3 Upload Module (v0.9) to downloads area.

With this mod, you can have a user attach an MP3 file with their submission. Playback is through a flash player in which you can adjust the colors through the settings. Alternatively, you can also use Quicktime as the playback plugin if you choose. It is easy to substitute a different player altogether (your mileage may vary).

All configuration information is detailed in the read me file.

By default, this module will store data in link_field1 and use the Flash player. You will likely need to change the link field you want to use especially if you're currently using the Image Upload or File Upload modules.

As Flash can only playback MP3s that are encoded with a sample rate that is divisible by 11.050 kHz, a check is done (chipmunk effect) to prevent such MP3s from being uploaded. You can however, disable this if you like.

On a listing page where there may be multiple instances of the MP3 Flash player, Javascript is used to automatically close/stop other instances to prevent audio from overlapping.

All MP3s are stored in an "audio" directory (must be chmod 755 or 777).

The module can either display the Flash player or have Smarty variables set if you would like to handle things outside of the module -- by default it shows the player.

This module uses the Flash player and JS code fragment from the Audio Player Wordpress plugin.

Best,
Cent
Reply With Quote
  #2 (permalink)  
Old 08-06-2007, 10:35 PM
Constant Pligger
Pligg Version: Pligg 9.9
Pligg Template: Custom
 
Join Date: Jul 2007
Location: Ottawa, Ontario
Posts: 146
Just a question, can it modified to be able to upload more than one track while submitting?

Again Thanks for this mod.
Reply With Quote
  #3 (permalink)  
Old 08-06-2007, 10:52 PM
cent's Avatar
Constant Pligger
 
Join Date: Jan 2007
Location: New York, NY
Posts: 180
Hi unknown,

As it stands now, no. However, once I can actually spend a few hours and finish up the Image Upload module that has multiple file support, then yes, it will. I made this module several months ago as its a variation of the Image Upload module so practically all of the code is the same. I uploaded it as there seemed to be a need for it and I had it lying.

Best,
Cent

Quote:
Originally Posted by Unknown View Post
Just a question, can it modified to be able to upload more than one track while submitting?

Again Thanks for this mod.
Reply With Quote
  #4 (permalink)  
Old 08-06-2007, 10:53 PM
Adaman's Avatar
Constant Pligger/Designer
Pligg Version: v9.8.2
Pligg Template: Custom
 
Join Date: Jan 2007
Location: Scotland
Posts: 101
Quote:
Originally Posted by Unknown View Post
Just a question, can it modified to be able to upload more than one track while submitting?

Again Thanks for this mod.
Could it also be modified to take mp3's from an external source as i use Switchpod - Podcast Hosting to host my podcasts?

Thanks for any info

Adam
Reply With Quote
  #5 (permalink)  
Old 08-06-2007, 11:17 PM
cent's Avatar
Constant Pligger
 
Join Date: Jan 2007
Location: New York, NY
Posts: 180
Hi Adaman,

The short answer, yes.

The long answer (general overview):

In order to use an external URL, you will need to do a few things. If you're familar with PHP, you should be able to have it play an MP3 from a URL. You will need to make some modifications to mp3_upload_main.php to handle the form field (ie. link_field1) as a URL instead of a file attachment -- pretty trivial.

If you want to check to see if the URL actually exists, you will need to use cURL (Google results).

You will also need to modify the mp3_upload_main.php -- mp3_upload_preview_handler() and mp3_upload_edit_preview_handler() functions. A new switch code can be added for external_media (just copy and paste the flash code block) and remove $audioPath.$audioFile and replace it with just $audioFile (that's the variable that gets populated with the link_field data). Then just change mp3_upload_settings.php, look for the define block for "module_mp3upload_presentation" and change it to 'external_media'.

In the mp3_upload_preview_handler() you will want to get rid of the call to getID3 and the check to see if the file exists. In its place, you'll want to use cURL to see if the file is available on the remote server.

One or 2 modifications to mp3_upload_edit_preview_handler() to point to the URL that will be in the $audioFile and remove anything related to $audioPath.

In mp3_upload_form_handler() you'll want to change the HTML form attribute from file to text so you can actually enter a URL.

In mp3_upload_delete_handler() function you will just want to remove the unlink code which removes the file from the server -- these wont be needed anymore.

The guts of the module is in mp3_upload_process_handler() which does the file handling for the uploads. Since you will be doing this remotely, most of this code will go except for a check on the URL. You'll need to remove the file checks there as they are for local files and the check on the sample rate. You might be able to check the sample rate remotely, but I'm not sure off-hand.

When you're done, you'll probably be left with about 100 lines of code most of which is already there.

Hope that helps.

Best,
Cent


Quote:
Originally Posted by Adaman View Post
Could it also be modified to take mp3's from an external source as i use Switchpod - Podcast Hosting to host my podcasts?

Thanks for any info

Adam
Reply With Quote
  #6 (permalink)  
Old 08-06-2007, 11:30 PM
Constant Pligger
Pligg Version: Pligg 9.9
Pligg Template: Custom
 
Join Date: Jul 2007
Location: Ottawa, Ontario
Posts: 146
Well, I know it'll come eventually, so I'll be patient

But one more question, how do you call upon this audioplayer, if I want to use it in conjunction with the embed_videos module? I have one that works like this:

value="http://mysite.com/player/xspf_player_slim.swf?song_url=$1&song_title=$1"

I tried just changing the player name to player.swf, the player appears, but doesn't seem to be able to fetch the track. I think this needs changing "?song_url=" but to what?

Thank you.
Reply With Quote
  #7 (permalink)  
Old 08-07-2007, 08:19 AM
Constant Pligger
 
Join Date: Apr 2007
Posts: 1,042
Hi cent,
what is your favourite development direction in the next time? Image/Mp3 Upload Module and/or File Upload Module (http://forums.pligg.com/pligg-mods/7...g-testers.html) ? Just to clear my horizon :-)
Reply With Quote
  #8 (permalink)  
Old 08-07-2007, 11:50 AM
cent's Avatar
Constant Pligger
 
Join Date: Jan 2007
Location: New York, NY
Posts: 180
Hi Unknown,

I'm not quite sure I understand what you are trying to do. Do you want use the xspf player in place of the one used for the mp3 upload module? If so, you can have the module set smarty variables and then plug those smarty variables into xspf. To do so, change the define statement in mp3_upload_settings.php which is "...usesmarty" to true. then in your link_summary.tpl, you can just plug the module_mp3upload_filename into your flash file such as http://mysite.com/player/xspf_player_slim.swf?song_url={$module_mp3upload_f ilename}

Hope that helps.

Best,
Cent


Quote:
Originally Posted by Unknown View Post
Well, I know it'll come eventually, so I'll be patient

But one more question, how do you call upon this audioplayer, if I want to use it in conjunction with the embed_videos module? I have one that works like this:

value="http://mysite.com/player/xspf_player_slim.swf?song_url=$1&song_title=$1"

I tried just changing the player name to player.swf, the player appears, but doesn't seem to be able to fetch the track. I think this needs changing "?song_url=" but to what?

Thank you.
Reply With Quote
  #9 (permalink)  
Old 08-07-2007, 11:56 AM
cent's Avatar
Constant Pligger
 
Join Date: Jan 2007
Location: New York, NY
Posts: 180
Hi tbones,

The next versions of my modules will be using their own database table to store data instead of putting it in a link_field. Once I finish up the image upload module, i'm going to update the mp3 and file upload modules to use this new table. among other things, you'll be able to have a potentially unlimited number of images, mp3s, and files attached to any submission. This will lend itself to having photo galleries and audio playlists. With a little tweaking, you can limit photos to a photo category and audio to an audio/music category.

I have a beta version of the new image upload module working... still needs some testing before release.

Best,
Cent

Quote:
Originally Posted by tbones View Post
Hi cent,
what is your favourite development direction in the next time? Image/Mp3 Upload Module and/or File Upload Module (http://forums.pligg.com/pligg-mods/7...g-testers.html) ? Just to clear my horizon :-)

Last edited by cent; 08-07-2007 at 12:00 PM.
Reply With Quote
  #10 (permalink)  
Old 08-07-2007, 11:59 AM
Constant Pligger
 
Join Date: Apr 2007
Posts: 1,042
A mulitmedia module! Sounds great, I´m really looking forward to it.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Upload Module (File and Image Attachment) Yankidank Free Modules 268 02-03-2012 12:19 PM
[MOD] Image Upload Module (v1.0) -- Now Available cent Questions and Comments 190 01-08-2011 05:12 PM
[MOD] Image Upload Module (v0.93) -- Please test cent Questions and Comments 54 05-01-2009 11:12 PM
[MOD] File Upload Module for 9.8.2 Is here for download :) Redux Questions and Comments 7 01-27-2008 09:21 AM
[MOD] File Upload Module -- seeking requests for features cent Questions and Comments 2 08-11-2007 05:39 AM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development