Match Stage
The Match Stage checks if a Play matches search expressions, provided by you. It does not change Play data.
Instead, the Stage succeeds if the Play matches and fails if it does not. Combined with Stage Flow Control and Play State Control this lets you decide what happens to a Play based on its data. Example scenarios:
- Discarding Plays from a specific device or user
- Marking Plays as Needs Review if a Title still looks wrong after the Musicbrainz Stage runs
- Skipping later Stages when a Play is from an Artist you don’t want to look up
Configuration
Section titled “Configuration”The Match Stage has a Default Stage. You do not need to create one in the top-level transformers of your AIO Config.
However, you can create one here if you want subsequent usage of this transformer to always have default rules, using Rules defaults.
Example
{ "transformers": [ { "type": "match", "name": "MyMatch", "defaults": { } } ]}- 1.always added when using "MyMatch" in a Source/Client...
Search Expression
Section titled “Search Expression”A search expression can be a plain string that matches a literal:
Expression: "Live"
"My Song (Live)" => matches"My Song" => does not matchor a regular expression:
Expression: "/(remaster|live)/i"
"My Song (Remastered 2011)" => matchesAn empty string ("") matches when the Play does not have that data, like a Play with no Album.
Each expression may also be an object with its own when condition, so it is only checked if when passes:
{}Each Rule can be a single search expression or a list of them. If any expression in a Rule matches, the Rule matches.
The Rules you can use are:
titleartistsalbumArtistsalbumart- any album, track, or artist art URLuserdeviceIdlibraryplaylistmusicService- only available for Sources that report this infodurationlistenedFor- instead of a search expression, use a comparison:=>or<followed by a duration. EX> 7 s< 2 minutes= 30s
{ "type": "match", "name": "MyMatch",}All Rules in a Stage must match for the Stage to succeed.
Multiple Rule Sets
Section titled “Multiple Rule Sets”To match one of several different combinations, put each combination in matches. The Stage succeeds if the Rules at the top level or any set in matches match.
{ "type": "match", "name": "MyMatch", "matches": [ ]}A Match Stage with no Rules at all never matches.
Examples
Section titled “Examples”Discard Short Plays from a Device
Section titled “Discard Short Plays from a Device”Discard Plays from the kitchen speaker that were listened to for less than 30 seconds.
Example
Review Messy Titles After Musicbrainz
Section titled “Review Messy Titles After Musicbrainz”Use Musicbrainz to clean up the Play, then mark it as Needs Review if the Title still has feat. or Remaster in it.
Example
{ "playTransform": { "preCompare": [ { "type": "musicbrainz", "name": "MyMB", }, { "type": "match", "name": "MyMatch", "title": "/(feat\\.|remaster)/i", } ] }}- 1.Still check the Title even if Musicbrainz could not find a match
- 2.Title still looks messy, set Play to Needs Review
- 3.Title looks fine, keep the Musicbrainz changes
Only Look Up Artists You Care About
Section titled “Only Look Up Artists You Care About”Stop the Hook early, without changing anything, for Plays that are not from your favorite Artists, so Musicbrainz only runs for them.