/src/

span='2'>cgit logo index : qmmp
Qmmp with Jyrki's patchesJyrki
aboutsummaryrefslogblamecommitdiff
path: root/src/plugins/Input/cue/cueparser.cpp
blob: 08b0f804ceeb5e4a35bb94cf671462d7dd0361e2 (plain) (tree)
1
2
3
                                                                            
                                                                            
                                                                            













                                                                            
                                                                            


                                                                             
               
                       


                      
                         
                                 


                 

                      
                                         
 

                            
     

                                           
     
                         
                                        
     
                                                                       

               
                                   
                                                                 
                               
                                                          
                                
                
                                    
                                                  

                                                                                               
 

                    
                                               












                                                                                                           
              
                                                                                            

                                                  

                                                                        
                               
                                                           
                                              
 
                               
     
                                                       





                                            
                                                                                             


                                         
                                  
                                  
                
                                                                       


                                     
                                  

                                 
                                                                      


                                     
                                    









                                                                                   



                                         
         
                                                         
         
                                   
                         
                                                          
                                              
         









                                           




                                                                                
                                                                                                 
                                                                                
                                                                                                 
         
     
                 



                                     
                          



                                                









                                       
                       
                              

                                             
                                                                
         
                               
                                                                                                           
         


                                                                      
                                                                                    


                                                                                                       
     

                       

 

                       

                         

 
                                              
 
                           
                                      
     
                                           



                
                                                  
 
                                                                               

 
















                                              
                                         
 
                                          

 
                                           
 
                                                   

 
                            
 
                            

 
                                     
 





                                                  

 
                                                                               
 
                                                         

 

                                                     
                                                 









                                         





                                                                                 















                                          
                                               

                                      


                                                                          
                                                                                                       
             
 
 
                                                                             
 
                                                                          







                                                               
                                                          







                                     
                                        

                  
                                                                       




















                                                                   
/***************************************************************************
 *   Copyright (C) 2008-2019 by Ilya Kotov                                 *
 *   forkotov02@ya.ru                                                      *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
 ***************************************************************************/

#include <QFile>
#include <QDir>
#include <QDirIterator>
#include <QSettings>
#include <QTextStream>
#include <QTextCodec>
#include <qmmp/decoder.h>
#include <qmmp/metadatamanager.h>
#ifdef WITH_ENCA
#include <enca.h>
#endif
#include "cueparser.h"

CUEParser::CUEParser(const QString &path)
{
    QString fileName = path;
    if(path.contains("://"))
    {
        fileName.remove("cue://");
        fileName.remove(QRegExp("#\\d+$"));
    }
    QFile file(fileName);
    if (!file.open(QIODevice::ReadOnly))
    {
        qDebug("CUEParser: error: %s", qPrintable(file.errorString()));
        return;
    }
    QTextStream textStream (&file);
    QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
    settings.beginGroup("CUE");
    m_dirty = settings.value("dirty_cue", false).toBool();
    QTextCodec *codec = nullptr;
#ifdef WITH_ENCA
    EncaAnalyser analyser = nullptr;
    if(settings.value("use_enca", false).toBool())
    {
        analyser = enca_analyser_alloc(settings.value("enca_lang").toByteArray ().constData());

        if(analyser)
        {