1
Burning
Oledrion : attached files and mp3 issue
  • 2009/11/10 16:48

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hi'

With Oledrion, each product can have his own attached files. It is possible to upload all kind of file :
• doc, pdf, ...
• jpg, gif, ...
• and mp3

Oledrion is able (should be able) to detect if attached file is :
• a mp3
• or not

If a mp3 file is found then, DewPlayer is displayed and customers can listen the file (or playlist if serveral files are detected).

... but actually, it does not work properly :
• module seems to not distinguish mp3 files and others
• so, all files are listed equally and so, Dewplayer is never displayed

I believe that issue comes from these two conditions :
• <{if $product.attached_mp3_count > 0}> : never above 0. If I delete this condition, Dewplayer is displayed but no mp3 is associated
• <{if !$attachedFile.file_is_mp3}> : always positive, even for mp3



There is the code :

Template : oledrion_product.html
<{if count($product.attached_files) > 0}>         
<
div class="margin20">
      
      <
h3><{$smarty.const._OLEDRION_ATTACHED_FILES}></h3>
      
      <!-- 
DOES NOT WORK in every case, nothing is displayed -->
      <{if 
$product.attached_mp3_count 0}>    
              
        <
div>
                    <{
$smarty.const._OLEDRION_MUSIC}>
                    <
div id='DewPlayerContainer'></div
                </
div>
                
                <
script type="text/javascript">
                    var 
paramsDew = {
                        
wmode"transparent"
                    
};
                
                    
jQuery().ready(function() {    
                        
jQuery('#DewPlayerContainer').flash({
                            
swf'<{$smarty.const.OLEDRION_URL}>dewplayer/<{if $product.attached_mp3_count > 1}>dewplayer-multi.swf<{else}>dewplayer.swf<{/if}>',
                            
hasVersion9,
                            
height: <{$smarty.const.OLEDRION_DEWPLAYER_HEIGHT}>,
                            
width : <{$smarty.const.OLEDRION_DEWPLAYER_WIDTH}>,
                            
paramsparamsDew
                            
flashvars: {
                                
mp3'<{$mp3FilesList}>'                                            
                            
}                                        
                        });
                    });    
                </
script>
            
            <{/if}>
            <!-- 
DOES NOT WORK in every case, nothing is displayed -->
      
      
     
      <{if 
$product.attached_non_mp3_count 0}>
      
        <
div>
        
        <{foreach 
item=attachedFile from=$product.attached_files}>
        
          <!-- 
WORKS TOO MUCH all files are detected as mp3 -->
            <{if !
$attachedFile.file_is_mp3}>
            
                <
a href="javascript:openWithSelfMain('<{$smarty.const.OLEDRION_URL}>media.php?product_id=<{$product.product_id}>&type=attachment&file_id=<{$attachedFile.file_id}>', '',<{$smarty.const.OLEDRION_POPUP_MEDIA_WIDTH}>, <{$smarty.const.OLEDRION_POPUP_MEDIA_HEIGHT}>);" rel="nofollow">
                <{
$attachedFile.file_description}>
                </
a>
            <{/if}>
        <{/foreach}>
        
        </
div>
      
      <{/if}>
      <!-- 
WORKS TOO MUCH all files are detected as mp3 -->

</
div>
<{/if}>


And php code related (product.php)
// Search attached files  *******************************************************
$attachedFiles $mp3AttachedFilesList $attachedFilesForTemplate = array();
$attachedFilesCount $h_oledrion_files->getProductFilesCount($product->getVar('product_id'));
if(
$attachedFilesCount 0) {
    
$attachedFiles $h_oledrion_files->getProductFiles($product->getVar('product_id'));
    foreach(
$attachedFiles as $attachedFile) {    // Search MP3 files
        
if($attachedFile->isMP3()) {
            
$mp3AttachedFilesList[] = $attachedFile->getURL();
        }
        
$attachedFilesForTemplate[] = $attachedFile->toArray();
    }
    if(
count($mp3AttachedFilesList) > 0) {
        
oledrion_utils::callJavascriptFile('jquery.swfobject/jquery.swfobject.min.js');
        
$xoopsTpl->assign('mp3FilesList'implode('|'$mp3AttachedFilesList));
    }
}

// Informations du produit **************************************************************************
$tbl_tmp = array();
$tbl_tmp $product->toArray();
// Fichiers attachés
$tbl_tmp['attached_mp3_count'] = count($mp3AttachedFilesList);
$tbl_tmp['attached_non_mp3_count'] = count($attachedFilesForTemplate) - count($mp3AttachedFilesList);
$tbl_tmp['attached_files'] = $attachedFilesForTemplate;    // Full list of attached files


I hope you understand the issue.

Thanks in advance



nb : I have tried to compress my mp3 in 44.100 and below. No effect, same issue

2
Burning
Re: Oledrion : attached files and mp3 issue
  • 2009/11/10 20:16

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hi' again

More information about "isMP3" function, coded in oledrion_files.php :

/**
     * Indique si le fichier courant est un fichier MP3
     * @return boolean
     */
    
function isMP3()
    {
        return 
strtolower($this->getVar('file_mimetype')) == 'audio/mpeg' true false;
    }


... still investigate

3
Burning
Re: Oledrion : attached files and mp3 issue
  • 2009/11/10 21:07

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hihi'

I have opened _oledrion_files table. Field file_mime is empty. Now, I understand why module does not detect any audio/mpeg file.

If I fill manually this field, files are properly ordered :
• mp3
• other files

... Dewplayer is displayed. It does not work yet, but I can see it I continue my investigation.


Edit by me : DewPlayer read mp3 with Internet Explorer 7 but not with Firefox 3.07...

4
serial-weber
Re: Oledrion : attached files and mp3 issue

Hi Burning,

I am using Oledrion in my web site and I want musicians of my country to sell their songs in my web site. What about the work you began for reading mp3 with Dewplayer??
Did you success to make it work good??

Thanks

5
Burning
Re: Oledrion : attached files and mp3 issue
  • 2010/3/15 22:30

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hi' Leoz

I'm very sorry, bug is still here

I'm not skilled with php, I pray every day that a serious developer takes care about oledrion

6
Burning
Re: Oledrion : attached files and mp3 issue
  • 2010/3/15 22:32

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


oups! sorry double post

Login

Who's Online

180 user(s) are online (102 user(s) are browsing Support Forums)


Members: 0


Guests: 180


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits