Sayonara Player
AbstractStreamHandler.h
1 /* AbstractStreamHandler.h */
2 
3 /* Copyright (C) 2011-2019 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 #ifndef AbstractStreamHandler_H
22 #define AbstractStreamHandler_H
23 
24 #include <QObject>
25 
26 #include "Utils/Pimpl.h"
27 
29 
37 class AbstractStreamHandler : public QObject
38 {
39  Q_OBJECT
41 
42  public:
43  explicit AbstractStreamHandler(QObject *parent=nullptr);
44  virtual ~AbstractStreamHandler();
45 
46  signals:
47  void sig_stopped();
48  void sig_error();
49  void sig_data_available();
50  void sig_too_many_urls_found(int n_urls, int max_n_urls);
51 
52  public:
59  bool parse_station(const QString& url, const QString& station_name);
60 
66  bool save(const QString& station_name, const QString& url);
67 
73  virtual bool get_all_streams(StreamMap& streams)=0;
74 
82  virtual bool add_stream(const QString& station_name, const QString& url)=0;
83 
89  virtual bool delete_stream(const QString& station_name)=0;
90 
97  virtual bool update_url(const QString& station_name, const QString& url)=0;
98 
105  virtual bool rename(const QString& old_name, const QString& new_name)=0;
106 
110  void clear();
111 
112  void stop();
113 
114  private slots:
115  void stream_parser_finished(bool success);
116  void stopped();
117 };
118 
119 #endif // AbstractStreamHandler_H
void clear()
Clears all station content.
virtual bool get_all_streams(StreamMap &streams)=0
This method should return all stations in database.
bool save(const QString &station_name, const QString &url)
Saves the station. Calls the add_stream() method.
virtual bool update_url(const QString &station_name, const QString &url)=0
Update the url of a station.
virtual bool delete_stream(const QString &station_name)=0
Delete a station from the database.
virtual bool rename(const QString &old_name, const QString &new_name)=0
Rename station.
virtual bool add_stream(const QString &station_name, const QString &url)=0
This method should add a new station to database. If the station already exists, there should be a co...
Used to interprete website data as streams. Some methods have to be overridden, to map their function...
Definition: AbstractStreamHandler.h:37
bool parse_station(const QString &url, const QString &station_name)
Retrieves data from the station and tries to interprete it via the parse_content() method...
Definition: org_mpris_media_player2_adaptor.h:21