Custom Commands and AI Services
What are Custom Commands?
Custom Commands is a new module introduced in Found v1.1, currently available only to Pro members. This module allows you to enhance the functionality of Found by running various extension scripts and programs.
The term "Custom Commands" is used to describe the essence of this feature. While it also supports directly executing third-party programs without using a script interpreter, most of the time, this functionality is implemented in the form of one or more scripts. Therefore, the terms "Custom Commands" and "scripts" are often used interchangeably in the following text.
In the latest version (v1.1) to date, Custom Commands support invoking extension scripts in the right-click menu of the main browser area and the right-click menu of the preview panel.
Feel free to join our discord to exchange more tips and tricks on using Custom Commands with other users.
How to view and enable Custom Commands?
In the Custom Commands tab within the Settings panel, you can view local and online community scripts (we regularly update scripts in the online community, so remember to check periodically to not miss out on new features). Scripts from the online community need to be downloaded locally before they can be enabled.
In the local scripts panel, you can activate or deactivate a Custom Command by using the checkboxes on the left. You can also adjust the display order of a command in the menu by dragging the control button on the far right.
How are Custom Commands executed?
Typically, Custom Commands are saved in the form of one or multiple scripts within the "Documents/Found/scripts" directory. You can modify the value of "custom_commands_path" in the configuration file found.ini to credit to a different directory or even include multiple paths (such as NAS addresses) for utilizing a dynamically updated shared script folder across multiple local networks.
Different addresses should be separated by semicolons. Each Custom Command has its own folder under the scripts directory, containing a manifest.json file that records various key parameters of the Custom Command.
When Found is running, it scans the directory specified by "custom_commands_path," recognizes all the manifest.json files in the subfolders, and parses them as Custom Commands.
Meanwhile, the "Documents/Found/enabled_scripts.json" file records all the enabled scripts.
When a Custom Command is executed, the variables included in the param parameter are parsed first. Then, the param parameter is appended as command-line arguments for the interpreter to run.
Therefore, you can use any type of interpreter (such as Python or Powershell), various third-party programs that support command-line arguments, or even your own programs to execute arbitrary commands. We recommend using Python as an intermediary language for calling various third-party commands and services.
How to modify/write Custom Commands?
A Custom Command needs to have its own folder located within the directory specified by "custom_commands_path" in found.ini, and a manifest.json file must exist within that folder.
The manifest.json file has the following parameters:
- Name: The name of the current Custom Command. If the name contains a colon ":" character, the characters before the colon will be displayed as a parent group menu in the menu, and the characters after the colon will be displayed as submenu items. If multiple Custom Commands have the same parent group name, they will be grouped together under the same parent menu. For example, if there are two Custom Commands named "AI: example1" and "AI: example2," when these two Custom Commands are enabled, they will be categorized as sibling items "example1" and "example2" under the "AI" parent menu.
- Entry: The entry credit of the script within Found. In Found v1.1, there are two entry credits: "browser_context" for the right-click menu in the browser area and "preview_context" for the right-click menu in the preview panel.
- Desc: A description of the Custom Command, typically including detailed information about its purpose.
- Filters: Supported format filters, separated by semicolons ";". In particular, the filter "." represents that the command supports executing with folders as objects. Tip: If a filter includes a specific path, the command can only be executed within that corresponding path.
- Author: The name of the command's author.
- Version: The version number.
- CMD: The executable program or script interpreter to be executed.
- A Custom Command needs to have its own folder located within the directory specified by "custom_commands_path" in found.ini, and a manifest.json file must exist within that folder.
- The manifest.json file has the following parameters:
- Name: The name of the current Custom Command.
- Entry: The entry credit of the script within Found.
- Filters: Supported format filters.
- Author: The name of the command's author.
- Version: The version number.
- CMD: The executable program or script interpreter to be executed.
- Param: The command-line parameters to be appended after the interpreter when executing the command.
In particular, the Param parameter supports the following special variables: - "$FILES": All selected files in the browser area, separated by the vertical bar "|" symbol if there are multiple files.
- "$FOLDER": The path of the current browser area if invoked by right-clicking in a blank area; the path of the right-clicked folder if invoked on a folder in the browser area.
- "$ENTRY": The entry credit of the script.
- "$COLLECTION": The UUID of the current collection if browsing a collection.
- "$ASSET_ID": The ID(s) of one or more assets, separated by the vertical bar "|" symbol if there are multiple assets.
To add a new Custom Command that renames selected files with the .mp4 extension to .m4v using a Python script, you need to:
Create a new folder in the "Documents/Found/scripts" directory. Create a "manifest.json" file within the folder with the following content:{ "name": "Rename to m4v", "entry": ["browser_context"], "filters": "*.mp4", "author": "jack", "version": "1.0.0", "CMD": "python", "param": "to_m4v.py --files $FILES" }
- Create a "to_m4v.py" file within the folder and implement the renaming functionality using Python, reading the "--files" parameter.
Found API
Found provides a series of RESTful APIs that allow users to customize various functionalities of Found to some extent. If your script involves modifying asset files, such as renaming operations, we strongly recommend using the API to maintain the integrity of the database and avoid the risk of losing various data in Found.
【View API Documentation】.
We will continue to open up more APIs in future versions, so stay tuned.
AI Compositing Feature
The local version of the AI Compositing feature (based on Stable Diffusion) is currently being optimized and will be provided as a custom command in the near future. Please stay tuned for updates in the online script community.
We have implemented both the local version of the AI Compositing feature (based on Stable Diffusion) and the AI cloud service compositing feature (based on our proprietary high-quality models) through custom commands and the Found API.
Local AI Compositing: Using the local AI script presets for compositing does not require any additional payment. However, you need to deploy the local version of Stable Diffusion, and you can refer to a series of video tutorials that we will release later (with a hyperlink to our Bilibili homepage) for the relevant steps. The generation speed and success rate of local AI compositing depend on your computer's configuration. Due to the nature of this feature, we cannot guarantee that every user's computer will successfully complete the corresponding deployment, nor can we provide individual consultation services for local deployment. You can join our discord to communicate with other users.
AI Cloud Service: Using the AI cloud service-related features will consume corresponding service credits. During the testing phase, we provide a monthly allocation of free service credits to all Pro users. After the credits are exhausted, additional credits need to be purchased to continue using the service. Click here to see the details.