Compare commits

...
Author SHA1 Message Date
Jonah Brüchert 95ea5da248 WIP: Display thumnnail in player 2021-03-11 16:46:33 +01:00
6 changed files with 21 additions and 2 deletions

No files matched your search

+6
View File
@@ -21,6 +21,12 @@ ColumnLayout {
anchors.right: parent.right
height: maximized ? applicationWindow().height : player.preferredHeight
Image {
Layout.fillWidth: true
Layout.fillHeight: true
source: info.thumbnail
}
Controls.ScrollView {
Layout.fillHeight: footerLayout.maximized
Layout.fillWidth: true
+1 -1
View File
@@ -8,7 +8,7 @@
int main() {
const auto ytm = YTMusic();
const auto results = ytm.search("leoniden");
const auto results = ytm.search("Syd Matters");
std::cout << "Found " << results.size() << " results." << std::endl;
+7
View File
@@ -26,6 +26,7 @@ VideoInfoExtractor::VideoInfoExtractor(QObject *parent)
Q_EMIT audioUrlChanged();
Q_EMIT titleChanged();
Q_EMIT songChanged();
Q_EMIT thumbnailChanged();
});
}
@@ -76,6 +77,12 @@ QString VideoInfoExtractor::title() const
return QString::fromStdString(m_videoInfo.title);
}
QString VideoInfoExtractor::thumbnail() const
{
qDebug() << "thumb" << QString::fromStdString(m_videoInfo.thumnnail);
return QString::fromStdString(m_videoInfo.thumnnail);
}
bool VideoInfoExtractor::loading() const
{
return m_loading;
+4
View File
@@ -17,6 +17,7 @@ class VideoInfoExtractor : public QObject
Q_PROPERTY(QUrl audioUrl READ audioUrl NOTIFY audioUrlChanged)
Q_PROPERTY(QString title READ title NOTIFY titleChanged)
Q_PROPERTY(QString thumbnail READ thumbnail NOTIFY thumbnailChanged)
Q_PROPERTY(bool loading READ loading WRITE setLoading NOTIFY loadingChanged)
public:
@@ -32,6 +33,9 @@ public:
QString title() const;
Q_SIGNAL void titleChanged();
QString thumbnail() const;
Q_SIGNAL void thumbnailChanged();
bool loading() const;
void setLoading(bool loading);
Q_SIGNAL void loadingChanged();
+2 -1
View File
@@ -420,7 +420,8 @@ video_info::VideoInfo YTMusic::extract_video_info(const std::string &video_id) c
return {
info["id"].cast<std::string>(),
info["title"].cast<std::string>(),
extract_py_list<video_info::Format>(info["formats"])
extract_py_list<video_info::Format>(info["formats"]),
info["thumbnail"].cast<std::string>()
};
}
+1
View File
@@ -240,6 +240,7 @@ struct VideoInfo {
std::string id;
std::string title;
std::vector<Format> formats;
std::string thumnnail;
// More, but not interesting for us right now
};