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/>.
29 class Video : public QObject {
37 enum License { LicenseYouTube = 1, LicenseCC };
40 const QString &getTitle() const { return title; }
41 void setTitle(const QString &value) { title = value; }
43 const QString &getDescription() const { return description; }
44 void setDescription(const QString &value) { description = value; }
46 const QString &getChannelTitle() const { return channelTitle; }
47 void setChannelTitle(const QString &value) { channelTitle = value; }
49 const QString &getChannelId() const { return channelId; }
50 void setChannelId(const QString &value) { channelId = value; }
52 const QString &getWebpage();
53 void setWebpage(const QString &value);
56 const QPixmap &getThumbnail() const { return thumbnail; }
58 const QString &getThumbnailUrl() const { return thumbnailUrl; }
59 void setThumbnailUrl(const QString &value) { thumbnailUrl = value; }
61 const QString &getMediumThumbnailUrl() const { return mediumThumbnailUrl; }
62 void setMediumThumbnailUrl(const QString &value) { mediumThumbnailUrl = value; }
64 const QString &getLargeThumbnailUrl() const { return largeThumbnailUrl; }
65 void setLargeThumbnailUrl(const QString &value) { largeThumbnailUrl = value; }
67 int getDuration() const { return duration; }
68 void setDuration(int value);
69 const QString &getFormattedDuration() const { return formattedDuration; }
71 int getViewCount() const { return viewCount; }
72 void setViewCount(int value);
73 const QString &getFormattedViewCount() const { return formattedViewCount; }
75 const QDateTime &getPublished() const { return published; }
76 void setPublished(const QDateTime &value);
77 const QString &getFormattedPublished() const { return formattedPublished; }
79 int getDefinitionCode() const { return definitionCode; }
82 const QString &getStreamUrl() { return streamUrl; }
83 bool isLoadingStreamUrl() const { return ytVideo != nullptr; }
84 void abortLoadStreamUrl();
86 const QString &getId() const { return id; }
87 void setId(const QString &value) { id = value; }
89 License getLicense() const { return license; }
90 void setLicense(License value) { license = value; }
94 void gotMediumThumbnail(const QByteArray &bytes);
95 void gotLargeThumbnail(const QByteArray &bytes);
96 void gotStreamUrl(const QString &videoUrl, const QString &audioUrl);
97 void errorStreamUrl(const QString &message);
100 void setThumbnail(const QByteArray &bytes);
101 void streamUrlLoaded(const QString &streamUrl, const QString &audioUrl);
106 QString channelTitle;
111 QString thumbnailUrl;
112 QString mediumThumbnailUrl;
113 QString largeThumbnailUrl;
115 QString formattedDuration;
118 QString formattedPublished;
120 QString formattedViewCount;
125 bool loadingThumbnail;
130 // This is required in order to use QPointer<Video> as a QVariant
131 // as used by the Model/View playlist
132 typedef QPointer<Video> VideoPointer;
133 Q_DECLARE_METATYPE(VideoPointer)