### Quick Example: Discover, Search, and Organize Plugins with Logic Plugin Manager Source: https://logic-plugin-manager.readthedocs.io/en/latest/index This example demonstrates the basic usage of the Logic Plugin Manager library. It initializes the manager, discovers all plugins, performs a fuzzy search for 'reverb' plugins, and shows how to add a plugin to a custom 'Favorites' category. Requires the 'logic-plugin-manager' library to be installed. ```python from logic_plugin_manager import Logic # Initialize and discover all plugins logic = Logic() # Search for plugins results = logic.plugins.search("reverb", use_fuzzy=True) for result in results[:5]: print(f"{result.plugin.full_name} (score: {result.score})") # Organize into categories favorites = logic.introduce_category("Favorites") plugin = logic.plugins.get_by_full_name("fabfilter: pro-q 3") plugin.add_to_category(favorites) ``` -------------------------------- ### Install Logic Plugin Manager Source: https://logic-plugin-manager.readthedocs.io/en/latest/_sources/index.rst These bash commands show how to install the Logic Plugin Manager library using pip. The second command installs an optional dependency for enhanced search functionality. ```bash pip install logic-plugin-manager ``` ```bash pip install logic-plugin-manager[search] ``` -------------------------------- ### Install Logic Plugin Manager Source: https://logic-plugin-manager.readthedocs.io/en/latest/_sources/getting_started.rst Installs the logic-plugin-manager package using pip or uv. For fuzzy search capabilities, install with the 'search' extra, which includes the 'rapidfuzz' dependency. ```bash pip install logic-plugin-manager # or uv add logic-plugin-manager ``` ```bash pip install logic-plugin-manager[search] # or uv add logic-plugin-manager[search] ``` -------------------------------- ### Set Plugin Short Names Source: https://logic-plugin-manager.readthedocs.io/en/latest/examples This example demonstrates setting short names for plugins, which are often used in UI elements for brevity. It uses a dictionary to map full plugin names to their short names and applies them using the 'set_shortname' method. Dependencies include the 'logic_plugin_manager' library. ```python from logic_plugin_manager import Logic logic = Logic() # Set short names for UI display shortnames = { "fabfilter: pro-q 3": "PQ3", "fabfilter: pro-c 2": "PC2", "serum": "SRM", } for full_name, shortname in shortnames.items(): plugin = logic.plugins.get_by_full_name(full_name) if plugin: plugin.set_shortname(shortname) ``` -------------------------------- ### Install Logic Plugin Manager with Search Functionality (Uv) Source: https://logic-plugin-manager.readthedocs.io/en/latest/getting_started Installs the logic-plugin-manager package with the 'search' extra using uv, enabling fuzzy search capabilities. This also installs the 'rapidfuzz' dependency. ```bash uv add logic-plugin-manager[search] ``` -------------------------------- ### Install Logic Plugin Manager with Pip Source: https://logic-plugin-manager.readthedocs.io/en/latest/getting_started Installs the core logic-plugin-manager package using pip. This is the basic installation command. ```bash pip install logic-plugin-manager ``` -------------------------------- ### Search Plugins by Multiple Criteria (Python) Source: https://logic-plugin-manager.readthedocs.io/en/latest/_sources/examples.rst Shows how to combine search terms with filters for plugin type and category. This allows for more precise plugin discovery. Requires the 'logic_plugin_manager' library. ```python from logic_plugin_manager import Logic logic = Logic() def find_plugins(search_term, plugin_type=None, category=None): """Search plugins with optional filters.""" results = logic.plugins.search(search_term, use_fuzzy=True) plugins = [r.plugin for r in results] # Filter by type if specified if plugin_type: plugins = [p for p in plugins if p.type_code == plugin_type] # Filter by category if specified if category: plugins = [ p for p in plugins if any(c.name == category for c in p.categories) ] return plugins # Find reverb effects (not instruments) reverbs = find_plugins("reverb", plugin_type="aufx") # Find synthesizers in Instruments category synths = find_plugins("synth", plugin_type="aumu", category="Instruments") ``` -------------------------------- ### Install Logic Plugin Manager with Uv Source: https://logic-plugin-manager.readthedocs.io/en/latest/getting_started Installs the core logic-plugin-manager package using the uv package installer. This offers an alternative to pip for package management. ```bash uv add logic-plugin-manager ``` -------------------------------- ### Install Logic Plugin Manager with Search Functionality (Pip) Source: https://logic-plugin-manager.readthedocs.io/en/latest/getting_started Installs the logic-plugin-manager package with the 'search' extra, enabling fuzzy search capabilities. This also installs the 'rapidfuzz' dependency. ```bash pip install logic-plugin-manager[search] ``` -------------------------------- ### Add Plugins to Category in Logic Plugin Manager Source: https://logic-plugin-manager.readthedocs.io/en/latest/_sources/examples.rst Shows how to add a single plugin to a specific category. It includes steps to get or create a category, retrieve a plugin by its full name, and then add the plugin to the category. ```python from logic_plugin_manager import Logic logic = Logic() # Create or get category favorites = logic.categories.get("Favorites") if not favorites: favorites = logic.introduce_category("Favorites") # Add single plugin plugin = logic.plugins.get_by_full_name("fabfilter: pro-q 3") if plugin: plugin.add_to_category(favorites) print(f"Added {plugin.full_name} to {favorites.name}") # Update category count logic.sync_category_plugin_amount(favorites) ``` -------------------------------- ### Category Sorting and Reordering Source: https://logic-plugin-manager.readthedocs.io/en/latest/examples This example shows how to manipulate the order of categories. It demonstrates retrieving a category, checking its current position and neighbors, and then moving it to the top, up by a specific number of steps, down, or relative to another category. Dependencies include the 'logic_plugin_manager' library. ```python from logic_plugin_manager import Logic logic = Logic() # Get category category = logic.categories["Effects:EQ"] # Check current position print(f"Current index: {category.index}") prev, next_cat = category.neighbors if prev: print(f"Previous: {prev.name}") if next_cat: print(f"Next: {next_cat.name}") # Move category category.move_to_top() category.move_up(steps=5) category.move_down() # Move relative to another category target = logic.categories["Effects:Delay"] category.move_before(target) ``` -------------------------------- ### Export Plugin Inventory to CSV Source: https://logic-plugin-manager.readthedocs.io/en/latest/examples This code exports a comprehensive list of all installed plugins to a CSV file named 'plugin_inventory.csv'. It includes details such as full name, manufacturer, type, version, categories, subtype code, and tags ID. The output is sorted alphabetically by plugin full name. Dependencies include the 'csv' module and 'logic_plugin_manager'. ```python import csv from logic_plugin_manager import Logic logic = Logic() # Export to CSV with open("plugin_inventory.csv", "w", newline="") as f: writer = csv.writer(f) writer.writerow([ "Full Name", "Manufacturer", "Type", "Version", "Categories", "Subtype Code", "Tags ID" ]) for plugin in sorted(logic.plugins.all(), key=lambda p: p.full_name): writer.writerow([ plugin.full_name, plugin.manufacturer, plugin.type_name.display_name, plugin.version, "; ".join(c.name for c in plugin.categories), plugin.subtype_code, plugin.tags_id, ]) print("Exported plugin inventory to plugin_inventory.csv") ``` -------------------------------- ### Initialize Logic Instance and Handle Plugin Load Errors (Python) Source: https://logic-plugin-manager.readthedocs.io/en/latest/core_concepts Demonstrates how to create a Logic instance and gracefully handle potential PluginLoadError exceptions during initialization. It also shows an example of batch operations for adding favorite plugins to a new category. ```python from logic_plugin_manager import ( Logic, CategoryValidationError, PluginLoadError ) try: logic = Logic() except PluginLoadError as e: print(f"Failed to load plugins: {e}") # Handle gracefully # Batch operation example favorites = { logic.plugins.get_by_name(name) for name in ["Pro-Q 3", "Serum", "Valhalla VintageVerb"] if logic.plugins.get_by_name(name) } if favorites: fav_category = logic.introduce_category("Favorites") logic.add_plugins_to_category(fav_category, favorites) logic.sync_category_plugin_amount(fav_category) ``` -------------------------------- ### Working with Audio Unit Types Source: https://logic-plugin-manager.readthedocs.io/en/latest/core_concepts Shows how to use the AudioUnitType class to interact with different types of Audio Units. It includes examples of retrieving a type by its code and searching for types by a keyword. ```python from logic_plugin_manager import AudioUnitType # Get type by code instrument_type = AudioUnitType.from_code("aumu") print(instrument_type.display_name) # "Instrument" # Search for types effect_types = AudioUnitType.search("effect") ``` -------------------------------- ### Accessing Logic Instance Attributes and Paths Source: https://logic-plugin-manager.readthedocs.io/en/latest/core_concepts Provides examples of accessing various attributes of a Logic instance after initialization, such as plugins, components, categories, and music apps database. It also shows how to access configuration paths for components and tags. ```python from logic_plugin_manager import Logic logic = Logic() # Access discovered data logic.plugins # Plugins collection logic.components # Set of Component bundles logic.categories # Dict of category_name -> Category logic.musicapps # MusicApps database interface # Configuration paths logic.components_path # Path to Components directory logic.tags_path # Path to tags database ``` -------------------------------- ### Inspect Component Bundles with Logic Plugin Manager Source: https://logic-plugin-manager.readthedocs.io/en/latest/_sources/examples.rst This snippet demonstrates how to initialize the Logic plugin manager and iterate through component bundles to display their names, IDs, versions, and associated audio components. It requires the 'logic_plugin_manager' library. ```python from logic_plugin_manager import Logic logic = Logic() print(f"Total component bundles: {len(logic.components)}\n") for component in logic.components: print(f"Bundle: {component.name}") print(f" ID: {component.bundle_id}") print(f" Version: {component.version} ({component.short_version})") print(f" Audio Components: {len(component.audio_components)}") for audio_comp in component.audio_components: print(f" - {audio_comp.full_name}") print() ``` -------------------------------- ### List All Plugins with Details Source: https://logic-plugin-manager.readthedocs.io/en/latest/examples This Python snippet demonstrates how to list all available plugins using the Logic Plugin Manager. It iterates through all plugins and prints their full name, type, version, and categories. Requires the 'logic_plugin_manager' library. ```python from logic_plugin_manager import Logic logic = Logic() print(f"Total plugins: {len(logic.plugins.all())}") for plugin in logic.plugins.all(): print(f"{plugin.full_name}") print(f" Type: {plugin.type_name.display_name}") print(f" Version: {plugin.version}") print(f" Categories: {', '.join(c.name for c in plugin.categories))}") print() ``` -------------------------------- ### Finding a Specific Plugin by Name, Manufacturer, or Type Source: https://logic-plugin-manager.readthedocs.io/en/latest/getting_started Provides examples of how to find specific plugins using different criteria: by their full name (exact match), by manufacturer, or by their audio unit type code. ```python from logic_plugin_manager import Logic logic = Logic() # By full name (exact match) plugin = logic.plugins.get_by_full_name("apple: logic eq") # By manufacturer fabfilter_plugins = logic.plugins.get_by_manufacturer("fabfilter") # By audio unit type instruments = logic.plugins.get_by_type_code("aumu") ``` -------------------------------- ### Searching Plugins in Logic Plugin Manager Source: https://logic-plugin-manager.readthedocs.io/en/latest/getting_started Shows how to search for plugins using the Logic Plugin Manager. It includes examples of simple substring searches and advanced fuzzy searches with scoring, demonstrating how to retrieve and display search results. ```python from logic_plugin_manager import Logic logic = Logic() # Simple substring search results = logic.plugins.search_simple("reverb") # Advanced fuzzy search with scoring results = logic.plugins.search("serum", use_fuzzy=True) for result in results[:5]: # Top 5 results print(f"{result.plugin.full_name} (score: {result.score})") ``` -------------------------------- ### List All Categories Source: https://logic-plugin-manager.readthedocs.io/en/latest/examples This Python snippet shows how to list all available categories managed by the Logic Plugin Manager. It iterates through the categories and prints their names and the number of plugins associated with each. Requires the 'logic_plugin_manager' library. ```python from logic_plugin_manager import Logic logic = Logic() print("Categories:") for name, category in sorted(logic.categories.items()): print(f" {name} ({category.plugin_amount} plugins)") ``` -------------------------------- ### Advanced Fuzzy Search for Plugins (Python) Source: https://logic-plugin-manager.readthedocs.io/en/latest/_sources/examples.rst Demonstrates advanced fuzzy searching capabilities to find plugins with approximate string matching. Allows setting a threshold and limiting the number of results. Requires the 'logic_plugin_manager' library. ```python from logic_plugin_manager import Logic logic = Logic() # Fuzzy search with scoring results = logic.plugins.search( query="compressor", use_fuzzy=True, fuzzy_threshold=80, max_results=10 ) for i, result in enumerate(results, 1): print(f"{i}. {result.plugin.full_name}") print(f" Score: {result.score:.1f}") print(f" Matched field: {result.match_field}") print() ``` -------------------------------- ### Configuring Custom Paths in Logic Plugin Manager Source: https://logic-plugin-manager.readthedocs.io/en/latest/getting_started Explains how to configure custom paths for Logic Pro components and tags if they are not in the default locations. This is useful for users with non-standard installations. ```python from pathlib import Path from logic_plugin_manager import Logic logic = Logic( components_path=Path("/custom/path/to/Components"), tags_path=Path("~/custom/path/to/Tags").expanduser() ) ``` -------------------------------- ### Working with Categories in Logic Plugin Manager Source: https://logic-plugin-manager.readthedocs.io/en/latest/getting_started Demonstrates how to manage plugin categories using the Logic Plugin Manager. This includes retrieving plugins by category, getting existing categories, introducing new categories, and adding plugins to specific categories. ```python from logic_plugin_manager import Logic logic = Logic() # Get plugins in a specific category effects = logic.plugins.get_by_category("Effects") # Get or create a category my_category = logic.categories.get("My Favorites") if not my_category: my_category = logic.introduce_category("My Favorites") # Add plugin to category plugin = logic.plugins.get_by_full_name("fabfilter: pro-q 3") if plugin: plugin.add_to_category(my_category) ``` -------------------------------- ### Create Nested Categories in Logic Plugin Manager Source: https://logic-plugin-manager.readthedocs.io/en/latest/_sources/examples.rst Demonstrates how to create nested categories for organizing plugins. It iterates through a list of category names and creates them if they do not already exist. ```python categories_to_create = [ "My Plugins", "My Plugins:Favorites", "My Plugins:Favorites:Mixing", "My Plugins:Favorites:Mastering", ] for cat_name in categories_to_create: if cat_name not in logic.categories: category = logic.introduce_category(cat_name) print(f"Created: {cat_name}") else: print(f"Already exists: {cat_name}") ``` -------------------------------- ### Filter Plugins by Type Code (Python) Source: https://logic-plugin-manager.readthedocs.io/en/latest/_sources/examples.rst Demonstrates how to filter plugins based on their type code. This is useful for separating instruments from effects or other plugin types. Requires the 'logic_plugin_manager' library. ```python from logic_plugin_manager import Logic logic = Logic() # Get all instruments (type code 'aumu') instruments = logic.plugins.get_by_type_code("aumu") print(f"Found {len(instruments)} instruments") # Get all effects (type code 'aufx') effects = logic.plugins.get_by_type_code("aufx") print(f"Found {len(effects)} effects") ``` -------------------------------- ### Create Category Hierarchy (Python) Source: https://logic-plugin-manager.readthedocs.io/en/latest/_sources/examples.rst This is a placeholder for code that would demonstrate creating a category hierarchy within the Logic Plugin Manager. The actual implementation details are not provided in the source text. Requires the 'logic_plugin_manager' library. ```python from logic_plugin_manager import Logic logic = Logic() ``` -------------------------------- ### Perform Simple Text Search for Plugins Source: https://logic-plugin-manager.readthedocs.io/en/latest/examples This Python snippet demonstrates a basic substring search for plugins using the Logic Plugin Manager. It finds plugins whose names contain a specified keyword, like 'reverb'. Requires the 'logic_plugin_manager' library. ```python from logic_plugin_manager import Logic logic = Logic() # Simple substring search reverb_plugins = logic.plugins.search_simple("reverb") print(f"Found {len(reverb_plugins)} plugins with 'reverb' in name") for plugin in reverb_plugins: print(f" - {plugin.full_name}") ``` -------------------------------- ### Find Plugins by Manufacturer Source: https://logic-plugin-manager.readthedocs.io/en/latest/examples This Python snippet demonstrates how to find plugins associated with a specific manufacturer. It first lists all unique manufacturers and then retrieves plugins for a given manufacturer, like 'fabfilter'. Requires the 'logic_plugin_manager' library. ```python from logic_plugin_manager import Logic logic = Logic() # List all manufacturers manufacturers = set() for plugin in logic.plugins.all(): manufacturers.add(plugin.manufacturer) for mfr in sorted(manufacturers): plugins = logic.plugins.get_by_manufacturer(mfr) print(f"{mfr}: {len(plugins)} plugins") # Get specific manufacturer's plugins fabfilter = logic.plugins.get_by_manufacturer("fabfilter") for plugin in fabfilter: print(f" - {plugin.name}") ``` -------------------------------- ### Inspect Individual Plugin Details (Python) Source: https://logic-plugin-manager.readthedocs.io/en/latest/_sources/examples.rst This code snippet demonstrates how to retrieve and display detailed information about a specific plugin using its full name. It accesses various attributes like manufacturer, version, type, and tags. Requires the 'logic_plugin_manager' library. ```python from logic_plugin_manager import Logic logic = Logic() plugin = logic.plugins.get_by_full_name("fabfilter: pro-q 3") if plugin: print(f"Full Name: {plugin.full_name}") print(f"Manufacturer: {plugin.manufacturer}") print(f"Name: {plugin.name}") print(f"Description: {plugin.description}") print(f"Type: {plugin.type_name.display_name} ({plugin.type_code})") print(f"Subtype: {plugin.subtype_code}") print(f"Manufacturer Code: {plugin.manufacturer_code}") print(f"Version: {plugin.version}") print(f"Factory Function: {plugin.factory_function}") print(f"Tags ID: {plugin.tags_id}") print(f"Tagset Path: {plugin.tagset.path}") if plugin.tagset.nickname: print(f"Nickname: {plugin.tagset.nickname}") if plugin.tagset.shortname: print(f"Short Name: {plugin.tagset.shortname}") print(f"Categories: {', '.join(c.name for c in plugin.categories)}") ``` -------------------------------- ### Bulk Assign Plugins to Category Source: https://logic-plugin-manager.readthedocs.io/en/latest/examples This section shows how to find all plugins from a specific manufacturer and assign them to a newly created or existing category. It utilizes the 'logic_plugin_manager' library for plugin and category management. The input is a manufacturer name, and the output is the number of plugins added to the category. ```python from logic_plugin_manager import Logic logic = Logic() # Find all FabFilter plugins fabfilter_plugins = logic.plugins.get_by_manufacturer("fabfilter") # Create category fabfilter_cat = logic.categories.get("FabFilter") if not fabfilter_cat: fabfilter_cat = logic.introduce_category("FabFilter") # Bulk add logic.add_plugins_to_category(fabfilter_cat, fabfilter_plugins) print(f"Added {len(fabfilter_plugins)} FabFilter plugins") ``` -------------------------------- ### Inspect Detailed Plugin Information Source: https://logic-plugin-manager.readthedocs.io/en/latest/examples This Python snippet retrieves and displays detailed information about a specific plugin, identified by its full name. It accesses various attributes like name, description, type, version, and category paths. Requires the 'logic_plugin_manager' library. ```python from logic_plugin_manager import Logic logic = Logic() plugin = logic.plugins.get_by_full_name("fabfilter: pro-q 3") if plugin: print(f"Full Name: {plugin.full_name}") print(f"Manufacturer: {plugin.manufacturer}") print(f"Name: {plugin.name}") print(f"Description: {plugin.description}") print(f"Type: {plugin.type_name.display_name} ({plugin.type_code})") print(f"Subtype: {plugin.subtype_code}") print(f"Manufacturer Code: {plugin.manufacturer_code}") print(f"Version: {plugin.version}") print(f"Factory Function: {plugin.factory_function}") print(f"Tags ID: {plugin.tags_id}") print(f"Tagset Path: {plugin.tagset.path}") if plugin.tagset.nickname: print(f"Nickname: {plugin.tagset.nickname}") if plugin.tagset.shortname: print(f"Short Name: {plugin.tagset.shortname}") print(f"Categories: {', '.join(c.name for c in plugin.categories))}") ``` -------------------------------- ### Basic Logic Plugin Manager Usage Source: https://logic-plugin-manager.readthedocs.io/en/latest/getting_started Demonstrates the basic usage of the Logic Plugin Manager library. It initializes the Logic instance, discovers all plugins, and iterates through them to print their full names and types. It also shows how to access and display information about plugin categories. ```python from logic_plugin_manager import Logic # Initialize and discover all plugins logic = Logic() # Access all plugins for plugin in logic.plugins.all(): print(f"{plugin.full_name} - {plugin.type_name.display_name}") # Access categories for category_name, category in logic.categories.items(): print(f"{category_name}: {category.plugin_amount} plugins") ``` -------------------------------- ### Find Duplicate Plugins by Name using Logic Source: https://logic-plugin-manager.readthedocs.io/en/latest/examples Identifies plugins with duplicate names (case-insensitive, ignoring manufacturer) within the Logic Plugin Manager. It groups plugins by their lowercase name and reports any names associated with more than one plugin version, including their full names and versions. This helps in managing plugin conflicts or identifying redundant installations. ```python from collections import defaultdict from logic_plugin_manager import Logic logic = Logic() # Group by name (ignoring manufacturer) by_name = defaultdict(list) for plugin in logic.plugins.all(): by_name[plugin.name.lower()].append(plugin) # Find duplicates duplicates = { name: plugins for name, plugins in by_name.items() if len(plugins) > 1 } print(f"Found {len(duplicates)} plugin names with multiple versions:\n") for name, plugins in sorted(duplicates.items()): print(f"{name}:") for plugin in plugins: print(f" - {plugin.full_name} (v{plugin.version})") print() ``` -------------------------------- ### Discover and Organize Logic Pro Plugins with Python Source: https://logic-plugin-manager.readthedocs.io/en/latest/_sources/index.rst This Python code snippet demonstrates how to initialize the Logic Plugin Manager, discover all installed Audio Unit plugins, search for specific plugins using fuzzy matching, and organize them into custom categories. It requires the 'logic-plugin-manager' library. ```python from logic_plugin_manager import Logic # Initialize and discover all plugins logic = Logic() # Search for plugins results = logic.plugins.search("reverb", use_fuzzy=True) for result in results[:5]: print(f"{result.plugin.full_name} (score: {result.score})") # Organize into categories favorites = logic.introduce_category("Favorites") plugin = logic.plugins.get_by_full_name("fabfilter: pro-q 3") plugin.add_to_category(favorites) ``` -------------------------------- ### Initializing Logic Class for Plugin Management Source: https://logic-plugin-manager.readthedocs.io/en/latest/core_concepts Illustrates different ways to initialize the Logic class, including full discovery and lazy initialization. Lazy initialization allows for manual control over when plugin and category discovery occurs. ```python from logic_plugin_manager import Logic # Full initialization logic = Logic() # Discovers everything # Lazy initialization (manual control) logic = Logic(lazy=True) logic.discover_plugins() # When ready to load plugins logic.discover_categories() # When ready to load categories ``` -------------------------------- ### Initialize AudioComponent Source: https://logic-plugin-manager.readthedocs.io/en/latest/logic_plugin_manager.components Initializes an AudioComponent instance with metadata from a dictionary. Supports lazy loading of tagsets and categories, and requires paths for tag databases and MusicApps instances. Raises an error if parsing fails. ```python from pathlib import Path from logic_plugin_manager.components.audiocomponent import AudioComponent from logic_plugin_manager.musicapps import MusicApps # Example usage: data = { "factory_function": "com.example.audiounit.myplugin", "description": "A sample audio unit plugin.", "manufacturer": "Example Inc.", "name": "MyPlugin", "version": 1000, "type_code": "aumu", "subtype_code": "exmp" } tags_path = Path('/path/to/tags') musicapps = MusicApps() try: component = AudioComponent(data, lazy=True, tags_path=tags_path, musicapps=musicapps) print(f"Initialized component: {component.full_name}") except Exception as e: print(f"Error initializing component: {e}") ``` -------------------------------- ### Inspect Component Bundles using Logic Source: https://logic-plugin-manager.readthedocs.io/en/latest/examples Lists all available component bundles managed by the Logic Plugin Manager, displaying their names, IDs, versions, and the number of audio components within each. It iterates through each bundle and its audio components, providing a detailed overview of the plugin bundle structure. ```python from logic_plugin_manager import Logic logic = Logic() print(f"Total component bundles: {len(logic.components)}\n") for component in logic.components: print(f"Bundle: {component.name}") print(f" ID: {component.bundle_id}") print(f" Version: {component.version} ({component.short_version})") print(f" Audio Components: {len(component.audio_components)}") for audio_comp in component.audio_components: print(f" - {audio_comp.full_name}") print() ``` -------------------------------- ### Batch Update Plugin Metadata Source: https://logic-plugin-manager.readthedocs.io/en/latest/examples This script performs batch metadata updates on all plugins. In this specific example, it adds the manufacturer's name in uppercase as a prefix to the nickname of any plugin that doesn't already have a nickname set. It iterates through all plugins and uses 'set_nickname' to apply the changes. Requires 'logic_plugin_manager'. ```python from logic_plugin_manager import Logic logic = Logic() # Add manufacturer prefix to all plugin nicknames for plugin in logic.plugins.all(): if not plugin.tagset.nickname: manufacturer = plugin.manufacturer.upper() nickname = f"[{manufacturer}] {plugin.name}" plugin.set_nickname(nickname) print(f"Set nickname for {plugin.full_name}") ``` -------------------------------- ### Get Audio Components by Category Source: https://logic-plugin-manager.readthedocs.io/en/latest/_modules/logic_plugin_manager/logic/plugins Retrieves a set of audio components belonging to the specified category. The search is case-insensitive. ```APIDOC ## GET /audio-components/category/{category} ### Description Retrieves a set of audio components that fall under a given category. The category name is matched in a case-insensitive manner. ### Method GET ### Endpoint `/audio-components/category/{category}` ### Parameters #### Path Parameters - **category** (string) - Required - The category name to filter audio components by. ### Response #### Success Response (200) - **AudioComponent** (set) - A set of AudioComponent objects belonging to the specified category. Returns an empty set if no matches are found. #### Response Example ```json [ { "id": "component1", "name": "Example Component", "manufacturer": "Example Corp", "version": "1.0.0", "description": "A sample audio component.", "tags": { "tag1": "value1" }, "category": "Example Category", "type_codes": [ "TC1", "TC2" ] } ] ``` ``` -------------------------------- ### Get Category Index (Python) Source: https://logic-plugin-manager.readthedocs.io/en/latest/_modules/logic_plugin_manager/tags/musicapps Retrieves the current index of a given category within the sorting list. This is a utility function for other sorting operations. It relies on the `self.sorting` attribute. ```python def get_index(self, category: str) -> int: return self.sorting.index(category) ``` -------------------------------- ### Get Audio Component by Tags ID Source: https://logic-plugin-manager.readthedocs.io/en/latest/_modules/logic_plugin_manager/logic/plugins Retrieves a single audio component matching the provided tags ID. The search is case-insensitive. ```APIDOC ## GET /audio-components/tags/{tags_id} ### Description Retrieves a specific audio component using its tags ID. The tags ID is matched in a case-insensitive manner. ### Method GET ### Endpoint `/audio-components/tags/{tags_id}` ### Parameters #### Path Parameters - **tags_id** (string) - Required - The tags ID to uniquely identify the audio component. ### Response #### Success Response (200) - **AudioComponent** (object | null) - The AudioComponent object matching the provided tags ID, or null if not found. #### Response Example ```json { "id": "component1", "name": "Example Component", "manufacturer": "Example Corp", "version": "1.0.0", "description": "A sample audio component.", "tags": { "tag1": "value1" }, "category": "Example Category", "type_codes": [ "TC1", "TC2" ] } ``` ``` -------------------------------- ### Get Audio Component by Subtype Code Source: https://logic-plugin-manager.readthedocs.io/en/latest/_modules/logic_plugin_manager/logic/plugins Retrieves a set of audio components matching the provided subtype code. The search is case-insensitive. ```APIDOC ## GET /audio-components/subtype/{subtype_code} ### Description Retrieves a set of audio components based on their subtype code. The subtype code is matched in a case-insensitive manner. ### Method GET ### Endpoint `/audio-components/subtype/{subtype_code}` ### Parameters #### Path Parameters - **subtype_code** (string) - Required - The subtype code to filter audio components by. ### Response #### Success Response (200) - **AudioComponent** (set) - A set of AudioComponent objects matching the provided subtype code. Returns an empty set if no matches are found. #### Response Example ```json [ { "id": "component1", "name": "Example Component", "manufacturer": "Example Corp", "version": "1.0.0", "description": "A sample audio component.", "tags": { "tag1": "value1" }, "category": "Example Category", "type_codes": [ "TC1", "TC2" ] } ] ``` ``` -------------------------------- ### Lazy Loading in Logic Plugin Manager Source: https://logic-plugin-manager.readthedocs.io/en/latest/getting_started Illustrates how to use lazy loading with the Logic Plugin Manager. This approach initializes the Logic instance without immediately loading all plugins, allowing for manual discovery when needed, which can improve startup performance. ```python from logic_plugin_manager import Logic # Initialize without loading plugins logic = Logic(lazy=True) # Manually discover plugins when needed logic.discover_plugins() logic.discover_categories() ``` -------------------------------- ### Get Category at Index (Python) Source: https://logic-plugin-manager.readthedocs.io/en/latest/_modules/logic_plugin_manager/tags/musicapps Retrieves the category name located at a specific index in the sorting list. This is a utility function for accessing categories by their position. It relies on the `self.sorting` attribute. ```python def get_at_index(self, index: int) -> str: return self.sorting[index] ``` -------------------------------- ### Get Category Index in Logic Plugin Manager (Python) Source: https://logic-plugin-manager.readthedocs.io/en/latest/_modules/logic_plugin_manager/tags/category Retrieves the current index position of the category. This is a property accessor that calls `get_index` from `musicapps.properties` using the category's name. ```python @property def index(self): return self.musicapps.properties.get_index(self.name) ``` -------------------------------- ### Accessing Plugin Information with Logic Source: https://logic-plugin-manager.readthedocs.io/en/latest/core_concepts Demonstrates how to initialize the Logic class and retrieve specific plugin information such as its full name, manufacturer, type codes, and tags ID. This is useful for inspecting individual plugin details. ```python from logic_plugin_manager import Logic logic = Logic() plugin = logic.plugins.get_by_name("Pro-Q 3") # Access component information print(f"Full Name: {plugin.full_name}") print(f"Manufacturer: {plugin.manufacturer}") print(f"Type Code: {plugin.type_code}") print(f"Subtype Code: {plugin.subtype_code}") print(f"Manufacturer Code: {plugin.manufacturer_code}") print(f"Tags ID: {plugin.tags_id}") ``` -------------------------------- ### Get Plugin by Name Source: https://logic-plugin-manager.readthedocs.io/en/latest/_modules/logic_plugin_manager/logic/plugins Retrieves a specific AudioComponent plugin using its name, performing a case-insensitive lookup. Returns `None` if no plugin matches the provided name. ```python class Plugins: # ... (previous code) ... def get_by_name(self, name: str) -> AudioComponent | None: return self._by_name.get(name.lower()) ``` -------------------------------- ### Batch Category Operations for Plugins Source: https://logic-plugin-manager.readthedocs.io/en/latest/getting_started Demonstrates how to perform batch operations on plugin categories, such as selecting multiple synthesizer plugins and moving them to a newly created 'Synthesizers' category. ```python from logic_plugin_manager import Logic logic = Logic() # Get all synthesizer plugins synths = logic.plugins.search("synth", use_fuzzy=True) synth_plugins = {result.plugin for result in synths[:20]} # Move them to a custom category synth_category = logic.introduce_category("Synthesizers") logic.move_plugins_to_category(synth_category, synth_plugins) ``` -------------------------------- ### Find Multi-Plugin Bundles using Logic Source: https://logic-plugin-manager.readthedocs.io/en/latest/examples Identifies and lists component bundles that contain more than one audio component using the Logic Plugin Manager. For each identified bundle, it prints the bundle name and a list of its constituent plugins, along with their types. This helps in understanding bundles with complex plugin arrangements. ```python from logic_plugin_manager import Logic logic = Logic() # Find bundles with multiple plugins multi_plugin_bundles = [ comp for comp in logic.components if len(comp.audio_components) > 1 ] print(f"Found {len(multi_plugin_bundles)} bundles with multiple plugins:\n") for component in multi_plugin_bundles: print(f"{component.name} - {len(component.audio_components)} plugins:") for plugin in component.audio_components: print(f" - {plugin.name} ({plugin.type_name.display_name})") print() ``` -------------------------------- ### Get Plugins by Manufacturer Source: https://logic-plugin-manager.readthedocs.io/en/latest/_modules/logic_plugin_manager/logic/plugins Retrieves a set of all AudioComponent plugins manufactured by a given manufacturer, performing a case-insensitive lookup. Returns an empty set if no plugins are found for that manufacturer. ```python class Plugins: # ... (previous code) ... def get_by_manufacturer(self, manufacturer: str) -> set[AudioComponent]: return self._by_manufacturer.get(manufacturer.lower(), set()) ``` -------------------------------- ### Handle Plugin and Music App Load Errors in Python Source: https://logic-plugin-manager.readthedocs.io/en/latest/_sources/getting_started.rst Demonstrates how to use try-except blocks to catch specific exceptions raised by the Logic Plugin Manager library during initialization. It handles MusicAppsLoadError for database loading issues and PluginLoadError for plugin loading failures. This helps in gracefully managing errors related to application and plugin loading. ```python from logic_plugin_manager import ( Logic, PluginLoadError, MusicAppsLoadError, CategoryValidationError ) try: logic = Logic() except MusicAppsLoadError as e: print(f"Could not load Logic's database: {e}") except PluginLoadError as e: print(f"Error loading plugins: {e}") ``` -------------------------------- ### Get Neighboring Categories (Python) Source: https://logic-plugin-manager.readthedocs.io/en/latest/_modules/logic_plugin_manager/tags/musicapps Returns the categories immediately preceding and succeeding a given category in the sorting list. Returns `None` if a neighbor does not exist (e.g., for the first or last category). Dependencies include `self.get_index()`. ```python def get_neighbors(self, category: str) -> tuple[str | None, str | None]: idx = self.get_index(category) prev_cat = self.sorting[idx - 1] if idx > 0 else None next_cat = self.sorting[idx + 1] if idx < len(self.sorting) - 1 else None return prev_cat, next_cat ``` -------------------------------- ### Get Plugin by Full Name Source: https://logic-plugin-manager.readthedocs.io/en/latest/_modules/logic_plugin_manager/logic/plugins Retrieves a specific AudioComponent plugin using its full name, performing a case-insensitive lookup. Returns `None` if no plugin matches the provided name. ```python class Plugins: # ... (previous code) ... def get_by_full_name(self, full_name: str) -> AudioComponent | None: return self._by_full_name.get(full_name.lower()) ``` -------------------------------- ### Filter Plugins by Type Code Source: https://logic-plugin-manager.readthedocs.io/en/latest/examples This Python snippet shows how to filter plugins based on their type code. It retrieves all 'aumu' (instrument) and 'aufx' (effect) plugins. Requires the 'logic_plugin_manager' library. ```python from logic_plugin_manager import Logic logic = Logic() # Get all instruments instruments = logic.plugins.get_by_type_code("aumu") print(f"Found {len(instruments)} instruments") # Get all effects effects = logic.plugins.get_by_type_code("aufx") print(f"Found {len(effects)} effects") ``` -------------------------------- ### Get Plugins by Factory Function Source: https://logic-plugin-manager.readthedocs.io/en/latest/_modules/logic_plugin_manager/logic/plugins Retrieves a set of all AudioComponent plugins that use a specific factory function, performing a case-insensitive lookup. Returns an empty set if no plugins are found for that function. ```python class Plugins: # ... (previous code) ... def get_by_factory_function(self, factory_function: str) -> set[AudioComponent]: return self._by_factory_function.get(factory_function.lower(), set()) ``` -------------------------------- ### Discover Plugins in Logic Manager (Python) Source: https://logic-plugin-manager.readthedocs.io/en/latest/_modules/logic_plugin_manager/logic/logic Scans the specified components directory for '.component' files and loads all associated audio plugins. It iterates through each component, extracts its audio components, and adds them to the internal plugins collection. Failed component loads are logged as warnings. ```python def discover_plugins(self) -> "Logic": """Scan components directory and load all plugins. Iterates through .component bundles, loading their AudioComponents into the plugins collection. Failed components are logged as warnings. Returns: Logic: Self for method chaining. """ for component_path in self.components_path.glob("*.component"): try: logger.debug(f"Loading component {component_path}") component = Component( component_path, lazy=self.lazy, musicapps=self.musicapps ) self.components.add(component) logger.debug(f"Loading plugins for {component.name}") for plugin in component.audio_components: self.plugins.add(plugin, lazy=self.lazy) except Exception as e: logger.warning(f"Failed to load component {component_path}: {e}") return self ``` -------------------------------- ### Get Plugins by Manufacturer Code Source: https://logic-plugin-manager.readthedocs.io/en/latest/_modules/logic_plugin_manager/logic/plugins Retrieves a set of all AudioComponent plugins associated with a specific manufacturer code, performing a case-insensitive lookup. Returns an empty set if no plugins match the code. ```python class Plugins: # ... (previous code) ... def get_by_manufacturer_code(self, manufacturer_code: str) -> set[AudioComponent]: return self._by_manufacturer_code.get(manufacturer_code.lower(), set()) ``` -------------------------------- ### Get Plugins by Manufacturer, Type, or Category Source: https://logic-plugin-manager.readthedocs.io/en/latest/core_concepts Demonstrates how to retrieve plugins based on specific criteria such as manufacturer, type code, or category. This is useful for filtering and organizing plugins within Logic Pro. ```python fabfilter = logic.plugins.get_by_manufacturer("fabfilter") effects = logic.plugins.get_by_type_code("aufx") eq_plugins = logic.plugins.get_by_category("Effects:EQ") ```