Back to top

Autore Topic: [RISOLTO] Plugin - Lettore mp3  (Letto 6392 volte)

Offline ofranco

  • Appassionato
  • ***
  • Post: 215
  • Sesso: Maschio
    • Mostra profilo
[RISOLTO] Plugin - Lettore mp3
« il: 25 Feb 2011, 11:13:22 »
A titolo sperimentale, sto realizzando un sito con joomla 1.6 per i miei amici musicisti. Per far ascoltare la loro musica sto cercando di installare il plugin plg_mp3browser..... ho già visto che mi si blocca tutto.  :-[ sembra che questo plugin sia compatibile soltanto con la versione di 1.5 di Joomla. Qualcuno ha già trovato qualcosa in merito?
Ringrazio anticipatamente per tutte le risposte che vorrete darmi.
Saluti, Franco
« Ultima modifica: 25 Feb 2011, 21:50:20 da ofranco »
Finché abbiamo dei ricordi, il passato dura.
Finché abbiamo delle speranze, il futuro ci attende.
Finché abbiamo degli amici, il presente vale la pena di essere vissuto.

Offline webbati

  • Esploratore
  • **
  • Post: 116
    • Mostra profilo
Re:Plugin - Lettore mp3
« Risposta #1 il: 25 Feb 2011, 12:31:06 »
Ciao ofranco, ho modificato il file del plugin mp3browser, mi sembra funga, appena ho tempo sistemo anche il file per personalizzare i  parametri.

Sostituisci il contenuto del file mp3browser.php che trovi in ROOT_DEL_SITO/plugins/content/mp3browser/ con questo ( dopo averne fatto una copia che non si sa mai  ;D )

Codice: [Seleziona]
<?php
/**
 * @version $Id: mp3browser.php 1.5.18 28-07-2010 Jon Hollis
 * @update modified version for joomla 1.6 by webbati
 * @package MP3Browser
 * @copyright Copyright (C) 2010 Dotcomdevelopment. http://www.dotcomdevelopment.com
 * @license GNU/GPL. http://www.gnu.org/licenses/gpl.html
 */

// Check to ensure this file is included in Joomla!
defined'_JEXEC' ) or die( 'Restricted access' );



