Qmmp
playlistparser.h
1 /***************************************************************************
2  * Copyright (C) 2008-2022 by Ilya Kotov *
3  * forkotov02@ya.ru *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 #ifndef PLAYLISTPARSER_H
21 #define PLAYLISTPARSER_H
22 
23 #include <QStringList>
24 #include <QUrl>
25 #include <QHash>
26 #include "playlisttrack.h"
27 #include "playlistformat.h"
28 #include "qmmpui_export.h"
29 
33 class QMMPUI_EXPORT PlayListParser
34 {
35 public:
39  static QList<PlayListFormat*> formats();
43  static QStringList nameFilters();
47  static QStringList filters();
52  static bool isPlayList(const QString &url);
57  static PlayListFormat *findByMime(const QString &mime);
62  static PlayListFormat *findByPath(const QString &filePath);
67  static PlayListFormat *findByUrl(const QUrl &url);
73  static void savePlayList(QList<PlayListTrack *> tracks, const QString &f_name);
79  static QList<PlayListTrack *> loadPlaylist(const QString &f_name);
86  static QList<PlayListTrack *> loadPlaylist(const QString &fmt, const QByteArray &content);
90  static void loadFormats();
95  static QByteArray serialize(const QList<PlayListTrack *> &tracks);
100  static QList<PlayListTrack *> deserialize(const QByteArray &json);
101 
102 private:
103  PlayListParser(){}
104 
105  static QList<PlayListFormat*> *m_formats;
106  static const QHash<QString, Qmmp::MetaData> m_metaKeys;
107  static const QHash<QString, Qmmp::TrackProperty> m_propKeys;
108 
109 
110 };
111 
112 #endif
Abstract interface for playlist formats.
Definition: playlistformat.h:43
The PlaylistParser class provides a simple api to access playlist format plugins.
Definition: playlistparser.h:34
static QStringList nameFilters()
static QList< PlayListTrack * > deserialize(const QByteArray &json)
static bool isPlayList(const QString &url)
static QStringList filters()
static QList< PlayListTrack * > loadPlaylist(const QString &fmt, const QByteArray &content)
static QList< PlayListTrack * > loadPlaylist(const QString &f_name)
static PlayListFormat * findByPath(const QString &filePath)
static void loadFormats()
static QByteArray serialize(const QList< PlayListTrack * > &tracks)
static void savePlayList(QList< PlayListTrack * > tracks, const QString &f_name)
static QList< PlayListFormat * > formats()
static PlayListFormat * findByMime(const QString &mime)
static PlayListFormat * findByUrl(const QUrl &url)