summaryrefslogtreecommitdiffstats
path: root/src/plugin.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-04-17 21:16:18 +0000
committerDavid Robillard <d@drobilla.net>2012-04-17 21:16:18 +0000
commit29e4fbbb630d8c3722e19211df6e2b58274a33ef (patch)
tree9a37df89ec543293f82c06b63d06f1badd0dfc74 /src/plugin.c
parentaaf39ebc6fef12487b981414487f93731bc02e2f (diff)
downloadlilv-29e4fbbb630d8c3722e19211df6e2b58274a33ef.tar.gz
lilv-29e4fbbb630d8c3722e19211df6e2b58274a33ef.tar.bz2
lilv-29e4fbbb630d8c3722e19211df6e2b58274a33ef.zip
Add lilv_plugin_get_project() and get author information from project if it is not given directly on the plugin.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@4189 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/plugin.c')
-rw-r--r--src/plugin.c40
1 files changed, 40 insertions, 0 deletions
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;
}