MrC-temp: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(expression page done) |
||
(21 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
'''This is MrC's scratch space for work-in-progress Wiki pages.''' |
|||
'''Note:''' The Regex() page is now at its permanent home: [[Media_Center_expression_language#Regex.28....29:_Regular_expression_pattern_matching_and_capture|MC expression language page]] |
|||
'''Note:''' The |
: <span style="color: red">'''Note:'''</span> The Expression language page is complete and is now at its permanent home: [[ Media_Center_expression_language#Functions | Expression language functions]] |
||
: Note: The Smartlist and Search - Rules and Modifiers page is now at its permanent home: [[Smartlist_and_Search_-_Rules_and_Modifiers|Smartlist and Search - Rules and Modifiers]] |
|||
== This is MrC's working space for work-in-progress Wiki pages. == |
|||
: Note: The Regex() page is now at its permanent home: [[Media_Center_expression_language#Regex.28....29:_Regular_expression_pattern_matching_and_capture|MC expression language page]] |
|||
[ in progress, search and smartlist rules ] |
|||
: Note: The File Properties page is now at its permanent home: [[File_Properties_%28tags%29|File Properties (tags) page]] |
|||
---- |
|||
This section describes the syntax for constructing a search, or query. Before describing the search syntax and rules, it is helpful to have some basic understanding of how a query works in Media Center. Being at its core a database, the Media Center library maintains information (or properties) for each file that has been imported (e.g. audio tracks, image files, video files, etc.). |
|||
Caution: Debris Ahead... |
|||
Conceptually, when performing a query (and there are several places where queries are input), Media Center tests the entered search phrase against the relevant properties for each imported file to determine the list of files that match. It returns this list of matched files to, for example, display in a view, populate a smartlist or produce some other list. |
|||
---- |
|||
The basic idea is that of filtering. From the list of all imported files, queries reduce the list to only those that match the search phrase. Adding additional search terms typically further reduces (narrows) the resulting list of matching files. |
|||
... and more to come... |
|||
A simple query tests some value against the contents of a specified property, such as the name of an album, a date, or episode number. For example, the following search phrase: |
|||
:<span style="font-family: Consolas, monospace;">[Album]=Pina</span> |
|||
queries all files for the Album property that contain the exact sequence of (case-insensitive) letters ''pina''. Compound queries may be constructed by adding additional search terms, thus testing additional properties. Multiple search terms are combined by an implicit '''and''' operator. So it follows that the search phrase: |
|||
:<span style="font-family: Consolas, monospace;">[Name]=Midnight [Artist]=Thelonious</span> |
|||
queries all files whose Name contains ''Midnight'' and whose Artist contains ''Thelonious''. |
|||
Generally, any library field may be used in a query; see the Media Center [[File_Properties_%28tags%29|File Properties]] document for a list of the standard properties, and see Options > Library & Folders > Manage Library Fields for the complete list, including custom user fields. |
|||
The next few sections describe the available operators available to construct search queries from simple to complex. |
|||
== Comparison Operators == |
|||
The query language provides the standard comparison operators of equal-to, less-than, less-than/equal-to, greater-than and greater-than/equal-to. These allow defining a search term to compare a specified ''value'' against a given ''field'' (also called ''property''). |
|||
For date fields, values may include units such as '''d''', '''w''', '''y''', '''h''', '''m''' and '''s''' to indicate ''day'', ''week'', ''month'', ''year'', ''hour'', ''minute'', and ''second'' respectively. Floating point values may be used (e.g. .5w for 1/2 week). |
|||
{| border="0" |
|||
|- valign="top" |
|||
! width="120" | Operator |
|||
! align="left" | Description |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">''field'''''='''''value''</span> |
|||
| Equal to the specified ''value''. |
|||
Example: Return all files whose Artist field contains ''smith'' anywhere. |
|||
<span style="font-family: Consolas, monospace;"> |
|||
[Artist]=Smith |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">''field'''''=<'''''value'' |
|||
| Less than the specified ''value''. |
|||
Example: Return all files imported within the last 1/2 day (12 hours): |
|||
<span style="font-family: Consolas, monospace;"> |
|||
[Date Imported]=<.5d |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">''field'''''=<='''''value'' |
|||
| Less than or equal to the specified ''value''. |
|||
Example: Return all files that are rated less than or equal to 2: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
[Rating]=<=2 |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">''field'''''=>'''''value'' |
|||
| Greater than the specified ''value''. |
|||
Example: Return all files that are rated greater than 3: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
[Rating]=>3 |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">''field'''''=>='''''value'' |
|||
| Greater than or equal to the specified ''value''. |
|||
Example: Return all files whose bitrate is greater than or equal to 256kbps: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
[Bitrate]=>=256 |
|||
</span> |
|||
|} |
|||
Take note that the '''=''' character ''always'' follows a field name in comparison operations. In the case of ''equal to'', the equivalence operator is implicit. This can be best illustrated by comparing the following example comparisons operations on the [Date (year)] field: |
|||
:<span style="font-family: Consolas, monospace;">[Date (year)]'''='''1980</span> |
|||
:<span style="font-family: Consolas, monospace;">[Date (year)]'''='''<1980</span> |
|||
:<span style="font-family: Consolas, monospace;">[Date (year)]'''='''<=1980</span> |
|||
:<span style="font-family: Consolas, monospace;">[Date (year)]'''='''>1980</span> |
|||
:<span style="font-family: Consolas, monospace;">[Date (year)]'''='''>=1980</span> |
|||
== Quoting and Anchoring == |
|||
Certain characters are used by the Media Center query language (e.g. ''<space>'' as the separator for search terms). To use these characters, they need to be quoted. Additionally, by default, Media Center queries are free to search anywhere within a given property. The special constructs listed below provide a means to both quote and anchor search terms. |
|||
A pair of double quotes '''"''' '''"''' is used to include spaces or special characters in a search phrase. Replacing the opening quote with an opening bracket '''[''' will anchor the search to the beginning. Likewise, the closing quote may be replaced with a closing bracket ''']''' to anchor at the end. Replacing both quotes will fully anchor the search, requiring a full match from beginning to end. |
|||
{| border="0" |
|||
|- valign="top" |
|||
! width="120" | Quote/Anchor |
|||
! align="left" | Description |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''"'''''phrase'''''"'''</span> |
|||
| Double quotes are used to include spaces or special characters in the search ''phrase''. The ''phrase'' will match anywhere within a string. |
|||
Example: Match something that contains the string ''Steve Miller'': |
|||
<span style="font-family: Consolas, monospace;"> |
|||
"Steve Miller" |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''['''''phrase'''''"'''</span> |
|||
| Same as double quotes above, but forces the ''phrase'' to match only at the beginning of the string. |
|||
Example: Match something that starts with ''Stan'', such as ''Stan Getz'', ''Stand by Me'', but not ''One Standard Night'': |
|||
<span style="font-family: Consolas, monospace;"> |
|||
[Stan" |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''"'''''phrase''''']'''</span> |
|||
| Same as double quotes above, but forces the ''phrase'' to match only at the end of the string. |
|||
Example: Match something that ends with ''stand'', such as ''I Will Stand'', ''I Didn't Understand'', but not ''The Standards'': |
|||
<span style="font-family: Consolas, monospace;"> |
|||
"stand] |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''['''''phrase''''']'''</span> |
|||
|Same as double quotes above, but forces the ''phrase'' to match both at the beginning and end of the string. |
|||
Example: Match exactly ''Bob Dylan'' and exclude ''Bob Dylan & the Band'': |
|||
<span style="font-family: Consolas, monospace;"> |
|||
[Bob Dylan] |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''^'''''word''</span> |
|||
|Restricts matching to a full word. A word is broken by space, punctuation, etc. |
|||
Example: Match ''car'' as a full word, as in ''A Car for All'', but not ''Barcarolle''. |
|||
<span style="font-family: Consolas, monospace;"> |
|||
^car |
|||
</span> |
|||
|} |
|||
== Grouping and Combining == |
|||
Multiple search terms can be combined to form more complex queries. Queries are read and evaluated left to right. |
|||
{| border="0" |
|||
|- valign="top" |
|||
! width="120" | Grouping |
|||
! align="left" | Description |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">''s1'' '''and''' ''s2''</span> |
|||
| Narrows the results returned by requiring matches of both of the search terms ''s1'' and ''s2''. |
|||
Example: Return all files by artist ''Frank Sinatra'' and orchestra ''Tommy Dorsey'': |
|||
<span style="font-family: Consolas, monospace;"> |
|||
[Artist]="Frank Sinatra" and [Orchestra]="Tommy Dorsey" |
|||
</span> |
|||
Since the '''and''' operation is implicit between search terms, is it not required. The following search phrase is equivalent to that shown in the example above: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
[Artist]="Frank Sinatra" [Orchestra]="Tommy Dorsey" |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">''s1'' '''or''' ''s2''</span> |
|||
| Expands the results returned by accepting matches of either (or both) of the search terms ''s1'' or ''s2''. |
|||
Example: Return all files named ''Spying Glass'' or named ''Angel'': |
|||
<span style="font-family: Consolas, monospace;"> |
|||
[Name]=[Spying Glass] or [Name]=[Angel] |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''('''''s1 op s2''''')'''</span> |
|||
| Groups search terms to force precedence when using multiple search terms with the '''and''' and the '''or''' operators. |
|||
Example: Return all files whose artist is exactly ''Bob Dylan'' and whose year is either ''1966'' or ''2001'': |
|||
<span style="font-family: Consolas, monospace;"> |
|||
[Artist]=[Bob Dylan] ([Date (year)]=1966 or [Date (year)]=2001) |
|||
</span> |
|||
Note the distinction of the example above with the following example: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
[Artist]=[Bob Dylan] [Date (year)]=1966 or [Date (year)]=2001 |
|||
</span> |
|||
The first example uses grouping parenthesis to force the order of evaluation, and returns files from Bob Dylan as the artist, from the year 1966 or 2001. The second example, due to order of evaluation from left to right, returns files with Bob Dylan as the artist from the year 1966, and also returns all files with year 2001. |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">''val1''''','''''val2''</span> |
|||
| Combines two or more values into a list, identical to the '''or''' operator. No spaces are allowed between the comma(s) and the values. |
|||
Example: Return all files whose artist is any of ''Queen'', ''Heart'', or the ''Grateful Dead'': |
|||
<span style="font-family: Consolas, monospace;"> |
|||
artist=[Queen],[Heart],"Grateful Dead" |
|||
</span> |
|||
The search phrase in the example above is identical to the more cumbersome: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
([Artist]=[Queen] or [Artist]=[Heart] or [Artist]="Grateful Dead") |
|||
</span> |
|||
|} |
|||
== Negation == |
|||
{| border="0" |
|||
|- valign="top" |
|||
! width="120" | Negation |
|||
! align="left" | Description |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''-'''''field''</span> |
|||
| Inverts the sense of the comparison, returning those files whose ''field'' does not match the specified value. Usage is limited to the equality and comparison operators. |
|||
Example: Return all files whose track number is not 1: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
-[Track #]=1 |
|||
</span> |
|||
Example: Return all files whose track number is not greater than or equal to 3: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
-[Track #]=>=3 |
|||
</span> |
|||
Note that this equivalent to the more direct search phrase: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
[Track #]=<3 |
|||
</span> |
|||
Example: Return all files by artist ''Mark Isham'', except those whose album names begin with ''after'' or ''quiz'', or end with ''home'', and exclude files from ''1993'': |
|||
<span style="font-family: Consolas, monospace;"> |
|||
[Artist]="Mark Isham" -[Album]=[after",[quiz","home] -[Date (year)]=1993 |
|||
</span> |
|||
|} |
|||
== Search, Search Wizard and More == |
|||
The query language has grown over time, and there are several ways to express an identical query. Where '''Search''' tries to ''do what you mean'' (by searching most fields automatically and presenting a list of possible matches from which to choose), the translation into the '''Search Wizard''' often requires specifying a more specific or precise query. Also note that the '''Search Wizard''' tends to restructure queries, preferring the less ambiguous, but more pedantic form. This can result in some queries not translating accurately from Search into Search Wizard. For example, the loosely written three-term search query using the '''or''' operator |
|||
:<span style="font-family: Consolas, monospace;">[Artist]=[Queen] or [Artist]=[Heart] or [Artist]="Grateful Dead"</span> |
|||
will be incorrectly translated by Search Wizard into a three-term '''and''' operation |
|||
:<span style="font-family: Consolas, monospace;">[Artist]=[Queen] [Artist]=[Heart] [Artist]="Grateful Dead"</span> |
|||
instead of the correctly grouped search phrase |
|||
:<span style="font-family: Consolas, monospace;">([Artist]=[Queen] or [Artist]=[Heart] or [Artist]="Grateful Dead")</span> |
|||
Media Center [[File_Properties_%28tags%29#Predefined_Fields|file properties]] support search keywords, often abbreviations or alternate forms of the property name. These keywords can be used to specify searching a given field. For example, the '''[Date (year)]''' field can be specified either by using its full field name '''[Date (year)]''' or by using the '''year=''' search keyword. As mentioned above, when pushing a query from Search into the Search Wizard, search keywords are translated into the full field name form. This can be seen by entering a search keyword into Search, and then entering Search Wizard and using the Import/Export button to examine the full query. |
|||
This section describes some of subtleties and personalities of of the query language..... |
|||
XXXX compound properties [adf],[asfd] |
|||
XXXX rules and modifiers available in the Search bar, in the Build New Smartlist dialog box, and in View Scheme creation. |
|||
XXXX search and randomness |
|||
XXXX example: |
|||
[Rating]=4 ([Genre]=[Rock" or [Date (year)]=1970-1980) |
|||
is much different from |
|||
r=4,5 genre=rock or year=1970-1980. |
|||
XXXX RANGE OPERATOR bugs?<br/> |
|||
XXXX FAILS: [lastplayed]=10-30 |
|||
[last played]: h, d, w, y work, s, m fails; fractions are not working correctly (.6h-1h) |
|||
[Date Imported]=2d-3d |
|||
FAILS |
|||
XXXX lastplayed=<60 |
|||
XXXX [Last Played]=2-20 |
|||
XXXX |
|||
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. |
|||
== Modifiers == |
|||
Queries and results can be modified by using one or more of the following special modifiers. Some modifiers act globally on, or affect the context of, the query, while others operate on the results returned as the query is being processed from left-to-right. |
|||
XXXX: some complex queries may not be parsed correctly by search wizard? |
|||
Note: For single character modifiers (i.e. ~n, ~d, ~s and ~t), the '''=''' character between the modifier and the ''value'' is optional (e.g., '''~n30''' is equivalent to '''~n=30'''). |
|||
{| border="0" |
|||
|- valign="top" |
|||
! width="120" | Modifier |
|||
! align="left" | Description |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''~d='''''database''</span> |
|||
| Selects (limits) the Media Center '''database''' used in the query (e.g. Main, CD, Bad, Removed, etc.). More than one ''database'' may be specified by combining selectors. |
|||
; Database selectors |
|||
: a = All |
|||
: b = Bad (or corrupt files get placed here) [starting w/v16.0.164] |
|||
: c = CD (and DVDs) |
|||
: e = Explorer |
|||
: g = Guide (Television) [starting w/v15.0.160] |
|||
: i = Category Images |
|||
: m = Main |
|||
: r = Removed [starting w/v15.0.160] |
|||
: s = Store |
|||
: t = Temporary (Playing Now) |
|||
Example: Limit the query to the CD and Main databases: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
~d=cm |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''~dup='''''fields''</span> |
|||
| Returns a list of only duplicate files, where duplicates are determined by comparing the combined values in the specified ''fields'' list. Duplicate detection is based on matching values in fields, not by examining file content. |
|||
Example: Return a list of duplicate files by using the [Name] and [Artist] fields as the duplicate detectors: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
~dup=[Name],[Artist] |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''~nodup='''''fields''</span> |
|||
| Returns a list with duplicate files removed, where duplicates are determined by comparing the combined values in the specified ''fields'' list. Only one of any duplicate file is included in the list. Duplicate detection is based on matching values in fields, not by examining file content. |
|||
Example: Return a list of all files with duplicates removed, by using the [Genre] field as the duplicate detectors. The returned list include one random file from each genre. |
|||
<span style="font-family: Consolas, monospace;"> |
|||
~nodup=[Genre] |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''~fill'''</span> |
|||
| Returns a list of files to fill the specified device 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 the default or specified device to maximum capacity: |
|||
<span style="font-family: Consolas, monospace;">~fill</span> |
|||
<span style="font-family: Consolas, monospace;">~fill=[D:\]</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''~a'''</span> |
|||
| Expands the track list (if necessary) to include the remaining tracks from the album(s). |
|||
Example: Return all tracks containing the name ''Feliz Navidad'', and expand that list to include the remaining tracks in the album(s). If the track is on three albums, then all tracks from all three albums are returned. |
|||
<span style="font-family: Consolas, monospace;">[Name]="Feliz Navidad" ~a</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''~limit''' ''f''''','''''n''''','''''fields'' |
|||
</span> |
|||
| Limits the set of files to at most ''n'' files from each of at most ''f'' values from the combined ''fields''. This is easier explained with a simple example. From there, the general concept should be clearer. |
|||
Example: Limit the returned files, first by selecting at most 10 unique artists, and from each of those artists, return at most 2 files: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
:~limit=10,2,[Artist] |
|||
</span> |
|||
First 10 distinct artists will be randomly selected from the list of all possible artists, and then 2 random files from each of those artists will be selected and returned. If the limit cannot be satisfied (because there are too few artists, or too few files-per-artist), the available artists or files will be returned. In other words, these values are upper limits. |
|||
The value of '''-1''' is used to select ''all'' values, and can be used for either ''f'' or ''n''. |
|||
Example: Return all files from the ''Rock'' genre, but limit those results, first by randomly selecting at most 5 unique album / year pairs, and selecting all files from each of those albums: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
:[Genre]=Rock ~limit=5,-1,[Album],[Date (year)] |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''~n='''''num''</span> |
|||
| Limits to a maximum of ''num'' files. |
|||
Example: Return at most 20 randomly selected tracks: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
:~n=20 |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''~mix='''''n''''','''''s''</span> |
|||
| Creates a mix of ''n'' files, according to the rules set by one or more comma-separated mix specifiers ''s''. The format of each search specifier ''s'' is: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
:''val,{criteria}'' |
|||
</span> |
|||
and ''val'' is either a number (e.g. 15) or a percentage (e.g. 10%), and ''criteria'' is a standard search phrase. The overall mix syntax follows the form: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
:''~mix=n,val1,{criteria1},val2,{criteria2},...'' |
|||
</span> |
|||
The values ''val1'', ''val2'', ... should be either all percentages or all numeric, and should sum to either 100% or to the maximum number of tracks, respectively. Otherwise, the resulting mix proportions are not clearly defined. |
|||
Example: Selecting from all ''Rock'' tracks, return a 10-track mixture with a 60/40 percentage split between artists whose names contain Mark or Tom, respectively. |
|||
<span style="font-family: Consolas, monospace;"> |
|||
:[Genre]=Rock ~mix=10,60%,{[Artist]=Mark},40%,{[Artist]=Tom} |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''~s='''''num''</span> |
|||
| Limits the number of files such that the cumulative size does not exceed ''num'' megabytes. |
|||
Example: Return a random set of files totaling a maximum of 650MB. |
|||
<span style="font-family: Consolas, monospace;"> |
|||
:~s=650 |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''~sort='''''fields''</span> |
|||
| Sorts the list of files by the specified list of ''fields''. |
|||
Example: Sort the list of files first by date, and then by track number: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
:~sort=[Date],[Track #] |
|||
</span> |
|||
The special term '''[Random]''' is used to randomize the list of files. |
|||
Example: Randomize (shuffle) the list of files: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
:~sort=[Random] |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''~t='''''num''</span> |
|||
| Limits the cumulative track time to not exceed the ''num'' minutes. |
|||
Example: Limit the set of files to a maximum of 60 minutes: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
:~t=60 |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''~%='''''num''</span> |
|||
| Limits the set of files to a maximum of ''num'' percent of the total possible. |
|||
Example: Randomly select and return 50% of the files imported into Media Center within the last week: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
[Date Imported]=<1w ~%=50 |
|||
</span> |
|||
|- valign="top" |
|||
| align="center" | <span style="font-family: Consolas, monospace;">'''~seq'''</span> |
|||
| Assigns a monotonically increasing sequence number to the current set of files. This modifier is useful in a more complex query to return the sort order set earlier. |
|||
Example: Select all tracks imported in the past 4 weeks, and sort them in descending order by date imported, assign a sequence number to be used later, limit the number of tracks to two per album, and sort based on the sequence number assigned earlier: |
|||
<span style="font-family: Consolas, monospace;"> |
|||
[Date Imported]=<4w ~sort=[Date Imported]-d ~seq ~limit=-1,2,[Album] ~sort=[Sequence] |
|||
</span> |
|||
|} |
|||
== Keywords == |
|||
Keywords create selections. |
|||
Keywords also have abbreviations, which are customizable. Go to 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). |
|||
{| border="1" |
|||
|-valign="top" |
|||
!Name |
|||
!Keywords/Abbrev |
|||
!Example |
|||
|-valign="top" |
|||
|Album |
|||
|al=<br> |
|||
album= |
|||
|<code>al=[Highway 61"</code><br> |
|||
:''Find all albums that being with "Highway 61". |
|||
|-valign="top" |
|||
|Date |
|||
|d= |
|||
date= |
|||
|<code>date=<1y</code> |
|||
:''Less than 1 year ago |
|||
<code>date=>3m</code> |
|||
:''More than 3 months ago<br> |
|||
Use y (year), d (days) h (hours) m (minute) or s (seconds). |
|||
|-valign="top" |
|||
|Date (day) |
|||
|n/a |
|||
|<code>[Date (day)]=31</code> |
|||
|-valign="top" |
|||
|Date (month) |
|||
|n/a |
|||
|<code>[Date (month)]=May</code> |
|||
|-valign="top" |
|||
|Date (year) |
|||
|year= |
|||
|<code>year=1973</code> |
|||
<code>year==0</code> |
|||
:''Returns items without a year |
|||
|-valign="top" |
|||
|Date Created |
|||
|n/a |
|||
|<code>[Date created]=<1d</code> |
|||
:''Returns items created today |
|||
<code>[Date Created]=<30m</code> |
|||
:''Returns items created less than 30 minutes ago. |
|||
Use y (year), d (days) h (hours) m (minute) or s (seconds). |
|||
|-valign="top" |
|||
|Date Imported |
|||
|dateimported= |
|||
|<code>dateimported=<=6d</code> |
|||
:''Returns items imported in the past 6 days. |
|||
<code>dateimported=30h-60h</code> |
|||
:''Returns items imported between 30 and 60 hours ago. |
|||
<code>dateimported=<1y</code> |
|||
:''Returns items imported within the last year. |
|||
Use y (year), d (days) h (hours) m (minute) or s (seconds). |
|||
|-valign="top" |
|||
|Date Modified |
|||
|n/a |
|||
|<code>[Date Modified]=<30m</code> |
|||
:''Returns items modified less than 30 minutes ago. |
|||
Use y (year), d (days) h (hours) m (minute) or s (seconds). |
|||
|-valign="top" |
|||
|Duration |
|||
|length= |
|||
duration= |
|||
|<code>duration=300<br></code> |
|||
:''Returns all items whose duration is 300 seconds. |
|||
<code>length=>300</code> |
|||
:''Returns all items with a duration greater than 300 seconds. |
|||
|-valign="top" |
|||
|File Size |
|||
|size= |
|||
|<code>size=>7000</code> |
|||
:''Returns all files whose size is greater than 7000 kilobytes (size is in kilobytes). |
|||
|-valign="top" |
|||
|Filename (name) |
|||
| |
|||
|<code>[Filename (name)]="Train to Prague"</code> |
|||
Use quotes to protect spaces or special characters in the file name. |
|||
|-valign="top" |
|||
|Filename (path) |
|||
| |
|||
|<code>[Filename (path)]=photo</code> |
|||
<code>[Filename (path)]="C:\My Music"</code> |
|||
Use quotes to protect spaces or special characters in the file name. |
|||
|-valign="top" |
|||
|Height |
|||
|height= |
|||
|<code>height=>100</code> |
|||
:''Returns images whose height is greater than 100 pixels. |
|||
|-valign="top" |
|||
|Image File |
|||
|imagefile= |
|||
|<code>imagefile=adams</code> |
|||
:''Returns all images containing the word "adams" in its name. |
|||
<code>imagefile=[]</code> |
|||
:''Returns all files that have no images (i.e. image field is empty). |
|||
<code>-imagefile=[]</code> |
|||
:''Returns all files that have images (i.e. image field is not empty). |
|||
<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). |
|||
|-valign="top" |
|||
|Keywords |
|||
|keyword= or keywords= or kw= |
|||
|kw =poprock;1979;hits (values: semicolon delimited list) |
|||
|-valign="top" |
|||
|Last Played |
|||
|lastplayed= |
|||
|lastplayed=<24h (less than 24 hours)<br> |
|||
lastplayed=<30m (less than 30 minutes) <br> |
|||
You can use y (year), d (days) h (hours) m (minute) or s (seconds). |
|||
|-valign="top" |
|||
|Number of Plays |
|||
|numberplays= |
|||
|numberplays=>10 returns all files played more than 10 times |
|||
|-valign="top" |
|||
|People |
|||
|people= |
|||
|people=mom,dad,Mike displays all photos that are of one of these people |
|||
|-valign="top" |
|||
|Playlist |
|||
|playlist= or p= |
|||
|p="top 40 1996" |
|||
|-valign="top" |
|||
|Rating |
|||
|rating= or r= |
|||
|rating=3, or rating=5,4 |
|||
|-valign="top" |
|||
|Track # |
|||
|tracknumber= or t= |
|||
|t=4 returns all track numbers with 4 (4, 14, 24)<br> |
|||
t==4 returns only tracks which equal 4. |
|||
|-valign="top" |
|||
|Volume Name |
|||
|volume= |
|||
|volume="Music 29" (insert name of your CD) (see Note 1) |
|||
|} |
|||
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. |
|||
== Examples == |
|||
Here are few examples of the kinds of rules you can create. The rules can be copy/pasted into the Search box, and you can use the Search Wizard for more assistance in developing search rules. Note: some of the examples show variations of the same rule, illustrating the use of full field names or their (keyword) abbreviations. |
|||
'''Greatest Hits:''' |
|||
Return all files from album names containing ''Greatest Hits''. |
|||
<span style="font-family: Consolas, monospace;"> |
|||
::[album]="Greatest Hits" |
|||
</span> |
|||
<span style="font-family: Consolas, monospace;"> |
|||
::al="Greatest Hits" |
|||
</span> |
|||
'''Date Imported:''' |
|||
Return all files imported into Media Center in the past 7 days. |
|||
<span style="font-family: Consolas, monospace;"> |
|||
::[Date Imported]=<=7d |
|||
</span> |
|||
<span style="font-family: Consolas, monospace;"> |
|||
::dateimported=<=7d |
|||
</span> |
|||
'''Duration and Last Played:''' |
|||
Return all tracks that are greater than 5 minutes (300 seconds) in duration (aka length) that have played in the last 60 minutes, and sort the results by track length. |
|||
<span style="font-family: Consolas, monospace;"> |
|||
::[Duration]=>300 [Last Played]=<60m ~sort=[Duration] |
|||
</span> |
|||
<span style="font-family: Consolas, monospace;"> |
|||
::length=>300 lastplayed=<60m ~sort=length |
|||
</span> |
|||
'''File Type and Artist:''' |
|||
Return all mp3 files by artists whose names begin with ''Joe''. |
|||
<span style="font-family: Consolas, monospace;"> |
|||
::[File Type]=mp3 [Artist]=[Joe" |
|||
</span> |
|||
'''Genres:''' Return all files that are in either the genre Opera or Classical. |
|||
<span style="font-family: Consolas, monospace;"> |
|||
::[Genre]=[Opera] or [Genre]=[Classical] |
|||
</span> |
|||
<span style="font-family: Consolas, monospace;"> |
|||
::g=[Opera] or g=[Classical] |
|||
</span> |
|||
'''Genre, Number of Plays, Excluding Artists, Shuffle:''' |
|||
Return all files from genres beginning with ''Rock'', where the number of plays is less than 5, and the Artist is neither ''Sting'' nor ''Beatles'', and shuffle the results. |
|||
<span style="font-family: Consolas, monospace;"> |
|||
::[Genre]=[Rock" [Number Plays]=<5 -[Artist]=Sting,Beatles ~sort=[Random] |
|||
</span> |
|||
'''Playlist, Last Played, Limit Tracks:''' |
|||
Return 10 random files from the "Top 40 1983" playlist which were not played in the last 5 days. |
|||
<span style="font-family: Consolas, monospace;"> |
|||
::[Playlist]="Top 40 1983" [Last Played]=>5d ~n=10 |
|||
</span> |
|||
'''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. |
|||
'''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. |
|||
random year smartlist, 1930-1962 |
|||
[Media Type]=[Audio] [Date (year)]=1930-1963 ~limit=1,-1,[Year] ~sort=Random |
|||
[[category:Smartlist:Examples]] |
Latest revision as of 19:18, 26 August 2013
This is MrC's scratch space for work-in-progress Wiki pages.
- Note: The Expression language page is complete and is now at its permanent home: Expression language functions
- Note: The Smartlist and Search - Rules and Modifiers page is now at its permanent home: Smartlist and Search - Rules and Modifiers
- Note: The Regex() page is now at its permanent home: MC expression language page
- Note: The File Properties page is now at its permanent home: File Properties (tags) page
Caution: Debris Ahead...
... and more to come...