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 
30 class PlaylistCreator;
31 
40  public QObject
41 {
42  Q_OBJECT
44 
45  public:
46  explicit AbstractStationHandler(PlaylistCreator* playlistCreator, QObject* parent=nullptr);
47  virtual ~AbstractStationHandler();
48 
49  signals:
50  void sigStopped();
51  void sigError();
52  void sigDataAvailable();
53  void sigUrlCountExceeded(int urlCount, int maxUrlCount);
54 
55  public:
62  bool parseStation(StationPtr station);
63 
69  bool save(StationPtr station);
70 
76  virtual bool getAllStreams(QList<StationPtr>& streams)=0;
77 
85  virtual bool addNewStream(StationPtr station)=0;
86 
87  virtual StationPtr createStreamInstance(const QString& name, const QString& url) const=0;
88 
94  virtual bool deleteStream(const QString& name)=0;
95 
102  virtual bool update(const QString& name, StationPtr station)=0;
103 
104  virtual StationPtr station(const QString& name)=0;
105 
109  void stop();
110 
111  protected:
112  virtual void createPlaylist(StationPtr station, MetaDataList& tracks);
113 
114  private slots:
115  void parserFinished(bool success);
116  void parserStopped();
117 };
118 
119 #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:41
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.
PlaylistCreator
Definition: PlaylistInterface.h:56
AbstractStationHandler::parseStation
bool parseStation(StationPtr station)
Retrieves data from the station and tries to interprete it via the parse_content() method.