# HG changeset patch # User Chris Cannam # Date 1587141934 -3600 # Node ID 3ec563af0a4fe1c215e3697ad08b2c6f3649e12a # Parent 19fa7bf208d8016ad364447eb4193294583fe92f Retrieve download URL, download type, and "pack" information diff -r 19fa7bf208d8 -r 3ec563af0a4f rdf/PluginRDFDescription.cpp --- 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::getPluginDownloadTypes() const +{ + return m_pluginDownloadTypes; +} + +std::map +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; } diff -r 19fa7bf208d8 -r 3ec563af0a4f rdf/PluginRDFDescription.h --- 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 #include #include +#include #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 getPluginDownloadTypes() const; + + struct Pack + { + QString name; + QString downloadURL; + }; + std::map 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 m_pluginDownloadTypes; + std::map m_pluginFoundInPacks; OutputStringMap m_outputNames; OutputDispositionMap m_outputDispositions; OutputStringMap m_outputEventTypeURIMap;