Next up, .asx playlists. Again, untested as I do not have a playlist of this type
[amarok.git] / src / playlist / PlaylistLoader.h
blobad8f3410ac022ab9f57c67d52ec7ad5709915729
1 /***************************************************************************
2 * Copyright (c) 2007 Nikolaj Hald Nielsen <nhnFreespirit@gmail.com> *
3 * *
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. *
8 * *
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. *
13 * *
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
23 #include "amarok.h"
24 #include "debug.h" //stack allocated
25 #include "meta/meta.h"
27 #include <kio/job.h>
28 #include <kio/jobclasses.h>
30 #include <QTime>
32 class KJob;
35 /**
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
43 Q_OBJECT
44 public:
46 PlaylistLoader();
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 };
54 private:
56 Format m_format;
57 KIO::StoredTransferJob * m_downloadJob;
58 QString m_contents;
59 QString m_path;
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&);
77 private slots:
79 void downloadComplete( KJob *job );
83 #endif