Sayonara Player
StreamParser.h
1 /* StreamParser.h */
2 
3 /* Copyright (C) 2011-2016 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 #ifndef STREAMPARSER_H
23 #define STREAMPARSER_H
24 
25 #include <QObject>
26 #include <QString>
27 #include <QStringList>
28 #include "Helper/MetaData/MetaDataList.h"
29 
30 class StreamParser : public QObject
31 {
32  Q_OBJECT
33 
34  signals:
35  void sig_finished(bool);
36 
37  public:
38  StreamParser(const QString& station_name=QString(), QObject* parent=nullptr);
39 
40  void parse_stream(const QString& url);
41  void parse_streams(const QStringList& urls);
42  void set_cover_url(const QString& cover_url);
43 
44  MetaDataList get_metadata() const;
45 
46  private slots:
47  void awa_finished(bool success);
48 
49 
50  private:
51  QStringList _urls;
52  QString _last_url;
53  QStringList _stream_buffer;
54  QString _station_name;
55  QString _cover_url;
56  MetaDataList _v_md;
57 
58  private:
64  QStringList search_for_playlist_files(const QByteArray& data) const;
65 
71  QString write_playlist_file(const QByteArray& data) const;
72 
73 
84  MetaDataList parse_content(const QByteArray& data);
85 
91  void tag_metadata(MetaData& md, const QString& stream_url) const;
92 
93 
94  bool parse_next();
95 
96 };
97 
98 #endif
Definition: StreamParser.h:30
Definition: MetaData.h:49
Definition: MetaDataList.h:44