Sayonara Player
Loading...
Searching...
No Matches
AbstractStationHandler.h
1/* AbstractStreamHandler.h */
2
3/* Copyright (C) 2011-2024 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
30namespace Playlist
31{
32 class Creator;
33}
34
36
38 public QObject
39{
40 Q_OBJECT
42
43 signals:
44 void sigStopped();
45 void sigError();
46 void sigDataAvailable();
47 void sigUrlCountExceeded(int urlCount, int maxUrlCount);
48
49 public:
51 const std::shared_ptr<StationParserFactory>& stationParserFactory,
52 QObject* parent = nullptr);
53 ~AbstractStationHandler() override;
54
55 bool parseStation(const StationPtr& station);
56
57 void addTemporaryStation(const StationPtr& station);
58 [[nodiscard]] bool isTemporary(const QString& stationName) const;
59
60 [[nodiscard]] StationPtr station(const QString& name);
61 bool addNewStream(const StationPtr& station);
62 bool removeStream(const QString& name);
63
64 virtual bool getAllStreams(QList<StationPtr>& streams) = 0;
65 virtual bool updateStream(const QString& name, const StationPtr& station) = 0;
66
67 void stop();
68
69 protected:
70 virtual MetaDataList preprocessPlaylist(const StationPtr& station, MetaDataList tracks) = 0;
71 virtual bool saveStream(const StationPtr& station) = 0;
72 virtual bool deleteStream(const QString& name) = 0;
73 [[nodiscard]] virtual StationPtr fetchStation(const QString& name) = 0;
74
75 private:
76 void createPlaylist(const StationPtr& station, MetaDataList tracks);
77
78 private slots: // NOLINT(readability-redundant-access-specifiers)
79 void parserFinished(bool success);
80 void parserStopped();
81};
82
83#endif // AbstractStreamHandler_H
Definition AbstractStationHandler.h:39
Definition MetaDataList.h:34
Definition PlaylistInterface.h:60
Definition EngineUtils.h:33
Definition StreamParser.h:53