summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--lilv/lilv.h10
-rw-r--r--src/plugin.c40
3 files changed, 52 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 6f115b4..2660cd6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,8 @@ lilv (UNRELEASED) unstable; urgency=low
* Remove use of wordexp.
* Add lilv_plugin_get_port_by_designation() and lilv_port_get_index() as an
improved generic alternative to lilv_plugin_get_latency_port_index().
+ * Add lilv_plugin_get_project() and get author information from project if
+ it is not given directly on the plugin.
-- David Robillard <d@drobilla.net> (UNRELEASED)
diff --git a/lilv/lilv.h b/lilv/lilv.h
index 80bf23c..893d1ad 100644
--- a/lilv/lilv.h
+++ b/lilv/lilv.h
@@ -914,6 +914,16 @@ lilv_plugin_get_port_by_designation(const LilvPlugin* plugin,
const LilvNode* designation);
/**
+ Get the project the plugin is a part of.
+
+ More information about the project can be read via lilv_world_find_nodes(),
+ typically using properties from DOAP (e.g. doap:name).
+*/
+LILV_API
+LilvNode*
+lilv_plugin_get_project(const LilvPlugin* plugin);
+
+/**
Get the full name of the plugin's author.
Returns NULL if author name is not present.
Returned value must be freed by caller.
diff --git a/src/plugin.c b/src/plugin.c
index b4a2f0b..8e91f80 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -762,6 +762,33 @@ lilv_plugin_get_port_by_symbol(const LilvPlugin* p,
return NULL;
}
+LILV_API
+LilvNode*
+lilv_plugin_get_project(const LilvPlugin* p)
+{
+ lilv_plugin_load_if_necessary(p);
+
+ SordNode* lv2_project = sord_new_uri(p->world->world,
+ (const uint8_t*)LV2_CORE__project);
+
+ SordIter* projects = lilv_world_query_internal(
+ p->world,
+ p->plugin_uri->val.uri_val,
+ lv2_project,
+ NULL);
+
+ sord_node_free(p->world->world, lv2_project);
+
+ if (sord_iter_end(projects)) {
+ return NULL;
+ }
+
+ const SordNode* project = sord_iter_get_node(projects, SORD_OBJECT);
+
+ sord_iter_free(projects);
+ return lilv_node_new_from_node(p->world, project);
+}
+
static const SordNode*
lilv_plugin_get_author(const LilvPlugin* p)
{
@@ -779,6 +806,19 @@ lilv_plugin_get_author(const LilvPlugin* p)
sord_node_free(p->world->world, doap_maintainer);
if (sord_iter_end(maintainers)) {
+ LilvNode* project = lilv_plugin_get_project(p);
+ if (!project) {
+ return NULL;
+ }
+
+ maintainers = lilv_world_query_internal(
+ p->world,
+ project->val.uri_val,
+ doap_maintainer,
+ NULL);
+ }
+
+ if (sord_iter_end(maintainers)) {
return NULL;
}