Qmmp
Loading...
Searching...
No Matches
playlistdownloader.h
1/***************************************************************************
2 * Copyright (C) 2012-2022 by Ilya Kotov *
3 * forkotov02@ya.ru *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
20
21#ifndef PLAYLISTDOWNLOADER_H
22#define PLAYLISTDOWNLOADER_H
23
24#include <QObject>
25#include <QUrl>
26#include <QPointer>
27#include "playlistmodel.h"
28#include "qmmpui_export.h"
29
30class QNetworkAccessManager;
31class QNetworkReply;
32
36class QMMPUI_EXPORT PlayListDownloader : public QObject
37{
38 Q_OBJECT
39public:
43 explicit PlayListDownloader(QObject *parent = nullptr);
44
45signals:
51 void finished(bool ok, const QString &message = QString());
52
53public slots:
59 void start(const QUrl &url, PlayListModel *model);
60
61private slots:
62 void onDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
63 void readResponse(QNetworkReply *reply);
64
65private:
66 QNetworkAccessManager *m_manager;
67 QUrl m_redirect_url, m_url;
68 QNetworkReply *m_downloadReply = nullptr;
69 QNetworkReply *m_checkReply = nullptr;
70 QByteArray m_ua;
71 QPointer<PlayListModel> m_model;
72};
73
74#endif // PLAYLISTDOWNLOADER_H
The PlayListDownloader class downloads playlist from remote URL and extracts tracks.
Definition playlistdownloader.h:37
PlayListDownloader(QObject *parent=nullptr)
void start(const QUrl &url, PlayListModel *model)
void finished(bool ok, const QString &message=QString())
The PlayListModel class provides a data model for the playlist.
Definition playlistmodel.h:97