Sayonara Player
AbstractStationHandler.h
1 /* AbstractStreamHandler.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (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 "Utils/Pimpl.h"
25 #include "Utils/Streams/Station.h"
26 
27 #include <QObject>
28 #include <QList>
29 
38  public QObject
39 {
40  Q_OBJECT
42 
43  public:
44  explicit AbstractStationHandler(QObject* parent=nullptr);
45  virtual ~AbstractStationHandler();
46 
47  signals:
48  void sigStopped();
49  void sigError();
50  void sigDataAvailable();
51  void sigUrlCountExceeded(int urlCount, int maxUrlCount);
52 
53  public:
60  bool parseStation(StationPtr station);
61 
67  bool save(StationPtr station);
68 
74  virtual bool getAllStreams(QList<StationPtr>& streams)=0;
75 
83  virtual bool addNewStream(StationPtr station)=0;
84 
85  virtual StationPtr createStreamInstance(const QString& name, const QString& url) const=0;
86 
92  virtual bool deleteStream(const QString& name)=0;
93 
100  virtual bool update(const QString& name, StationPtr station)=0;
101 
102  virtual StationPtr station(const QString& name)=0;
103 
107  void stop();
108 
109  protected:
110  virtual void createPlaylist(StationPtr station, MetaDataList& tracks);
111 
112  private slots:
113  void parserFinished(bool success);
114  void parserStopped();
115 };
116 
117 #endif // AbstractStreamHandler_H
MetaDataList
The MetaDataList class.
Definition: MetaDataList.h:37
QList
Definition: EngineUtils.h:33
AbstractStationHandler
Used to interprete website data as streams. Some methods have to be overridden, to map their function...
Definition: AbstractStationHandler.h:39
AbstractStationHandler::getAllStreams
virtual bool getAllStreams(QList< StationPtr > &streams)=0
This method should return all stations in database.
AbstractStationHandler::stop
void stop()
Clears all station content.
AbstractStationHandler::deleteStream
virtual bool deleteStream(const QString &name)=0
Delete a station from the database.
AbstractStationHandler::addNewStream
virtual bool addNewStream(StationPtr station)=0
This method should add a new station to database. If the station already exists, there should be a co...
AbstractStationHandler::update
virtual bool update(const QString &name, StationPtr station)=0
Update the url of a station.
AbstractStationHandler::save
bool save(StationPtr station)
Saves the station. Calls the add_stream() method.
AbstractStationHandler::parseStation
bool parseStation(StationPtr station)
Retrieves data from the station and tries to interprete it via the parse_content() method.