File indexing completed on 2024-05-19 04:03:04

0001 /*
0002     SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #ifndef YOUTUBEJOB_H
0008 #define YOUTUBEJOB_H
0009 
0010 #include <KJob>
0011 #include <QNetworkAccessManager>
0012 #include <QString>
0013 #include <QUrl>
0014 
0015 class YoutubeJob : public KJob
0016 {
0017     Q_OBJECT
0018 public:
0019     YoutubeJob(const QUrl &url, const QByteArray &token, const QString &title, const QStringList &tags, const QString &description, QObject *parent = nullptr);
0020     void start() override;
0021 
0022     QString outputUrl() const
0023     {
0024         return m_output;
0025     }
0026 
0027 private:
0028     void fileFetched(KJob *);
0029     void createLocation();
0030     void locationCreated();
0031     void uploadVideo(const QByteArray &data);
0032     void videoUploaded();
0033 
0034     QUrl m_url;
0035     QByteArray m_token;
0036     QString m_output;
0037     QNetworkAccessManager m_manager;
0038     QByteArray m_metadata;
0039     QUrl m_uploadUrl;
0040 };
0041 #endif /* YOUTUBEJOB_H */