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/>.
33 class Video : public QObject {
41 enum License { LicenseYouTube = 1, LicenseCC };
44 const QString &getTitle() const { return title; }
45 void setTitle(const QString &value) { title = value; }
47 const QString &getDescription() const { return description; }
48 void setDescription(const QString &value) { description = value; }
50 const QString &getChannelTitle() const { return channelTitle; }
51 void setChannelTitle(const QString &value) { channelTitle = value; }
53 const QString &getChannelId() const { return channelId; }
54 void setChannelId(const QString &value) { channelId = value; }
56 const QString &getWebpage();
57 void setWebpage(const QString &value);
59 int getDuration() const { return duration; }
60 void setDuration(int value);
61 const QString &getFormattedDuration() const { return formattedDuration; }
63 int getViewCount() const { return viewCount; }
64 void setViewCount(int value);
65 const QString &getFormattedViewCount() const { return formattedViewCount; }
67 const QDateTime &getPublished() const { return published; }
68 void setPublished(const QDateTime &value);
69 const QString &getFormattedPublished() const { return formattedPublished; }
71 int getDefinitionCode() const { return definitionCode; }
74 const QString &getStreamUrl() { return streamUrl; }
75 bool isLoadingStreamUrl() const;
76 void abortLoadStreamUrl();
78 const QString &getId() const { return id; }
79 void setId(const QString &value) { id = value; }
81 License getLicense() const { return license; }
82 void setLicense(License value) { license = value; }
84 const auto &getThumbs() const { return thumbs; }
85 void addThumb(int width, int height, QString url);
86 VariantPromise &loadThumb(QSize size, qreal pixelRatio);
89 void gotStreamUrl(const QString &videoUrl, const QString &audioUrl);
90 void errorStreamUrl(const QString &message);
94 void streamUrlLoaded(const QString &streamUrl, const QString &audioUrl);
97 void loadStreamUrlJS();
98 void loadStreamUrlYT();
102 QString channelTitle;
107 QString formattedDuration;
110 QString formattedPublished;
112 QString formattedViewCount;
118 YTJSVideo *ytjsVideo;
120 QVector<YTThumb> thumbs;
121 bool thumbsNeedSorting = false;
124 // This is required in order to use QPointer<Video> as a QVariant
125 // as used by the Model/View playlist
126 typedef QPointer<Video> VideoPointer;
127 Q_DECLARE_METATYPE(VideoPointer)