13
0

Plugin Tags: Add a Lua-accessible function to write untagged plugins to a file so we can bulk-tag them.

print(ARDOUR.LuaAPI.dump_untagged_plugins())
 ...will write untagged plugins to a file, and report the resulting file path to the user
This commit is contained in:
Ben Loftis 2021-05-14 15:08:44 -05:00
parent 0fe68cabca
commit 13c819e02b
5 changed files with 49 additions and 0 deletions

View File

@ -79,6 +79,9 @@ namespace ARDOUR { namespace LuaAPI {
/** List all installed plugins */
std::list<boost::shared_ptr<ARDOUR::PluginInfo> > list_plugins ();
/** Write a list of untagged plugins to a file, so we can bulk-tag them */
std::string dump_untagged_plugins ();
/** search a Plugin
*
* @param id Plugin Name, ID or URI

View File

@ -109,6 +109,8 @@ public:
void save_tags ();
std::string dump_untagged_plugins ();
bool load_plugin_order_file (XMLNode &n) const; //returns TRUE if the passed-in node has valid info
void save_plugin_order_file (XMLNode &elem) const;

View File

@ -138,6 +138,13 @@ ARDOUR::LuaAPI::new_send (Session* s, boost::shared_ptr<Route> r, boost::shared_
return boost::shared_ptr<Processor> ();
}
std::string
ARDOUR::LuaAPI::dump_untagged_plugins ()
{
PluginManager& manager = PluginManager::instance ();
return manager.dump_untagged_plugins();
}
PluginInfoList
ARDOUR::LuaAPI::list_plugins ()
{

View File

@ -2619,6 +2619,7 @@ LuaBindings::common (lua_State* L)
.addFunction ("new_luaproc", ARDOUR::LuaAPI::new_luaproc)
.addFunction ("new_send", ARDOUR::LuaAPI::new_send)
.addFunction ("list_plugins", ARDOUR::LuaAPI::list_plugins)
.addFunction ("dump_untagged_plugins", ARDOUR::LuaAPI::dump_untagged_plugins)
.addFunction ("new_plugin_info", ARDOUR::LuaAPI::new_plugin_info)
.addFunction ("new_plugin", ARDOUR::LuaAPI::new_plugin)
.addFunction ("set_processor_param", ARDOUR::LuaAPI::set_processor_param)

View File

@ -2185,6 +2185,42 @@ PluginManager::save_plugin_order_file (XMLNode &elem) const
}
std::string
PluginManager::dump_untagged_plugins ()
{
std::string retval;
std::string path = Glib::build_filename (user_plugin_metadata_dir(), "untagged_plugins");
XMLNode* root = new XMLNode (X_("PluginTags"));
for (PluginTagList::iterator i = ptags.begin(); i != ptags.end(); ++i) {
#ifdef MIXBUS
if ((*i).type == LADSPA) {
uint32_t id = atoi ((*i).unique_id);
if (id >= 9300 && id <= 9399) {
continue; /* do not write mixbus channelstrip ladspa's in the tagfile */
}
}
#endif
if ((*i).tagtype == FromPlug) {
XMLNode* node = new XMLNode (X_("Plugin"));
node->set_property (X_("type"), to_generic_vst ((*i).type));
node->set_property (X_("id"), (*i).unique_id);
node->set_property (X_("tags"), (*i).tags);
node->set_property (X_("name"), (*i).name);
root->add_child_nocopy (*node);
}
}
XMLTree tree;
tree.set_root (root);
if (tree.write (path)) {
retval = path;
} else {
retval = string_compose (_("ERROR: Could not save Plugin Tags info to %1"), path);
}
return retval;
}
void
PluginManager::save_tags ()
{