File indexing completed on 2024-05-19 04:49:30
0001 /**************************************************************************************** 0002 * Copyright (c) 2007 Ian Monroe <ian@monroe.nu> * 0003 * (c) 2010 Jeff Mitchell <mitchell@kde.org> * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify it under * 0006 * the terms of the GNU General Public License as published by the Free Software * 0007 * Foundation; either version 2 of the License, or (at your option) version 3 or * 0008 * any later version accepted by the membership of KDE e.V. (or its successor approved * 0009 * by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of * 0010 * version 3 of the license. * 0011 * * 0012 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0013 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0014 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0015 * * 0016 * You should have received a copy of the GNU General Public License along with * 0017 * this program. If not, see <http://www.gnu.org/licenses/>. * 0018 ****************************************************************************************/ 0019 0020 #include "core/playlists/PlaylistFormat.h" 0021 0022 #include "core/support/Amarok.h" 0023 0024 #include <QUrl> 0025 0026 #include <QString> 0027 0028 namespace Playlists { 0029 0030 PlaylistFormat 0031 getFormat( const QUrl &path ) 0032 { 0033 const QString ext = Amarok::extension( path.fileName() ); 0034 0035 if( ext == QLatin1String("m3u") || ext == QLatin1String("m3u8") ) return M3U; //m3u8 is M3U in UTF8 0036 if( ext == QLatin1String("pls") ) return PLS; 0037 if( ext == QLatin1String("ram") ) return RAM; 0038 if( ext == QLatin1String("smil")) return SMIL; 0039 if( ext == QLatin1String("asx") || ext == QLatin1String("wax") || ext == QLatin1String("asf") ) return ASX; 0040 if( ext == QLatin1String("xml") ) return XML; 0041 if( ext == QLatin1String("xspf") ) return XSPF; 0042 0043 return Unknown; 0044 } 0045 0046 bool 0047 isPlaylist( const QUrl &path ) 0048 { 0049 return ( getFormat( path ) != Unknown ); 0050 } 0051 0052 }