-
Notifications
You must be signed in to change notification settings - Fork 0
/
podcast.h
63 lines (57 loc) · 1.43 KB
/
podcast.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef PODCAST_H
#define PODCAST_H
#include <QObject>
#include <QString>
#include <QSet>
#include <QUrl>
#include <QDir>
#include <QJsonObject>
#include <QDebug>
#include <QSettings>
#include <QCoreApplication>
#include <QNetworkReply>
#include <QXmlStreamReader>
#include "output.h"
class Episode;
class Downloader;
class Podcast : public QObject
{
enum Mode
{
LOAD,
INIT_LAST,
INIT_NONE
};
Q_OBJECT
Mode mode;
Downloader* downloader;
QString title;
QUrl url;
QDir targetFolder;
QStringList episodeTitlesKnown;
QList<Episode*> episodes;
void newEpisode(const QUrl &url, QString podcastTitle, const QString& episodeTitle);
void parseRssLevel(QXmlStreamReader& xml);
void parseChannelLevel(QXmlStreamReader& xml);
void parseItemLevel(QXmlStreamReader &xml, const QString& podcastTitle);
void irrelevantElement(QXmlStreamReader& xml);
public:
explicit Podcast(QUrl url, Downloader* downloader, QObject *parent = 0);
void init(bool keepNewestEntry);
QUrl getUrl() const;
void setUrl(const QUrl &value);
void abort();
signals:
void done();
void writingFailed();
public slots:
void update();
void setTargetFolder(const QDir &value);
private slots:
void episodeDownloadSuccess();
void episodeDownloadFailed();
void feedDownloadSuccess(const QUrl& url, const QByteArray& data);
void feedDownloadFailed(const QUrl& url, QNetworkReply::NetworkError error);
void load();
};
#endif // PODCAST_H