3 This file is part of Minitube.
4 Copyright 2009, Flavio Tordini <flavio.tordini@gmail.com>
6 Minitube is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 Minitube is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Minitube. If not, see <http://www.gnu.org/licenses/>.
25 #if QT_VERSION >= 0x050000
30 class VideoDefinition;
32 class Video : public QObject {
45 const QString &title() const { return m_title; }
46 void setTitle(const QString &value) { m_title = value; }
48 const QString &description() const { return m_description; }
49 void setDescription(const QString &value) { m_description = value; }
51 const QString &channelTitle() const { return m_channelTitle; }
52 void setChannelTitle(const QString &value) { m_channelTitle = value; }
54 const QString &channelId() const { return m_channelId; }
55 void setChannelId(const QString &value ) { m_channelId = value; }
57 const QString &webpage();
58 void setWebpage(const QString &value);
61 const QPixmap &thumbnail() const { return m_thumbnail; }
63 const QString &thumbnailUrl() { return m_thumbnailUrl; }
64 void setThumbnailUrl(const QString &value) { m_thumbnailUrl = value; }
66 const QString &mediumThumbnailUrl() { return m_mediumThumbnailUrl; }
67 void setMediumThumbnailUrl(const QString &value) { m_mediumThumbnailUrl = value; }
69 const QString &largeThumbnailUrl() { return m_largeThumbnailUrl; }
70 void setLargeThumbnailUrl(const QString &value) { m_largeThumbnailUrl = value; }
72 int duration() const { return m_duration; }
73 void setDuration(int value) { m_duration = value; }
74 QString formattedDuration() const;
76 int viewCount() const { return m_viewCount; }
77 void setViewCount(int viewCount) { m_viewCount = viewCount; }
79 const QDateTime &published() const { return m_published; }
80 void setPublished(const QDateTime &value) { m_published = value; }
82 int getDefinitionCode() const { return definitionCode; }
85 const QUrl &getStreamUrl() { return m_streamUrl; }
87 void setId(const QString &value) { videoId = value; }
88 const QString &id() const { return videoId; }
90 void setLicense(License value) { m_license = value; }
91 License license() const { return m_license; }
95 void gotMediumThumbnail(const QByteArray &bytes);
96 void gotLargeThumbnail(const QByteArray &bytes);
97 void gotStreamUrl(const QUrl &streamUrl);
98 void errorStreamUrl(const QString &message);
101 void setThumbnail(const QByteArray &bytes);
102 void gotVideoInfo(const QByteArray &bytes);
103 void errorVideoInfo(QNetworkReply *reply);
104 void scrapeWebPage(const QByteArray &bytes);
105 void parseJsPlayer(const QByteArray &bytes);
106 void parseDashManifest(const QByteArray &bytes);
110 void parseFmtUrlMap(const QString &fmtUrlMap, bool fromWebPage = false);
111 void captureFunction(const QString &name, const QString &js);
112 void captureObject(const QString &name, const QString &js);
113 QString decryptSignature(const QString &s);
114 void saveDefinitionForUrl(const QString &url, const VideoDefinition &definition);
117 QString m_description;
118 QString m_channelTitle;
123 QString m_thumbnailUrl;
124 QString m_mediumThumbnailUrl;
125 QString m_largeThumbnailUrl;
127 QDateTime m_published;
134 // current index for the elTypes list
135 // needed to iterate on elTypes
139 bool loadingStreamUrl;
140 bool loadingThumbnail;
144 QHash<QString, QString> sigFunctions;
145 QHash<QString, QString> sigObjects;
147 QString dashManifestUrl;
150 // This is required in order to use QPointer<Video> as a QVariant
151 // as used by the Model/View playlist
152 typedef QPointer<Video> VideoPointer;
153 Q_DECLARE_METATYPE(VideoPointer)