class 
plgContentMp3browser extends JPlugin
{
/**
 * Constructor
 *
 * @access      protected
 * @param       object  $subject The object to observe
 * @param       array   $config  An array that holds the plugin configuration
 * @since       1.5
 */
public function __construct(& $subject$params)
{
parent::__construct($subject$params);
//$this->loadLanguage();
}

public function onContentPrepare($context, &$row, &$params$page 0) {

     
    
//Find all {music} tags in content items
if ( preg_match_all("#{music}(.*?){/music}#s"$row->text$matchesPREG_PATTERN_ORDER) > ) {

//If found load config
// j!1.5 paths
$mosConfig_absolute_path JPATH_SITE;
$mosConfig_live_site JURI :: base();
if(substr($mosConfig_live_site, -1)=="/"$mosConfig_live_site substr($mosConfig_live_site0, -1);
$browserpath $mosConfig_live_site "/plugins/content/mp3browser/mp3browser/";

require_once("mp3browser".DS."getid3.php");

//Load Plugin parameters and set defaults 


$maxRows $this->params->get('maxRows''20');
$showDownload $this->params->get('showDownload''1');
$showSize $this->params->get('showSize''1');
$showLength $this->params->get('showLength''1');

$downloadText $this->params->get('downloadText''Download');
$nameText $this->params->get('nameText''Name');
$playText $this->params->get('playText''Play');
$sizeText $this->params->get('sizeText''Size');
$lengthText $this->params->get('lengthText''Length');
$sortByAsc $this->params->get('sortBy''0');

$tableWidth $this->params->get('tableWidth'0);

if ( $tableWidth==$tableWidth '100%';
else $tableWidth $tableWidth 'px';

$headerHeight $this->params->get('headerHeight'35);
$rowHeight $this->params->get('rowHeight'50);
$bottomRowBorder $this->params->get('bottomRowBorder''#C0C0C0');
$primaryRowColor $this->params->get('primaryRowColor''#ffffff');
$headerColor $this->params->get('headerColor''#cccccc');
$altRowColor $this->params->get('altRowColor''#D6E3EB');
$downloadColWidth $this->params->get('downloadColWidth'90);
$downloadImage $this->params->get('downloadImage'0);

$backlink $this->params->get('backlink'1);

if ( $downloadImage===) {
    $downloadImage='downloadtune.jpg';
}

$downloadImageAlt $this->params->get('downloadImageAlt'0);

if ( $downloadImageAlt===) {
    $downloadImageAlt='downloadtune-blue.jpg';
}

foreach ($matches[0] as $match) {
$_temp preg_replace("/{.+?}/"""$match);

//print table styles
$html '


     <!-- START: mp3 Browser --> 
     <style type="text/css">
     table.mp3browser td.center { text-align:center; }
     table.mp3browser td { text-align:left; height:' 
$rowHeight 'px } 
     .mp3browser tr.musictitles td { height:' 
$headerHeight 'px; } 
     .mp3browser tr.musictitles { vertical-align:middle; background-color:'  
$headerColor '; font-weight:bold; margin-bottom:15px; }
                .mp3browser td, .mp3browser th { padding:1px; vertical-align:middle; }
                .musictable { border-bottom:1px solid ' 
$bottomRowBorder '; text-align:left; height:' $rowHeight 'px; vertical-align:middle; }
                .mp3browser tr {background-color:' 
$primaryRowColor ' }
                .mp3browser a:link, .mp3browser a:visited { color:#1E87C8; text-decoration:none; }
                .mp3browser .colourblue { background-color:' 
$altRowColor '; border-bottom:1px solid #C0C0C0; text-align:left; }
            </style>
        '
;

//print table headers
$html .= '
     <table width="' 
$tableWidth '" cellspacing="0" cellpadding="0" border="0" class="mp3browser" style="text-align: left;">
         <tr class="musictitles">'
;

if( $showDownload ) {
    $html .= '
            <td style="width:' 
$downloadColWidth .'px;text-align:center;">' $downloadText '</td>';
}

$html .= '
            <td '
;
        
if( !$showDownload $html .= 'style="padding-left:10px;"';

$html .= '>' $nameText '</td>
            <td width="220">' 
$playText '</td>';

if($showSize){
    $html .= '
            <td width="60">' 
$sizeText '</td>';
}

if( $showLength ) {
    $html .= '
            <td width="70">' 
$lengthText '</td>';
}
$html .= '
        </tr>'
;

//print table rows for each mp3 in directory
if ( $handle opendirJPATH_SITE.DS $_temp )) {
    
$musicDir $mosConfig_live_site "/" $_temp;
            
            
// added for force download 
            // NOT USED DUE TO THE HUGE SECURITY WHOLE THAT THIS EXPOSES BY ENABLING USERS TO DOWNLOAD ALL SITE FILES
            
$mp3dldir $_temp;
            
$dir_array = array();
$i 0;
$count 0;
$narray '';

while (false !== ( $file readdir($handle)) ) {
$fileType substr$filestrrpos($file'.') );

if ( $file != "." && $file != ".." && $fileType == '.mp3' ) {
$narray[$count] = $file;
        
$count++;
}
}

if( $sortByAsc )
    sort$narray,SORT_STRING );
else
    rsort$narray,SORT_STRING );

$numRows sizeof$narray );
if ( $numRows $maxRows ) {
  $numRows $maxRows;
}

        
for( $count=0$count<$numRows$count++ ) {
        
    
        
$file $narray[$count];
        
$artist '';
        
$filesize '';
        
$filetoget JPATH_SITE.DS.$_temp.DS.$file;

$getID3 = new getID3;

$getID3->encoding 'UTF-8';
$ThisFileInfo $getID3->analyze($filetoget);
getid3_lib::CopyTagsToComments($ThisFileInfo);

//If title tag found use that else use file name -mp3
if ( isset( $ThisFileInfo['comments']['title'][0] ) )
$title $ThisFileInfo['comments']['title'][0];
else $title substr($file,0,-4);

    //Calculate filesize
    $filesize = ( filesize(JPATH_SITE.DS.$_temp.DS.$file) * .0009765625 ) * .0009765625;
    $filesize round($filesize1);
   
    //print artist name if present
if ( isset ( $ThisFileInfo['comments']['artist'][0] ) ){
$artist '' $ThisFileInfo['comments']['artist'][0] . '';
}

$playtime $ThisFileInfo 'playtime_string' ];
$html .= '
<tr '
;

if ( $i $html .= 'class="colourblue"';

$html .= ' style="text-align: left;">';

//If Param is set to show download column.
if( $showDownload ) {
    
    // added 'downloadmp3.php' to force download
    
$html .= '
     <td class="center">
         <span>
             <a href="' 
$musicDir '/' $file '" title="Download Audio File" target="_blank" class="jce_file_custom">
                 <img src="' 
$browserpath;
                    
                    if( 
$i $html .= $downloadImageAlt
                    else 
$html .= $downloadImage;
                    
    
$html .= '" alt="download" />
             </a>
         </span>
     </td>'
;
}

        $html .= '
            <td '
;
        
    if( !$showDownload $html .= 'style="padding-left:10px;"';
    
        $html .= '><strong>'.$title.'</strong><br/>' $artist '</td>
            <td>
                <object width="200" height="20" bgcolor="'
;
        
$i == '1'?$html.=$altRowColor:$html.=$primaryRowColor;

$html .= '" data="' $browserpath 'dewplayer.swf?son=' $musicDir '/' $file '&amp;autoplay=0&amp;autoreplay=0" type="application/x-shockwave-flash">  <param value="' $browserpath 'dewplayer.swf?son=' $musicDir DS $file '&amp;autoplay=0&amp;autoreplay=0" name="movie"/><param value="';

$i == '1'?$html.=$altRowColor:$html.=$primaryRowColor;

$html .= '" name="bgcolor"/></object><br/>
    </td>'
;

if ( $showSize ) {
    $html .= '
    <td>'
.$filesize.' MB</td>';
}

if ( $showLength ) {
    $html .= '
    <td>'
.$playtime.' min<br/></td>
</tr>'
;
}

$i 1-$i;
}
}

if ( $backlink ) {
    
    $html .= '
         <tr style="height:30px !important;">
            <td colspan="5" style="text-align:right; height:30px !important;"><a href="http://www.dotcomdevelopment.com" style="color:'  
$headerColor ' !important; font-size:11px; font-weight:normal; margin-right:7px;" title="Joomla web design Birmingham">Joomla! web design...</a>&nbsp;</td>
        </tr>
    '
;
}

$html .= '
    </table>
    <!-- END: mp3 Browser -->
    
'
;

$row->text preg_replace"#{music}".$_temp."{/music}#s"$html $row->text ); 

closedir($handle);
}
}
}
}
?>






ciao

Offline webbati

  • Esploratore
  • **
  • Post: 116
    • Mostra profilo
Re:Plugin - Lettore mp3
« Risposta #2 il: 25 Feb 2011, 13:55:01 »
ecco qua l'altro file,

da sostituire a mp3browser.xml sempre in ROOT_DEL_SITO/plugins/content/mp3browser/

Codice: [Seleziona]

<extension type="plugin" version="1.5.0" group="content">
    <name>mp3 Browser</name>
    <version>1.5.18</version>
   
    <description>
        <![CDATA[Plugin to create a formatted table of mp3's. <br/<br/>To use the plugin:<br/><br/>Place the tags {music}folderName/subfolder{/music} in any content item, <br/>the plugin will strip the tags and replace it with a table containing all the mp3's from that folder for playing or downloading. <br/><br/>For the file name the mp3's id3 tag of title-artist is used, if no title tag is present the file name is used. <br/><br/>Please remember to publish the plugin!! <br/><br/>Released Under the GNU/GPL<br/>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL <br/><br/>For more info and support <a href="http://www.dotcomdevelopment.com/forum/">http://www.dotcomdevelopment.com/forum</a>...]]>
    </description>
   
    <license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
    <author>Luke Collymore, Shami Willms, Jon Hollis</author>
    <authoremail>jon@dotcomdevelopment.com</authoremail>
    <authorurl>http://www.dotcomdevelopment.com</authorurl>
    <copyright>Copyright (C) 2010 Dotcomdevelopment. All rights reserved.</copyright>
    <creationDate>June-2010</creationDate>
   
    <files>
        <filename plugin="mp3browser">mp3browser.php</filename>
        <folder>mp3browser/</folder>
    </files>

    <config><fields name="params"><fieldset name="basic">
        <field name="maxRows" type="text" size="12"
                default="20" label="Max rows"
                description="Enter the maximum number of rows per table, default=20" />
         <field name="@spacer" type="spacer" default="" label="" description="" />
         <field name="sortBy" type="radio" default="1" label="Sort Filenames" description="Sort by filename Ascending or Desending">
  <option value="1">Ascending</option>
  <option value="0">Descending</option>
  </field>
        <field name="@spacer" type="spacer" default="" label="" description="" />
        <field name="tableWidth" type="text" size="5"
                default="" label="Table Width"
                description="Enter just the numeric value for the width of the table- do not include 'px'. Enter 0 for 100%" />
        <field name="headerHeight" type="text" size="5"
                default="" label="Header Height"
                description="Enter the height for the table header- do not include 'px'." />
        <field name="rowHeight" type="text" size="5"
                default="" label="Row Height"
                description="Enter just the numeric value for the height of the table rows- do not include 'px'." />
        <field name="@spacer" type="spacer" default="" label="" description="" />
        <field name="headerColor" type="text" size="12"
                default="#CCCCCC" label="Table Header Color"
                description="Enter the table header color - eg #CCCCCC" />
        <field name="primaryRowColor" type="text" size="12"
                default="#FFFFFF" label="Primary Row Color"
                description="Enter the Primary row color - eg #FFFFFF" />
        <field name="altRowColor" type="text" size="12"
                default="#D6E3EB" label="Alt Row Color"
                description="Enter the alt row color - eg #D6E3EB" />
        <field name="bottomRowBorder" type="text" size="12"
                default="#C0C0C0" label="Row Bottom Border"
                description="Enter the row bottom border color - eg #C0C0C0" />

        <field name="@spacer" type="spacer" default="" label="" description="" />
    <field name="showDownload" type="radio" default="1" label="Show Download Column" description="Show Download Column">
  <option value="1">On</option>
  <option value="0">Off</option>
  </field>
        <field name="downloadText" type="text" size="12"
                default="Download" label="Download Header"
                description="Enter the text for the download column header" />
        <field name="downloadColWidth" type="text" size="5"
                default="" label="Download Colum Width"
                description="Enter the numeric value for the width of the Download column- do not include 'px'." />

        <field name="downloadImage" type="text" size="40"
                default="" label="Download Image"
                description="Enter the path and file for the download image eg 'images/stories/download.jpg'" />
        <field name="downloadImageAlt" type="text" size="40"
                default="" label="Alternative Download Image"
                description="Enter the path and file for the alt download image eg 'images/stories/download-alt.jpg'" />
        <field name="@spacer" type="spacer" default="" label="" description="" />
 
        <field name="nameText" type="text" size="12"
                default="Name" label="Name Header"
                description="Enter the text for the name column header" />
        <field name="@spacer" type="spacer" default="" label="" description="" />
        <field name="playText" type="text" size="12"
                default="Play" label="Play Header"
                description="Enter the text for the play column header" />
        <field name="@spacer" type="spacer" default="" label="" description="" />
        <field name="showSize" type="radio" default="1" label="Show Size Column" description="Show Size Column">
  <option value="1">On</option>
  <option value="0">Off</option>
  </field>
        <field name="sizeText" type="text" size="12"
                default="Size" label="Size Header"
                description="Enter the text for the size column header" />
               
        <field name="@spacer" type="spacer" default="" label="" description="" />
        <field name="showLength" type="radio" default="1" label="Show Length Column" description="Show Length Column">
  <option value="1">On</option>
  <option value="0">Off</option>
  </field>
        <field name="lengthText" type="text" size="12"
                default="Length" label="Length Header"
                description="Enter the text for the length column header" />     
        <field name="backlink" type="radio" default="1" label="Dotcom Development backlink" description="Dotcom Development backlink">
  <option value="1">On</option>
  <option value="0">Off</option>
  </field>
    </fieldset></fields></config>
</extension>



ciao ciao

Offline ofranco

  • Appassionato
  • ***
  • Post: 215
  • Sesso: Maschio
    • Mostra profilo
Re:[RISOLTO] Plugin - Lettore mp3
« Risposta #3 il: 25 Feb 2011, 21:54:02 »
Ottimo webbati,
se oggi hai sentito dei fischi nelle orecchie, ero io che ti stavo ringraziando  ;D  ;)
Ho sostituito i due file come mi hai suggerito ed ha funzionato subito.
Ora lo sto adattando alla grafica del sito.
Grazie ancora, Franco
Finché abbiamo dei ricordi, il passato dura.
Finché abbiamo delle speranze, il futuro ci attende.
Finché abbiamo degli amici, il presente vale la pena di essere vissuto.

Offline ecolora

  • Nuovo arrivato
  • *
  • Post: 1
    • Mostra profilo
Re:[RISOLTO] Plugin - Lettore mp3
« Risposta #4 il: 15 Giu 2011, 08:31:36 »
This version of plugin is for Joomla 1.5.
Try this version:
http://ecolora.com/index.php/programmy/file/5-plagin-mp3browser-dlya-muzykalnykh-satov-na-joomla-15
It is much better.

 



Web Design Bolzano Kreatif