aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2017-05-21 10:58:28 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2017-05-21 10:59:32 +0200
commit663c7e0ed9e1db06096c84a1ffb286b3c9dad6a1 (patch)
treec8fc135d24aca43ca82a88bcfaa9b1bb2eff6b20
parent0f2954ac0278ce6e5ea95b9d42bdb98736415eb6 (diff)
downloadsynthpod-663c7e0ed9e1db06096c84a1ffb286b3c9dad6a1.tar.xz
state: extract rdfs:label from bundle path.
* do NOT use bundle path as rdfs:label anymore.
-rw-r--r--VERSION2
-rw-r--r--app/synthpod_app_state.c22
2 files changed, 22 insertions, 2 deletions
diff --git a/VERSION b/VERSION
index 888a67fc..0098082b 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.4977
+0.1.4981
diff --git a/app/synthpod_app_state.c b/app/synthpod_app_state.c
index 12a2e642..c13831d6 100644
--- a/app/synthpod_app_state.c
+++ b/app/synthpod_app_state.c
@@ -685,6 +685,22 @@ _sp_app_state_bundle_save(sp_app_t *app, const char *bundle_path)
ser.buf = malloc(ser.size);
lv2_atom_forge_set_sink(forge, _sink, _deref, &ser);
+ // try to extract label from bundle path
+ char *rdfs_label = NULL;
+ const char *from = strstr(app->bundle_path, "Synthpod_Stereo");
+ const char *to = strstr(app->bundle_path, ".preset.lv2");
+ if(from && to)
+ {
+ from += 15 + 1;
+ const size_t sz = to - from;
+ rdfs_label = malloc(sz + 1);
+ if(rdfs_label)
+ {
+ strncpy(rdfs_label, from, sz);
+ rdfs_label[sz] = '\0';
+ }
+ }
+
if( ser.buf
&& lv2_atom_forge_object(forge, &pset_frame, app->regs.synthpod.null.urid, app->regs.pset.preset.urid)
&& lv2_atom_forge_key(forge, app->regs.core.applies_to.urid)
@@ -693,7 +709,8 @@ _sp_app_state_bundle_save(sp_app_t *app, const char *bundle_path)
&& lv2_atom_forge_urid(forge, app->regs.synthpod.monoatom.urid)
&& lv2_atom_forge_key(forge, app->regs.rdfs.label.urid)
- && lv2_atom_forge_string(forge, app->bundle_path, strlen(app->bundle_path))
+ && lv2_atom_forge_string(forge, rdfs_label ? rdfs_label : app->bundle_path,
+ rdfs_label ? strlen(rdfs_label) : strlen(app->bundle_path) )
&& lv2_atom_forge_key(forge, app->regs.state.state.urid)
&& lv2_atom_forge_object(forge, &state_frame, 0, 0) )
@@ -710,6 +727,9 @@ _sp_app_state_bundle_save(sp_app_t *app, const char *bundle_path)
_serialize_to_turtle(app->sratom, app->driver->unmap, atom, state_dst);
free(ser.buf);
}
+
+ if(rdfs_label)
+ free(rdfs_label);
}
free(manifest_dst);