mixxx-smart-crates
v1.0.1
Published
automatically populate mixxx crates by quering the library
Maintainers
Readme
MIXXX Smart Crates
A command line utility to create mixxx crates by filtering the library.
Installation
npm install -g mixxx-smart-cratesmight require sudo privileges
Usage
mixxx-smart-crates -h | --help
mixxx-smart-crates [-v | -V] [--db MIXXXDB] -q QUERY
mixxx-smart-crates [-v | -V] [--dry] [--db MIXXXDB] [DIR]Options
-h, --helpShow this help message--db MIXXXDBPath to Mixxx SQLite database (default:$HOME/.mixxx/mixxxdb.sqlite)-q QUERYRun a query against the track library.-q @FILESame as-q, but query is read fromFILE.@-reads fromSTDIN-vVerbose-VDebug and verbose--dryDry run: don't write crates toMIXXXDB(only for directory mode)
Directory Mode
If no -q is provided, DIR is scanned for .crate files (default: current directory).
Each .crate file must contain a valid QUERY.
Crate name corresponds to filename wihtout extension.
Query syntax
A formal definition can be found in dsl.ebnf.
The base unit is a predicate in the form property operation value, for example:
artist = "Mauro Brianza"all tracks of Mauro Brianza
Values can be numbers literals (0, 3.14) or strings ("Mauro", 'Brianza').
Quotes around strings can be omitted in absence of spaces: artist ?= Senisa.
Any predicate can be negated with !( predicate ) or ~( predicate ), for example:
!(artist = "Mauro Brianza")all tracks except those of Mauro Brianza
Different predicates can be combined in AND (,, &, &&) or OR (;, |, ||) logic.
AND has association precedence over OR (as expected):
artist = "Mauro Brianza",
genre = "Tech House";
artist = "Senisa";all Tech House tracks of Mauro brianza and all track of Senisa
Parentesis alter the order of association:
artist = "Mauro Brianza",
(genre = "Tech House"; genre = "Garage"),all tracks of Mauro Brianza, but only if Tech House or Garage
Mixing separators is allowed, even inside the same combination (altough discouraged):
artist = "Mauro Brianza" & genre = "Tech House", bpm >= 128all Tech House tracks of Mauro Brianza with bpm from 128 upwards
Example:
!(location ? Recordings) & (
genre ? "Tech House",
bpm >= 126, bpm <= 132
$hotcues > 0,
$playlists = 0,
)exclude tracks in recordings. Then, take all Tech House tracks with bpm between 126 and 132 (both included), with at least one cue set and not used in other playlists.
Operations (Predicates)
String operations have both case-insensitive and case-sensitive variants.
Number operations will try to parse the string value. If unable, the predicate will evaluate to false.
Equality and inequality operations treat numbers as strings.
Equality (=, ==, ===)
artist = mauro; artist == mauroProperty must exactly match value:
- ✓
"mauro" - ✓
"Mauro"(case insensitive) - ×
"Mauro Brianza"
artist === mauro- ✓
"mauro" - ×
"Mauro"(case sensitive)
Inequality (!=, <>, !==)
Shortcut for !(a = b).
artist != mauro; artist <> mauroProperty must differ from value:
- ✓
"Senisa" - ✓
"Mauro Brianza" - ×
"Mauro"
artist !== mauro- ✓
"Mauro"(case sensitive) - ×
"mauro"(matches)
Includes, Contains (?, ?=)
artist ? mauro;Property must contain value:
- ✓
"mauro" - ✓
"Mauro Brianza"(case insensitive) - ×
"Senisa"
artist ?= mauro- ✓
"mauro Brianza" - ×
"Mauro Brianza"(case sensitive)
Excludes (!?, !?=)
Shortcut for !(a ? b).
artist !? mauro;Property must not contain value:
- ✓
"Senisa" - ✓
"Mauro Brianza" - ×
"Mauro"
artist !== mauro- ✓
"Mauro"(case sensitive) - ×
"mauro"(matches)
Regex (/=, /==)
genre /= "(Deep )?Tech House";Property must match regex:
- ✓
"deep tech house"(case insensitive) - ✓
"tech house" - ×
"deep house"
genre /== "(Deep )?Tech House";- ✓
"Deep Tech House" - ×
"deep tech house"(case sensitive)
Greater than (or equal to) (>, >=)
bpm > 130- ×
128 - ×
130 - ✓
174
bpm >= 130- ×
128 - ✓
130 - ✓
174
Less than (or equal to) (<, <=)
bpm < 130- ✓
128 - ×
130 - ×
174
bpm <= 130- ✓
128 - ✓
130 - ×
174
Properties
Propeties map directly to mixxx db model, table library:
artisttitlealbumyeargenretracknumberlocationcommenturldurationbitratesampleratecuepointbpmchannelskeyratingdatetime_addedtimesplayedmixxx_deletedfiletype
It also provides this custom properties:
$hotcues: number of memory cues set on a track$playlists: number of playlists featuring a track$age: how old is the track in year (ifyearfield is filled)
