#include <libxml/uri.h>
#include <lrdf.h>
+#include <glibmm/miscutils.h>
#include <glibmm/convert.h>
const char* const sfdb_file_name = "sfdb";
} // anonymous namespace
-static char* TAG = "http://ardour.org/ontology/Tag";
+static const char* TAG = "http://ardour.org/ontology/Tag";
AudioLibrary::AudioLibrary ()
{
// workaround for possible bug in raptor that crashes when saving to a
// non-existant file.
+
touch_file(sfdb_file_path.to_string());
lrdf_read_file(src.c_str());
}
}
-string
-AudioLibrary::uri2path (string uri)
-{
- string path = xmlURIUnescapeString(uri.c_str(), 0, 0);
- return path.substr(5);
-}
-
void
AudioLibrary::set_tags (string member, vector<string> tags)
{
lrdf_statement pattern;
pattern.subject = strdup(Glib::filename_to_uri(member).c_str());
- pattern.predicate = TAG;
+ pattern.predicate = (char*)TAG;
pattern.object = 0;
pattern.object_type = lrdf_literal;
vector<string>::const_iterator i;
for (i = tags.begin(); i != tags.end(); ++i){
pattern = new lrdf_statement;
- pattern->subject = "?";
- pattern->predicate = TAG;
+ pattern->subject = (char*)"?";
+ pattern->predicate = (char*)TAG;
pattern->object = strdup((*i).c_str());
pattern->next = old;
if (*head != 0) {
lrdf_uris* ulist = lrdf_match_multi(*head);
for (uint32_t j = 0; ulist && j < ulist->count; ++j) {
-// cerr << "AND: " << uri2path(ulist->items[j]) << endl;
- members.push_back(uri2path(ulist->items[j]));
+ members.push_back(Glib::filename_from_uri(ulist->items[j]));
}
lrdf_free_uris(ulist);