1 /***************************************************************************
2 * Copyright (c) 2007 Nikolaj Hald Nielsen <nhnFreespirit@gmail.com> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. *
18 ***************************************************************************/
20 #ifndef PlaylistLoader_H
21 #define PlaylistLoader_H
24 #include "debug.h" //stack allocated
25 #include "meta/meta.h"
28 #include <kio/jobclasses.h>
36 * @class PlaylistLoader
37 * @author Nikolaj Hald Nielsen <nhnFreespirit@gmail.com>
38 * @short Simple frontend class for getting the contents of a playlist onto the playlist
41 class PlaylistLoader
: public QObject
48 bool isPlaylist( const KUrl
&path
);
49 void load( const QString
&path
);
51 enum Format
{ M3U
, PLS
, XML
, RAM
, SMIL
, ASX
, XSPF
, Unknown
, NotPlaylist
= Unknown
};
57 KIO::StoredTransferJob
* m_downloadJob
;
62 void downloadPlaylist( const KUrl
& path
);
64 bool loadPls( QTextStream
&stream
);
65 unsigned int loadPls_extractIndex( const QString
&str
) const;
66 bool loadM3u( QTextStream
&stream
);
67 bool loadRealAudioRam( QTextStream
& );
68 bool loadASX( QTextStream
& );
69 bool loadSMIL( QTextStream
& );
71 Format
getFormat( const KUrl
&path
);
72 void handleByFormat( QTextStream
&stream
, Format format
);
73 Format
getType( QString
&contents
);
75 static QTime
stringToTime(const QString
&);
79 void downloadComplete( KJob
*job
);