Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-06-2007, 08:51 PM
cent's Avatar
Constant Pligger
 
Join Date: Jan 2007
Location: New York, NY
Posts: 183
Thanks: 24
Thanked 65 Times in 26 Posts
[MOD] MP3 Upload Module

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
__________________
All of my modules are developed for free to help support the Pligg community. If you use or feel my modules were helpful to your site and want to thank me, please support the Pligg development team by donating.

Modules: Welcome Private Message (v0.1), Welcome Email (v0.1), Thickbox Module (v0.3), Image Upload (v1.0) & MP3 Upload Module (v0.9)
Reply With Quote
The Following 8 Users Say Thank You to cent For This Useful Post:
  #2 (permalink)  
Old 08-06-2007, 09:35 PM
Constant Pligger
Pligg Version: Pligg 9.9
Pligg Template: Custom
 
Join Date: Jul 2007
Location: Ottawa, Ontario
Posts: 156
Thanks: 27
Thanked 9 Times in 9 Posts
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, 09:52 PM
cent's Avatar
Constant Pligger
 
Join Date: Jan 2007
Location: New York, NY
Posts: 183
Thanks: 24
Thanked 65 Times in 26 Posts
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.
__________________
All of my modules are developed for free to help support the Pligg community. If you use or feel my modules were helpful to your site and want to thank me, please support the Pligg development team by donating.

Modules: Welcome Private Message (v0.1), Welcome Email (v0.1), Thickbox Module (v0.3), Image Upload (v1.0) & MP3 Upload Module (v0.9)
Reply With Quote
  #4 (permalink)  
Old 08-06-2007, 09:53 PM
Adaman's Avatar
Constant Pligger
Pligg Version: v9.8.2
Pligg Template: Custom
 
Join Date: Jan 2007
Location: Scotland
Posts: 111
Thanks: 23
Thanked 17 Times in 7 Posts
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
__________________
The Original Pligg Template Community Site - http://pligg-template.com
The P2P and File Sharing News and Bookmarking Site: http://p2pvine.com
Reply With Quote
  #5 (permalink)  
Old 08-06-2007, 10:17 PM
cent's Avatar
Constant Pligger
 
Join Date: Jan 2007
Location: New York, NY
Posts: 183
Thanks: 24
Thanked 65 Times in 26 Posts
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
__________________
All of my modules are developed for free to help support the Pligg community. If you use or feel my modules were helpful to your site and want to thank me, please support the Pligg development team by donating.

Modules: Welcome Private Message (v0.1), Welcome Email (v0.1), Thickbox Module (v0.3), Image Upload (v1.0) & MP3 Upload Module (v0.9)
Reply With Quote
The Following User Says Thank You to cent For This Useful Post:
  #6 (permalink)  
Old 08-06-2007, 10:30 PM
Constant Pligger
Pligg Version: Pligg 9.9
Pligg Template: Custom
 
Join Date: Jul 2007
Location: Ottawa, Ontario
Posts: 156
Thanks: 27
Thanked 9 Times in 9 Posts
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, 07:19 AM
Constant Pligger
 
Join Date: Apr 2007
Posts: 1,071
Thanks: 53
Thanked 25 Times in 23 Posts
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, 10:50 AM
cent's Avatar
Constant Pligger
 
Join Date: Jan 2007
Location: New York, NY
Posts: 183
Thanks: 24
Thanked 65 Times in 26 Posts
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.
__________________
All of my modules are developed for free to help support the Pligg community. If you use or feel my modules were helpful to your site and want to thank me, please support the Pligg development team by donating.

Modules: Welcome Private Message (v0.1), Welcome Email (v0.1), Thickbox Module (v0.3), Image Upload (v1.0) & MP3 Upload Module (v0.9)
Reply With Quote
  #9 (permalink)  
Old 08-07-2007, 10:56 AM
cent's Avatar
Constant Pligger
 
Join Date: Jan 2007
Location: New York, NY
Posts: 183
Thanks: 24
Thanked 65 Times in 26 Posts
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 :-)
__________________
All of my modules are developed for free to help support the Pligg community. If you use or feel my modules were helpful to your site and want to thank me, please support the Pligg development team by donating.

Modules: Welcome Private Message (v0.1), Welcome Email (v0.1), Thickbox Module (v0.3), Image Upload (v1.0) & MP3 Upload Module (v0.9)

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

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
[MOD] Image Upload Module (v1.0) -- Now Available cent Modification Tutorials 181 09-24-2008 10:43 PM
[MOD] File Upload Module (v0.1) -- Looking for testers cent Modification Tutorials 54 06-11-2008 10:34 AM
[MOD] Image Upload Module (v0.93) -- Please test cent Modification Tutorials 48 05-16-2008 08:08 PM
[MOD] File Upload Module for 9.8.2 Is here for download :) Redux Modification Tutorials 7 01-27-2008 08:21 AM
[MOD] File Upload Module -- seeking requests for features cent Modification Tutorials 3 08-11-2007 04:39 AM


Search Engine Friendly URLs by vBSEO 3.2.0