Both sides previous revisionPrevious revisionNext revision | Previous revision |
linked-media [2022/02/04 15:48] – [Where links are defined] shane | linked-media [2023/05/08 18:59] (current) – external edit 127.0.0.1 |
---|
Unify v1.8 adds support for //linked media//. Every patch in a library can optionally have a //link// to an associated media item. Three distinct media types are supported: | Unify v1.8 adds support for //linked media//. Every patch in a library can optionally have a //link// to an associated media item. Three distinct media types are supported: |
- An //image file// (stored somewhere under the library's //Media// folder), | - An //image file// (stored somewhere under the library's //Media// folder), |
- A //HTML file// (also stored under the library's //Media// folder), or | - A //[[wp>HTML]] file// (also stored under the library's //Media// folder), or |
- A //URL link// to content hosted on a separate server (e.g. on the Internet) | - A //[[wp>URL]] link// to content hosted on a separate server (e.g. on the Internet) |
| |
===== About linked media and links ===== | ===== About linked media and links ===== |
| |
The presence of a link is indicated by a colored outline around the patch's //library image//, shown just to the right of the patch metadata banner. (See [[gui-overview#tour_of_the_header_section|Navigating Unify's graphical user interface]].) Clicking the //library image// opens the linked media item. | The presence of a link is indicated by a colored outline around the patch's //library image//, shown just to the right of the patch metadata banner. (See [[gui-overview#tour_of_the_header_section|Navigating Unify's graphical user interface]].) The outline color will be green for local files, or blue for URLs. |
| |
| Clicking the //library image// opens the linked media item. |
* Local //image files// are opened in the Unify window; click anywhere in the image to close it. | * Local //image files// are opened in the Unify window; click anywhere in the image to close it. |
* Local //HTML files// are also opened in the Unify window, in a simplified browser interface with **Back** and **Close** buttons at the top. | * Local //HTML files// are also opened in the Unify window, in a simplified browser interface with **Back** and **Close** buttons at the top. |
* Holding down Option/ALT while clicking the library image will override the default on a one-time basis. | * Holding down Option/ALT while clicking the library image will override the default on a one-time basis. |
| |
===== Where links are defined ===== | ----- |
| **Note: the remainder of this page describes an advanced topic. You must be comfortable with creating and editing [[midi-controller-files#about_plain-text_files|plain-text files]] to be able to use this technique.** |
| ----- |
| |
| ===== Where links are defined: the links.txt file ===== |
| |
Links for a library's patches are defined in a file //links.txt// which may optionally reside in the library's //Media// folder. This is a [[midi-controller-files#about_plain-text_files|plain text file]]; you will need to have a true plain-text editor if you want to change it. | Links for a library's patches are defined in a file //links.txt// which may optionally reside in the library's //Media// folder. This is a [[midi-controller-files#about_plain-text_files|plain text file]]; you will need to have a true plain-text editor if you want to change it. |
The //links.txt// file is basically a list of //pattern / target pairs//, one per line. Blank lines may be interspersed to improve legibility, and //comment lines// (indicated by an initial "#" symbol) may also be added to provide documentation. Here is an example: | The //links.txt// file is basically a list of //pattern / target pairs//, one per line. Blank lines may be interspersed to improve legibility, and //comment lines// (indicated by an initial "#" symbol) may also be added to provide documentation. Here is an example: |
| |
<file links.txt> | <file txt links.txt> |
# This is a links list. Blank lines and lines starting with "#" (comments) are ignored. | # This is a links list. Blank lines and lines starting with "#" (comments) are ignored. |
# Remaining lines consist of 2 parts: a "pattern", and a "target". | # Remaining lines consist of 2 parts: a "pattern", and a "target". |
# Use quotation marks if pattern or target contain embedded spaces. | # Use quotation marks if pattern or target contain embedded spaces. |
# Unify will search down the list for the first pattern which matches the current patch name. | # Unify will search down the list for the first pattern which matches the current patch name. |
# The target can either be a web URL or a path (relative to Media folder) to a local image file. | # In patterns, "?" matches any single character, "*" matches any sequence of characters. |
| # The target can either be a web URL or a path (relative to Media folder) to a local file. |
| |
Bloo* http://192.168.1.99/phpinfo.php # Open URL "locally" in Unify window | Bloo* http://192.168.1.99/phpinfo.php # URL without parameters |
"Colours Test" hubble_ngc3318_potw2203a_0.png # Open image locally | "Colours Test" hubble_ngc3318_potw2203a_0.png # Image file in the library's Media folder |
"Clicking *" http://192.168.1.99/phpinfo.php/ # Slash at end means open in browser | "Clicking *" html/test.html # HTML file in "html" subfolder of Media folder |
| |
# The pattern "*" will match anything, so I put it last in the list. | # The pattern "*" will match anything, so I put it last in the list. |
# Adding "?" at the end of the web URL causes unify to add "library" and "patch" parameters | # Adding "?" at the end of the web URL causes unify to append "library" and "patch" parameters |
# automatically, for the benefit of e.g. PHP scripts at the server end. | # automatically, for the benefit of e.g. PHP scripts at the server end. |
* http://192.168.1.99/unify.php?/ # Can be combined with slash (which will be removed) | * http://192.168.1.99/unify.php? # ?library=<library name>&patch=<patch name> will be appended |
</file> | </file> |
| |
The first item on each //pattern/target// line can either be the full name of a patch, or a partial name, where some characters are replaced by the special characters "?" and "*". When Unify loads a patch, it compares the new patch name against each pattern in turn, and stops at the first match. The pattern character "?" will match //any single character// in the patch name, and "*" will match //any sequence of characters//. In the example above, the last pattern in the file is "*" all by itself, which is guaranteed to match //any patch name//. Putting this at the end of the file guarantees that every patch in the library will be linked to the final target, //if and only if// its name does not match any of the earlier patterns. | The first item on each //pattern/target// line can either be the full name of a patch, or a partial name, where some characters are replaced by the special characters "?" and "*". When Unify loads a patch, it compares the new patch name against each pattern in turn, and stops at the first match. The pattern character "?" will match //any single character// in the patch name, and "*" will match //any sequence of characters//. In the example above, the last pattern in the file is "*" all by itself, which is guaranteed to match //any patch name//. Putting this at the end of the file guarantees that every patch in the library will be linked to the final target, //if and only if// its name does not match any of the earlier patterns. |
| |
The second item on each //pattern/target// line can be either a [[wp>URL]] or blah. | The second item on each //pattern/target// line can be either a [[wp>URL]] or a [[wp>Path_(computing)#Absolute_and_relative_paths|relative path]] to a HTML or image file, relative to the library's //Media// folder. |
| * For image files, any standard image types such as //.png//, //.jpg//, etc. can be used. |
| * Internet URLs may optionally include a //query string// starting with "?" (see [[wp>Uniform_Resource_Identifier]]). |
| * A single "?" at the very end of a URL will automatically be replaced by a valid query string with two //attribute-value pairs// as follows: |
| * ''library'' attribute, with the name of the patch library as the value |
| * ''patch'' attribute, with the full name of the patch as the value |
| |
Three miscellaneous syntax rules: | Miscellaneous syntax details: |
- Use double quotation-marks around any pattern or target which has embedded spaces. | - Use double quotation-marks around any pattern or target which has embedded spaces. |
- Spaces and tabs can be used freely on any line. | - Spaces and tabs can be used freely on any line. |
- Anything which comes after the //target// will be ignored (provided it is separated by at least one space or tab) and is effectively a comment. | - Anything which comes after the //target// will be ignored (provided it is separated by at least one space or tab) and is effectively a comment. |
| |