media 11 query
TRANSCRIPT
-
7/30/2019 Media 11 Query
1/6
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////MediaCollection.getPlaylistByQueryThis is preliminary documentation and subject to change.//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
The getPlaylistByQuery method retrieves a Playlist object containing Media objects that match the query conditions.
Syntax
player.mediaCollection.getPlaylistByQuery(query,mediaType,sortAttribute,sortAscending
)
Parameters
query
Query object that defines the conditions used to create the playlist.
mediaType
String containing the media type. Must contain one of the following values: "audio", "video", "photo", "playlist", or "other".
sortAttribute
String containing the attribute name used for sorting. An empty string ("") means no sorting is applied.
sortAscending
Boolean, true indicating that the playlist must be sorted in ascending order.
Return Values
This method returns a Playlist object.
Remarks
Compound queries using Query are not case sensitive.
When the compound query specified by the query parameter contains a condition bu
ilt on the MediaType attribute, that condition is ignored. The value for the mediaType parameter is always used. For example, if the compound query contains thecondition "MediaType Equals audio" and the value for the mediaType parameter is"video", the resulting playlist will contain only video items.
Requirements
Version: Windows Media Player 11.
Library: Use wmp.dll.
-
7/30/2019 Media 11 Query
2/6
See Also
MediaCollection ObjectMediaType AttributeQuery ObjectPrevious Next
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////MediaCollection.getStringCollectionByQueryThis is preliminary documentation and subject to change.//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
The getStringCollectionByQuery method retrieves a StringCollection object containing all strings that match the query conditions.
Syntax
player.mediaCollection.getStringCollectionByQuery(attribute,query,
mediaType,sortAttribute,sortAscending
)
Parameters
attribute
String containing the attribute name.
query
Query object.
mediaType
String containing the media type. Must contain one of the following values: "audio", "video", "photo", "playlist", or "other".
sortAttribute
String containing the attribute name used for sorting. An empty string ("") means no sorting is applied.
sortAscending
Boolean, true indicating that the StringCollection must be sorted in ascending order.
Return Values
This method returns a StringCollection object.
Remarks
-
7/30/2019 Media 11 Query
3/6
Compound queries using Query are not case sensitive.
When the compound query specified by the query parameter contains a condition built on the MediaType attribute, that condition is ignored. The value for the mediaType parameter is always used. For example, if the compound query contains thecondition "MediaType Equals audio" and the value for the mediaType parameter is"video", the resulting playlist will contain only video items.
Requirements
Version: Windows Media Player 11.
Library: Use wmp.dll.
See Also
MediaCollection ObjectMediaType Attribute
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Query ObjectThis is preliminary documentation and subject to change.////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////
The Query object represents a compound query.
The Query object supports the following methods.
Method DescriptionaddCondition Adds a condition to the Query object using AND logic.beginNextGroup Begins a new condition group.
For purposes of illustration, player.mediaCollection.createQuery() is used to re
present the Query object in the reference syntax sections.
About the Query ObjectMediaCollection.createQueryMediaCollection.getPlaylistByQueryMediaCollection.getStringCollectionByQueryObject Model Reference for ScriptingQuery.addConditionThis is preliminary documentation and subject to change.
The addCondition method adds a condition to the Query object using AND logic.
Syntax
player.mediaCollection.createQuery().addCondition(attribute, operator, value)
Parameters
attribute
String containing the attribute name.
-
7/30/2019 Media 11 Query
4/6
operator
String containing the operator. See Remarks for supported values.
value
String containing the attribute value.
Return Values
This method does not return a value.
Remarks
Compound queries using Query are not case sensitive.
A list of values for the attribute parameter can be found in the Alphabetical Attribute Reference section.
Conditions contained in a Query object are organized into condition groups. Multiple conditions within a condition group are always concatenated using AND logic. Condition groups are always concatenated to each other using OR logic. To start a new condition group, call Query.beginNextGroup.
The following table lists the supported values for operator.
Operator Applies to-------- ------- --BeginsWith StringsContains StringsEquals All typesGreaterThan Numbers, DatesGreaterThanOrEquals Numbers, DatesLessThan Numbers, DatesLessThanOrEquals Numbers, Dates
NotEquals All types
Example Code
The following JScript example uses Query.addCondition and Query.beginNextGroup to perform an example query.
// Perform an example query for media for which:// The genre contains "jazz"// and the title begins with "a"// OR the genre contains "jazz"// and the author begins with "b".
// Create the query object.var Query = Player.mediaCollection.createQuery();
// Add the first condition group.Query.addCondition("WM/Genre", "Contains", "jazz");Query.addCondition("Title", "BeginsWith", "a");
// Begin the new condition group ("or").Query.beginNextGroup();
-
7/30/2019 Media 11 Query
5/6
// Add the second condition group.Query.addCondition("WM/Genre", "Contains", "jazz");Query.addCondition("Author", "BeginsWith", "b");
// Perform the query on "audio" media.var Playlist = Player.mediaCollection.getPlaylistByQuery(
Query, // query"audio", // mediaType"", // sortAttributefalse); // sortAscending
Requirements
Version: Windows Media Player 11.
Library: Use wmp.dll.
See Also
MediaCollection.createQueryMediaCollection.getPlaylistByQueryMediaCollection.getStringCollectionByQueryQuery Object
Query.beginNextGroup
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Query.beginNextGroupThis is preliminary documentation and subject to change.///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
The beginNextGroup method begins a new condition group.
Syntax
player.mediaCollection.createQuery().beginNextGroup()
Parameters
This method takes no parameters.
Return Values
This method does not return a value.
Remarks
Beginning a new condition group implies that you have completed the current condition group. The new condition group is always concatenated to the previous condition group using OR logic.
Requirements
Version: Windows Media Player 11.
Library: Use wmp.dll.
-
7/30/2019 Media 11 Query
6/6
See Also
MediaCollection.createQueryMediaCollection.getPlaylistByQueryMediaCollection.getStringCollectionByQueryQuery ObjectQuery.addCondition
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////MediaCollection.getByAttributeAndMediaTypeThis is preliminary documentation and subject to change.///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
The getByAttributeAndMediaType method retrieves a Playlist object containing Media objects having the specified attribute and media type.
Syntax
Player.mediaCollection.getByAttributeAndMediaType("genre", "", "Playlists")
Parameters
attribute
String containing the attribute.
value
String containing the value.
mediaType
String containing the media type. Must contain one of the following values: "aud
io", "video", "photo", "playlist", or "other".
Return Values
This method returns a Playlist object
Requirements
Version: Windows Media Player 11.
Library: Use wmp.dll.
See Also
Attribute ReferenceMediaCollection ObjectPlaylist Object