Difference between revisions of "Search Language"

From JRiverWiki
Jump to: navigation, search
m
m (Keywords)
Line 19: Line 19:
 
|Access Rating
 
|Access Rating
 
|accessrating
 
|accessrating
|[Access Rating]=PG-13
+
|<code>[Access Rating]=PG-13</code>
 
|-valign="top"  
 
|-valign="top"  
 
|Album
 
|Album
 
|al=<br>
 
|al=<br>
 
album=  
 
album=  
|al=[Highway 61"<br>
+
|<code>al=[Highway 61"</code><br>
 
:''Find all albums that being with "Highway 61".
 
:''Find all albums that being with "Highway 61".
 
|-valign="top"  
 
|-valign="top"  
 
|Album Artist
 
|Album Artist
 
|albumartist=
 
|albumartist=
|albumartist=Various
+
|<code>albumartist=Various</code>
 
|-valign="top"  
 
|-valign="top"  
 
|Album Artist (auto)
 
|Album Artist (auto)
 
|autoalbumartist=
 
|autoalbumartist=
|autoalbumartist=Various
+
|<code>autoalbumartist=Various</code>
 
:''Returns all album artist fields manually entered.
 
:''Returns all album artist fields manually entered.
  
autoalbumartist=multiple
+
<code>autoalbumartist=multiple</code>
 
:''Returns all artists in the album if the CD is a mix (determined automatically).
 
:''Returns all artists in the album if the CD is a mix (determined automatically).
 
|-valign="top"  
 
|-valign="top"  
Line 42: Line 42:
 
|ag=
 
|ag=
 
albumgain=
 
albumgain=
|ag=<2
+
|<code>ag=<2</code>
 
|-valign="top"  
 
|-valign="top"  
 
|Album Type
 
|Album Type
 
|albumtype=
 
|albumtype=
|[Album Type]=[Single artist (complete)]
+
|<code>[Album Type]=[Single artist (complete)]</code>
 
|-valign="top"  
 
|-valign="top"  
 
|Artist
 
|Artist
 
|ar=
 
|ar=
 
artist=
 
artist=
|ar="Bob Dylan"
+
|<code>ar="Bob Dylan"</code>
 
:''Returns all items whose artist is "Bob Dylan" (exact phrase).
 
:''Returns all items whose artist is "Bob Dylan" (exact phrase).
 
|-valign="top"  
 
|-valign="top"  
 
|Artist - Album (Year)
 
|Artist - Album (Year)
 
|n/a
 
|n/a
|[Artist - Album (year)]=[Lilac Time - And Love for All (1990)]
+
|<code>[Artist - Album (year)]=[Lilac Time - And Love for All (1990)]</code>
 
|-valign="top"  
 
|-valign="top"  
 
|Band
 
|Band
 
|bd=
 
|bd=
 
band=
 
band=
|bd=Lilac Time
+
|<code>bd=Lilac Time</code>
 
|-valign="top"  
 
|-valign="top"  
 
|Bit Depth
 
|Bit Depth
 
|n/a
 
|n/a
|[Bit Depth]=<16
+
|<code>[Bit Depth]=<16</code>
 
|-valign="top"  
 
|-valign="top"  
 
|Bitrate
 
|Bitrate
 
|bitrate=
 
|bitrate=
|bitrate=198
+
|<code>bitrate=198</code>
 
|-valign="top"  
 
|-valign="top"  
 
|Bookmark
 
|Bookmark
Line 77: Line 77:
 
|Beats per Minute
 
|Beats per Minute
 
|bpm=
 
|bpm=
|bpm=130 <br>
+
|<code>bpm=130</code>
bpm=<130 (less than 130)
+
<code>bpm=<130</code> (less than 130)
 
|-valign="top"  
 
|-valign="top"  
 
|Channels
 
|Channels
Line 87: Line 87:
 
|c=
 
|c=
 
comment=
 
comment=
|comment="live at the Horseshoe"
+
|<code>comment="Live at the Horseshoe"</code>
 
|-valign="top"  
 
|-valign="top"  
 
|Complete Album
 
|Complete Album
 
|completealbum=
 
|completealbum=
|completealbum==0
+
|<code>completealbum==0</code>
 
:''Returns incomplete albums
 
:''Returns incomplete albums
completealbum==1
+
<code>completealbum==1</code>
 
:''Returns complete albums.
 
:''Returns complete albums.
 
Note: A complete album has sequentially numbered tracks, from 1 to N.
 
Note: A complete album has sequentially numbered tracks, from 1 to N.
Line 99: Line 99:
 
|Composer
 
|Composer
 
|composer=
 
|composer=
|composer=mozart
+
|<code>composer=mozart</code>
 
|-valign="top"
 
|-valign="top"
 
|Compression
 
|Compression
Line 120: Line 120:
 
|d=
 
|d=
 
date=
 
date=
|date=<1y
+
|<code>date=<1y</code>
 
:''Less than 1 year ago
 
:''Less than 1 year ago
date=>3m
+
<code>date=>3m</code>
 
:''More than 3 months ago<br>
 
:''More than 3 months ago<br>
 
Use y (year), d (days) h (hours) m (minute) or s (seconds).
 
Use y (year), d (days) h (hours) m (minute) or s (seconds).
Line 128: Line 128:
 
|Date (day)
 
|Date (day)
 
|n/a
 
|n/a
|[Date (day)]=31
+
|<code>[Date (day)]=31</code>
 
|-valign="top"  
 
|-valign="top"  
 
|Date (filename friendly)
 
|Date (filename friendly)
 
|n/a
 
|n/a
|[Date (filename friendly)]=[20040521-174844]
+
|<code>[Date (filename friendly)]=[20040521-174844]</code>
 
|-valign="top"  
 
|-valign="top"  
 
|Date (month)
 
|Date (month)
 
|n/a
 
|n/a
|[Date (month)]=May
+
|<code>[Date (month)]=May</code>
 
|-valign="top"  
 
|-valign="top"  
 
|Date (year)
 
|Date (year)
 
|year=
 
|year=
|year=1973
+
|<code>year=1973</code>
year==0
+
<code>year==0</code>
 
:''Returns items without a year
 
:''Returns items without a year
 
|-valign="top"  
 
|-valign="top"  
 
|Date Created
 
|Date Created
 
|n/a
 
|n/a
|[Date created]=<1d
+
|<code>[Date created]=<1d</code>
 
:''Returns items created today
 
:''Returns items created today
[Date Created]=<30m
+
<code>[Date Created]=<30m</code>
 
:''Returns items created less than 30 minutes ago.
 
:''Returns items created less than 30 minutes ago.
 
Use y (year), d (days) h (hours) m (minute) or s (seconds).
 
Use y (year), d (days) h (hours) m (minute) or s (seconds).
Line 154: Line 154:
 
|Date Imported
 
|Date Imported
 
|dateimported=
 
|dateimported=
|dateimported=<=6d
+
|<code>dateimported=<=6d</code>
 
:''Returns items imported in the past 6 days.
 
:''Returns items imported in the past 6 days.
dateimported=30h-60h
+
<code>dateimported=30h-60h</code>
 
:''Returns items imported between 30 and 60 hours ago.
 
:''Returns items imported between 30 and 60 hours ago.
dateimported=<1y
+
<code>dateimported=<1y</code>
 
:''Returns items imported within the last year.
 
:''Returns items imported within the last year.
 
Use y (year), d (days) h (hours) m (minute) or s (seconds).
 
Use y (year), d (days) h (hours) m (minute) or s (seconds).
Line 164: Line 164:
 
|Date Modified
 
|Date Modified
 
|n/a
 
|n/a
|[Date Modified]=<30m
+
|<code>[Date Modified]=<30m</code>
 
:''Returns items modified less than 30 minutes ago.
 
:''Returns items modified less than 30 minutes ago.
 
Use y (year), d (days) h (hours) m (minute) or s (seconds).
 
Use y (year), d (days) h (hours) m (minute) or s (seconds).
Line 179: Line 179:
 
|length=
 
|length=
 
duration=
 
duration=
|duration=300<br>
+
|<code>duration=300<br></code>
 
:''Returns all items whose duration is 300 seconds.
 
:''Returns all items whose duration is 300 seconds.
length=>300
+
<code>length=>300</code>
 
:''Returns all items with a duration greater than 300 seconds.
 
:''Returns all items with a duration greater than 300 seconds.
 
|-valign="top"  
 
|-valign="top"  
Line 190: Line 190:
 
|File Size
 
|File Size
 
|size=
 
|size=
|size=>7000   (size is in kbs)
+
|<code>size=>7000</code>
 +
:''Returns all files whose size is greater than 7000 kilobytes (size is in kilobytes).
 
|-valign="top"  
 
|-valign="top"  
 
|File Type
 
|File Type
 
|Filetype=
 
|Filetype=
|Filetype=mp3
+
|<code>Filetype=mp3</code>
 
|-valign="top"  
 
|-valign="top"  
 
|Filename
 
|Filename
|filename= or location=
+
|filename=
|location=D:\Music\Various\
+
location=
 +
|<code>location=D:\Music\Various\</code>
 
|-valign="top"  
 
|-valign="top"  
 
|Filename (name)
 
|Filename (name)
 
|   
 
|   
|[Filename (name)]="Train to Prague"<br>
+
|<code>[Filename (name)]="Train to Prague"</code>
Use quotes if there are spaces or special characters in the name
+
Use quotes to protect spaces or special characters in the file name.
 
|-valign="top"  
 
|-valign="top"  
 
|Filename (path)
 
|Filename (path)
 
|
 
|
|[Filename (path)]=photo<br>
+
|<code>[Filename (path)]=photo</code>
[Filename (path)]="C:\My Music"<br>
+
<code>[Filename (path)]="C:\My Music"</code>
Use quotes if there are spaces or special characters in the name
+
 
 +
Use quotes to protect spaces or special characters in the file name.
 
|-valign="top"  
 
|-valign="top"  
 
|Genre
 
|Genre
|genre= or g=
+
|g=
|g=rock
+
genre=
 +
|<code>g=rock</code>
 
|-valign="top"  
 
|-valign="top"  
 
|Height
 
|Height
 
|height=
 
|height=
|height=>100
+
|<code>height=>100</code>
 +
:''Returns images whose height is greater than 100 pixels.
 
|-valign="top"  
 
|-valign="top"  
 
|Image File
 
|Image File
 
|imagefile=
 
|imagefile=
|imagefile=adams
+
|<code>imagefile=adams</code>
 
:''Returns all images containing the word "adams" in its name.
 
:''Returns all images containing the word "adams" in its name.
imagefile=[]
+
<code>imagefile=[]</code>
 
:''Returns all files that have no images (i.e. image field is empty).
 
:''Returns all files that have no images (i.e. image field is empty).
-imagefile=[]
+
<code>-imagefile=[]</code>
 
:''Returns all files that have images (i.e. image field is not empty).
 
:''Returns all files that have images (i.e. image field is not empty).
imagefile=.,\
+
<code>imagefile=.,\</code>
 
:''Finds all tracks with external cover art. Adding - before this expression returns all tracks with cover art stored internally (in the file).
 
:''Finds all tracks with external cover art. Adding - before this expression returns all tracks with cover art stored internally (in the file).
 
|-valign="top"  
 
|-valign="top"  

Revision as of 22:44, 29 August 2010

This section describes the various rules and modifiers available in the Search bar, in the Build New Smartlist dialog box, and in View Scheme creation.

The Keywords and Modifiers are listed in alphabetical order. Not included are any custom fields you may have created, nor any expressions. For functions and expressions, see Media Center expression language.

Search terms or abbreviations (listed below), can be typed directly as text in the Search bar, bypassing the Search Wizard.

Keywords

Keywords create selections.

Keywords also have abbreviations, which are customizable. To go Tools > Options > Library, select the field and press Edit. Type the abbreviation you would like to use in the Keywords box. Multiple keywords may be used, each separated by a semi-colon (no spaces).

Name Keywords/Abbrev Example
Access Rating accessrating [Access Rating]=PG-13
Album al=

album=

al=[Highway 61"
Find all albums that being with "Highway 61".
Album Artist albumartist= albumartist=Various
Album Artist (auto) autoalbumartist= autoalbumartist=Various
Returns all album artist fields manually entered.

autoalbumartist=multiple

Returns all artists in the album if the CD is a mix (determined automatically).
Album Gain ag=

albumgain=

ag=<2
Album Type albumtype= [Album Type]=[Single artist (complete)]
Artist ar=

artist=

ar="Bob Dylan"
Returns all items whose artist is "Bob Dylan" (exact phrase).
Artist - Album (Year) n/a [Artist - Album (year)]=[Lilac Time - And Love for All (1990)]
Band bd=

band=

bd=Lilac Time
Bit Depth n/a [Bit Depth]=<16
Bitrate bitrate= bitrate=198
Bookmark n/a
Beats per Minute bpm= bpm=130

bpm=<130 (less than 130)

Channels n/a
Comment c=

comment=

comment="Live at the Horseshoe"
Complete Album completealbum= completealbum==0
Returns incomplete albums

completealbum==1

Returns complete albums.

Note: A complete album has sequentially numbered tracks, from 1 to N.

Composer composer= composer=mozart
Compression n/a
Content Distributor cdistrib=
Content ID cid=
Content Type ctype=
Date d=

date=

date=<1y
Less than 1 year ago

date=>3m

More than 3 months ago

Use y (year), d (days) h (hours) m (minute) or s (seconds).

Date (day) n/a [Date (day)]=31
Date (filename friendly) n/a [Date (filename friendly)]=[20040521-174844]
Date (month) n/a [Date (month)]=May
Date (year) year= year=1973

year==0

Returns items without a year
Date Created n/a [Date created]=<1d
Returns items created today

[Date Created]=<30m

Returns items created less than 30 minutes ago.

Use y (year), d (days) h (hours) m (minute) or s (seconds).

Date Imported dateimported= dateimported=<=6d
Returns items imported in the past 6 days.

dateimported=30h-60h

Returns items imported between 30 and 60 hours ago.

dateimported=<1y

Returns items imported within the last year.

Use y (year), d (days) h (hours) m (minute) or s (seconds).

Date Modified n/a [Date Modified]=<30m
Returns items modified less than 30 minutes ago.

Use y (year), d (days) h (hours) m (minute) or s (seconds).

Dimensions n/a
Disc # n/a
Duration length=

duration=

duration=300
Returns all items whose duration is 300 seconds.

length=>300

Returns all items with a duration greater than 300 seconds.
Events events=
File Size size= size=>7000
Returns all files whose size is greater than 7000 kilobytes (size is in kilobytes).
File Type Filetype= Filetype=mp3
Filename filename=

location=

location=D:\Music\Various\
Filename (name) [Filename (name)]="Train to Prague"

Use quotes to protect spaces or special characters in the file name.

Filename (path) [Filename (path)]=photo

[Filename (path)]="C:\My Music"

Use quotes to protect spaces or special characters in the file name.

Genre g=

genre=

g=rock
Height height= height=>100
Returns images whose height is greater than 100 pixels.
Image File imagefile= imagefile=adams
Returns all images containing the word "adams" in its name.

imagefile=[]

Returns all files that have no images (i.e. image field is empty).

-imagefile=[]

Returns all files that have images (i.e. image field is not empty).

imagefile=.,\

Finds all tracks with external cover art. Adding - before this expression returns all tracks with cover art stored internally (in the file).
Insensity intensity= intensity=3 or intensity=>2 (values from 1 to 5)
Keywords keyword= or keywords= or kw= kw =poprock;1979;hits (values: semicolon delimited list)
Last Played lastplayed= lastplayed=<24h (less than 24 hours)

lastplayed=<30m (less than 30 minutes)
You can use y (year), d (days) h (hours) m (minute) or s (seconds).

Lyrics lyrics= lyrics="you know your problem"
Media Type mediatype= mediatype=image
Mix Album mixalbum=
Name (Title) name= or title= or n= name="Tangled up in blue"
Notes notes= notes=”conducted by Jeremy”
Number of Plays numberplays= numberplays=>10 returns all files played more than 10 times
or or Extends the search: "Bob Dylan" or "Judy Collins"
Peak Level peaklevel= peaklevel=.77
People people= people=mom,dad,Mike displays all photos that are of one of these people
Places places= places=Amsterdam,London,cottage
Playback Range playbackrange=
Playlist playlist= or p= p="top 40 1996"
Rating rating= or r= rating=3, or rating=5,4
Removable removable= Returns info on files that are on removable media, like a CD or DVD. This new command replaces [Filename}=[Ox” from Media Jukebox.
Replay Gain replaygain= or rg= rg= -16
Sample Rate n/a
Service: Album Price n/a
Service: Track Price n/a
Text n/a

[Text]=”lemongrass chicken”

Track # tracknumber= or t= t=4 returns all track numbers with 4 (4, 14, 24)

t==4 returns only tracks which equal 4.

Volume Name volume= volume="Music 29" (insert name of your CD) (see Note 1)
Width width= width=>80
Year – Album

Note 1: This field is best used in conjunction with the ~d parameter, which specifies the database in which to search. Normally, the volume parameter will be relevant in the CD database. See ~d in the Modifiers below.

Modifiers

Modifiers alter the current selection of items.

Name Modifier Description / Examples
Limit database to ~d Selects the MC database(s) used for queries (eg. main, cd, temporary, etc.)

Examples:
~d=c limits searches to the CD database.
rock ~d=c searches only the CD database for ‘rock’.
rock ~d=mt searches main and temporary databases.
rock ~d=mct searches main, CD and temporary databases.

Only duplicates of

Remove duplicates of

~dup=

~nodup=

Includes or excludes duplicates from the current selection.

Examples:
~dup=[name],[artist] only keeps files in a list when at least one other file has the same name and artist in the list. You can add as many fields as you like (e.g., duration, album, etc).
~nodup=[name],[artist] keeps one copy of files that have duplicates.

Limit of device ~fill Selects and limits the number of items to fill the specific media type to maximum capacity. This modifier limits the number of files returned based on the amount of empty space left on the default or specified device.

Examples:
~fill or ~fill=[My ipod name] or ~fill=[D:\] How do you specificy a CD drive? Just the drive name?

Expand to full albums ~a Expands the track selection to include all tracks from the selected albums.

Examples:
~a
Include all tracks from the currently selected albums.
~a desolation row
Returns all tracks from each album for which “desolation row” is a track. If the track is on three albums, then all tracks from all three albums are returned.

Limit number to ~limit Limits the current selection set to a maximum number of matched keys, and maximum tracks (Q: ?tracks only?) per key. Usage: ~limit=<total key limit>,<per key limit>,<key fields>
Use -1 to indicate all.

Examples:
[genre]=[rock] ~limit=-1,2,[artist]
All rock, all artists, and of those artists, play no more than 2 songs by any artist:

Limit to n tracks ~n ~n=10 returns 10 random tracks.

~n=10 Bob Dylan returns 10 tracks containing the words Bob and Dylan.

Mix ~mix Creates mixes from the current selection of a specified size (either a number or percentage).

Examples:
g=rock ~mix=100,50%,{[Rating]=>3},50%,{[Rating]=<1}
play a mix of rock songs, ½ rated 4,5, and ½ unrated.

Limit size to ~s Limit the total track size to the specified number of megabytes.

Examples:
~s=650 returns a random number of tracks totaling a maximum of 650MB.
~s=650 Bob Dylan returns 650MB worth of tracks with Bob and Dylan in any of the fields.

Sort by ~sort Sorts the selection by the specified key(s).

Examples:
~sort=[Year],[track #]
~sort=[Random] (aka: Shuffle)

Limit time to ~t Limit the amount of track time to the specified total number of minutes.

Examples:
~t=60 returns 60 minutes of random music.

Limit percentage to ~% Limits by percentage of selection.

Examples:
~%=50 "Bob Dylan"
Returns 50% of all tracks with Bob Dylan in any field.

Sequence ~seq Assigns a monotonically increasing sequence number to the selected items.

Examples:
genre=rock ~sort=[Sequence] ~seq
Selects all tracks in the Rock genre, adds a sequence number from 1 to n (tracks in the genre), and sort by that sequence number.

Note: The equal sign ("=") between the ~n, ~d or ~t and the value is optional (e.g., ~n30 and ~n=30 are equivalent).

(Q: when are random items returned?)

Quoting, Grouping, Delimiters and Operators

( TBD: clarify this section; perhaps more should be merged with Modifiers above? )

Explanation Example
" " exact match & multi-word search "Bob Dylan" "Desolation Row"
( ) exact match & multi-word search "Bob Dylan" (1966 or 2001)

returns an exact match on Bob Dylan, AND an exact match on 1966 and another on 2001. ( ) are used as in a math equation. Example: r=4,5 (genre=rock or year=1970-1980) is much different from r=4,5 genre=rock or year=1970-1980.

[ " exact beginning

(don't forget the " at the end of entry)

[Stan"

returns everything beginning with "Stan". Stan Getz, Stand by Me, Standing in the Doorway

" ] exact ending

(don't forget the " at beginning of entry)

"stand]

returns everything that ends with "stand". Stand, I Will Stand, I Didn't Understand.

[ ] begins & ends exactly as indicated [Bob Dylan], [Desolation Row]

The results will exclude Bob Dylan & the Band because this entry does not end with Dylan.

, comma, delimits lists artist="Bob Dylan",[Sting],Merlin

This returns all tracks from these three artists. Do not insert spaces.

- exclude search term "Bob Dylan" -album=([time",[blood","mercy]) –year=1993

returns an exact match on Bob Dylan, except for albums beginning with "Time" and "Blood", ending with mercy, and excluding tracks from 1993.

and narrow the search "Bob Dylan" and "the Band"

Note: the "and" is assumed whenever you type in many words, so it is not necessary to include it.

or extend the search "Bob Dylan" or "Judy Collins"
< smaller than lastplayed=<60 returns tracks played in less than the past 60 minutes.
> greater than bitrate=>128 returns tracks with more than 128 bitrate, or

rating=>3 returns all tracks rated with 4 or 5.

Note: Quotation marks and brackets must go in pairs. For example, Metallica] is invalid; it must be either [Metallica] or "Metallica] ).

Note: When you have an = followed by a numeric value, the search looks for a substring, and so will return all items containing that number. Eg year=0 will return 0, 2000, 2001, 1990. If you want to search for an exact number, use two equal signs: year==0 which will return only those tracks with a year of 0.


Examples

Here are few examples of the kinds of rules you can create. Note: these examples are for typing the rules directly; you can use the Wizard for much simpler access to rules.

genre, bitrate, comment

[genre]=[opera] [bitrate]=[320] [comment]="Italian"
Result: Finds all opera files with a bitrate of 320 that include "Italian" in the comment field

duration, last played

[lastplayed]=<60m [duration]==>300
Result: Finds all tracks that are 5 minutes long or more (300 seconds), and that have played in the last hour (60 minutes)

playlist, last played, limit tracks

[playlist]="top 40 1983" [lastplayed]=10-30 ~n=10
Result: Finds 10 tracks tracks that are in the "Top 40 1983" playlist that were last played 10-30 minutes ago.

file size, artist

[size]=>7000 [artist]=[Bet*
Result: Find all files larger than 7000kbs (or 7MB) whose artist field begins with "Bet"

exclude, number of plays

[genre]=[alt* numberplays=>10 -[artist]=Sting,Beatles
Result: Find all genres that begin with "alt", and play all the tracks that have been played more than 10 times, but exclude tracks from Sting and from the Beatles. (Note: To manually type in an exclusion, as in this example, simply put a "-" before the rule.)

sort, rating, limit time

~sort=[Random] [Rating]=>=3 ~t=60
Result: Find 60 minutes worth of files rated 3 or higher and sort them randomly.

date imported

[dateimported]=<=7d
Result: Show all files imported in the past 7 days. Note: You can use y (year), d (days) h (hours) m (minute) or s (seconds).

mix

g=rock ~mix=100,50%,{[Rating]=>3},25%,{[Rating]=1,2},25%,{[Rating]=[]}
Result: play 100 rock tracks, 50% of which are rated 4 and 5, 25% of which are rated 1 and 2 and 25% unrated.
~mix=50,50%,{[Genre]=[Country Rock]},50%,{[Genre]=[Alternative Rock]}
Result: play 50 tracks, ½ of which are Country Rock, and ½ of which are Alternative Rock.

limit

[genre]=[rock] ~limit=7,-1,[album]
Result: play only 7 rock albums.
Explanation: for all rock, find only 7 albums, and play all (-1) tracks from that album.
The syntax for use with ~limit is:
~limit=LIMIT_TOTAL_KEYS,LIMIT_PER_KEY,KEY_FIELDS
This means: take a key field (e.g., album), limit the total of that field (7 albums, or –1 for unlimited), and of that total, limit again per field (2 tracks per album, or –1 for unlimited).
~limit=-1,1,[Artist] ~limit=-1,2,[Decade]
Result: plays 10 tracks, 2 from each of the decades (a custom field) and the same artist appears only once.
Explanation: The first limit: find unlimited artists (-1), and play only one track per artist (1). The second part means: find all decades (-1) and limit to 2 tracks per decade (2).
[genre]=[rock] ~limit=7,2,[album]
Result: From the rock genre, find 7 albums, and play only 2 tracks per album.
Explanation: for all rock, limit the total albums to 7, and limit those 7 albums to 2 tracks each.

Note: The length field is calculated in seconds. The lastplayed field is calculated in minutes: <20 means smaller than, or within the last 20 minutes, whereas >20 means greater than, thus before the last 20 minutes. Using 10-30 means between 10 and 30 minutes.