-
Notifications
You must be signed in to change notification settings - Fork 3
Capture Groups
The service supports using Perl Compatible Regular Expression (PCRE) capture groups to extract pieces of source paths for use as parameters into later stages.
- Inclusion expressions of
hoppers may bind names to their capture groups like so:property /expression/ - Captured values may be used both for formatting purposes as well as filtering. Names may not clash with existing reserved names.
- In case it wasn't obvious, only the matched hopper's captured values shall be passed down in the pipeline.
If a file contains a hash in brackets eg: file name [sha hash].mkv. It can be matched by a hopper with this inclusion format.
[hopper]
include = file_path /(?<file_plain_name>[^\[]+?)\s*\[(?<file_hash>[^\]]+)\]\.mkv$/
transform = check_integrity
store = storageThis can be fed into a transform that would fail if the hash doesn't check out
[transform]
name = check_integrity
include = file_path /\.mkv$/
exec = /home/user/check-hash.sh
args = {from} {to} {file_hash}Then used once more in the store to strip the hash away
[store]
name = storage
path = /home/user/videos/{file_plain_name}To reference capture groups in comparisons, prepend the name with a %
include = %file_plain_name /..expression../Be aware, there are no early checks to ensure the variables required by a particular component of the processing pipeline is actually available. If a value isn't available, behavior is undefined. Most likely the service will crash. More hand holding will be added in the future when it is properly designed.