Mercurial > hg > svcore
changeset 1843:3ec563af0a4f
Retrieve download URL, download type, and "pack" information
author | Chris Cannam |
---|---|
date | Fri, 17 Apr 2020 17:45:34 +0100 |
parents | 19fa7bf208d8 |
children | 5b1b03c1d8d4 |
files | rdf/PluginRDFDescription.cpp rdf/PluginRDFDescription.h |
diffstat | 2 files changed, 103 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/rdf/PluginRDFDescription.cpp Fri Apr 17 17:45:15 2020 +0100 +++ b/rdf/PluginRDFDescription.cpp Fri Apr 17 17:45:34 2020 +0100 @@ -84,6 +84,24 @@ return m_pluginInfoURL; } +QString +PluginRDFDescription::getPluginDownloadURL() const +{ + return m_pluginDownloadURL; +} + +std::set<PluginRDFDescription::DownloadType> +PluginRDFDescription::getPluginDownloadTypes() const +{ + return m_pluginDownloadTypes; +} + +std::map<QString, PluginRDFDescription::Pack> +PluginRDFDescription::getPluginFoundInPacks() const +{ + return m_pluginFoundInPacks; +} + QStringList PluginRDFDescription::getOutputIds() const { @@ -217,16 +235,74 @@ m_pluginInfoURL = n.value; } - n = index->complete + Node libn = index->complete (Triple(Node(), index->expand("vamp:available_plugin"), plugin)); - if (n.value != "") { - n = index->complete(Triple(n, index->expand("foaf:page"), Node())); + if (libn.value != "") { + + n = index->complete + (Triple(libn, index->expand("foaf:page"), Node())); + if (n.type == Node::URI && n.value != "" && m_pluginInfoURL == "") { + m_pluginInfoURL = n.value; + } + + // And the download page for the library + n = index->complete + (Triple(libn, index->expand("doap:download-page"), Node())); + if (n.type == Node::URI && n.value != "") { - m_pluginInfoURL = n.value; + + m_pluginDownloadURL = n.value; + + n = index->complete + (Triple(libn, index->expand("vamp:has_source"), Node())); + if (n.type == Node::Literal && n.value == "true") { + m_pluginDownloadTypes.insert(DownloadSourceCode); + } + + Nodes binaries = index->match + (Triple(libn, index->expand("vamp:has_binary"), Node())) + .objects(); + + for (Node bin: binaries) { + if (bin.type != Node::Literal) continue; + if (bin.value == "linux32") { + m_pluginDownloadTypes.insert(DownloadLinux32); + } else if (bin.value == "linux64") { + m_pluginDownloadTypes.insert(DownloadLinux64); + } else if (bin.value == "win32") { + m_pluginDownloadTypes.insert(DownloadWindows); + } else if (bin.value == "osx") { + m_pluginDownloadTypes.insert(DownloadMac); + } + } } } + Nodes packs = index->match + (Triple(Node(), index->expand("vamp:available_library"), libn)) + .objects(); + + for (Node packn: packs) { + if (packn.type != Node::URI) continue; + + Pack pack; + n = index->complete + (Triple(packn, index->expand("dc:title"), Node())); + if (n.type == Node::Literal) { + pack.name = n.value; + } + n = index->complete + (Triple(packn, index->expand("foaf:page"), Node())); + if (n.type == Node::URI) { + pack.downloadURL = n.value; + } + + if (pack.name != "" && pack.downloadURL != "") { + m_pluginFoundInPacks[packn.value] = pack; + } + } + return true; }
--- a/rdf/PluginRDFDescription.h Fri Apr 17 17:45:15 2020 +0100 +++ b/rdf/PluginRDFDescription.h Fri Apr 17 17:45:34 2020 +0100 @@ -19,6 +19,7 @@ #include <QString> #include <QStringList> #include <map> +#include <set> #include "base/Debug.h" @@ -43,7 +44,26 @@ QString getPluginDescription() const; QString getPluginMaker() const; QString getPluginInfoURL() const; + QString getPluginDownloadURL() const; + enum DownloadType + { + DownloadSourceCode, + DownloadWindows, + DownloadMac, + DownloadLinux32, + DownloadLinux64, + DownloadOther + }; + std::set<DownloadType> getPluginDownloadTypes() const; + + struct Pack + { + QString name; + QString downloadURL; + }; + std::map<QString, Pack> getPluginFoundInPacks() const; // uri -> pack + QStringList getOutputIds() const; QString getOutputName(QString outputId) const; OutputDisposition getOutputDisposition(QString outputId) const; @@ -64,6 +84,9 @@ QString m_pluginDescription; QString m_pluginMaker; QString m_pluginInfoURL; + QString m_pluginDownloadURL; + std::set<DownloadType> m_pluginDownloadTypes; + std::map<QString, Pack> m_pluginFoundInPacks; OutputStringMap m_outputNames; OutputDispositionMap m_outputDispositions; OutputStringMap m_outputEventTypeURIMap;