# Filters and formulas

In the program, files can be filtered by status, file type, by readiness, by warnings, by the presence of a file of one or another extension, by the number of words / characters in metadata, by their values - in general, you now have a huge scope for imagination.

Each condition-expression for the filter is written in curly braces. For example, {len(meta.keywords) > 30}.

Let's take a look at filters related to metadata:

  • len(xxx) means number of xxx. For example, len(meta.keywords) is the number of keywords, len(meta.title) is the number of characters in the title, and len(meta.description) is the number of characters in the description.

  • words(xxx) means the number of words xxx. For example, words(meta.title) is the number of words in the title.

  • latin(xxx) means that only latin symbols is allowed in xxx. For example, {latin(meta.keywords)} - only latin symbols is allowed in keywords.

  • You can set specific limit values:

    • {30 < len(meta.title) < 50} - the number of characters in the title must be between 31 and 49 inclusive
    • {words(meta.description) >= 10} - the number of words in the description must be greater than or equal to 10 If you put a minus sign before this expression, then it turns out that the number of words in the description must be strictly less than 10. That is, -{words(meta.description) >= 10} same as {words(meta.description) < 10}
  • There are also special conditions, the number of which we will gradually increase:

    • {len(meta.keywords[{words($) > 1}]) = 0} - forbid compound keywords
    • {meta.title <> meta.description} - title must not match description

The next group of filters concerns warnings. Consider the following example: {files[*.jpg|*.jpeg|*.png].size < 25MB}. This entry can be read as follows: the size of files with extensions `.jpg, *.jpeg, .png must be strictly less than 25MB. There are a few things to keep in mind here:

  • Measure (MP, B, KB, etc.) must be specified without spaces after the number.

  • files[*.jpg] means that all files whose names end with .jpg will be selected, which means that if you write files[*test.jpg] - filters will be applied only to those files that end in to test.jpg. Similarly, files[a*test.jpg] - files start with a and end with test.jpg. In short, the asterisk character (*) means any number of any characters.

  • files[*.eps|*.svg].size - vector size limits

  • files[*.mov|*.mp4|*.mpg|*.avi].resolution - video resolution limits. Can be set in 2 formats: 10MP or "1024x200".

  • files[*.mov|*.mp4|*.mpg|*.avi].framerate in [10, 20, 25.4] - limit on possible file rate values. Allowed values are indicated in square brackets