fragment 元素

[与本页关联的功能 (Windows 媒体播放器 SDK) 是一项旧版功能。 它已被 MediaPlayer 所取代。 MediaPlayer 已针对 Windows 10 和 Windows 11 进行了优化。 Microsoft 强烈建议新代码应尽可能地使用“MediaPlayer”,而不是“Windows 媒体播放器 SDK”。 如果可能,Microsoft 建议应重写使用旧 API 的现有代码,以尽可能地使用新的 API。]

fragment 元素指定从库中选择项的查询的一个条件。 条件由条件字符串指定。 条件字符串通常具有名称部分、条件部分和值部分。

<fragment
    name = "string"
>
</fragment>

属性

名称(必填)

条件字符串的一部分。 请参阅“备注”。

父/子元素

层次结构 元素
父级 filtersourceFilter
儿童 argument

备注

某些条件字符串具有元数据属性部分、条件部分和值部分。 例如,在条件字符串“Album Artist Is Joe”中,元数据属性部分为“Album Artist”,条件部分为“Is”,值部分为“Joe”。

示例:

<fragment name = "Album Artist">
    <argument name = "condition">Is</argument>
    <argument name = "value">Joe</argument>
</fragment>

对于此类型的条件字符串,下表显示了可能的元数据属性、可能的条件和可能的值:

元数据属性 可能的条件 可能值
ActorAlbum Artist
专辑标题
作者
Caption
Channel
编辑器
Conductor
内容提供商
Content Provider Genre
Contributing Artist
Copyright Text
导演
Episode
文件类型
流派
密钥
关键字
语言
Mood
Parental Rating
周期
创建器
提供程序
Publisher
Series
工作站名称
Subgenre
副标题
游戏
写入器
EqualsDoes Not Equal
Is
不是
包含
Does Not Contain
任意字符串值
Bit Rate (In kilobytes per second.) EqualsDoes Not Equal
Is
不是
包含
Does Not Contain
4864
96
128
160
192
256
300
500
750
1000
1500
3000
4500
6000
7500
Secondary Media Type EqualsDoes Not Equal
Is
不是
包含
Does Not Contain
Audio: NewsAudio: Talk Show
Audio: Audio Books
Audio: Audio Spoken Word
Video: News
Video: Talk Show
Video: Home Video
Video: Movie / Film
Video: TV show
Video: Corporate Video
Video: Music Video
File Size (in KB)Image height
图像宽度
Play Count : Afternoon Totals
Play Count : Evening Totals
Play Count : Morning Totals
Play Count : Night Totals
Play Count : Total Overall
Play Count : Total Weekday
Play Count : Total Weekend
Is Less ThanIs Greater Than
Is
不是
任意数字
Broadcast timeDate Encoded
Date Recorded
Date taken
发布年份
Is BeforeIs After
Is
不是
YesterdayLast week
上个月
6 个月
1 年
2 年
5 年
2000s
1990s
1980s
1970s
1960s
1950s
1940s
Date Added Is BeforeIs After
Is
不是
YesterdayLast week
上个月
6 个月
1 年
2 年
5 年
Date Last Played Older ThanMore Recent Than
Is
不是
YesterdayLast week
上个月
6 个月
1 年
2 年
5 年
Month taken Is BeforeIs More Recent Than
Is
不是
12
3
4
5
6
7
8
9
10
11
12
13
Year taken Is BeforeIs More Recent Than
Is
不是
Any year
Auto RatingMy Rating
Is At LeastIs No More Than
Is
不是
Unrated1 Star
2 星
3 星
4 星
5 星
Custom Field #1Custom Field #2
文件名
Key Fields
ContainsDoes Not Contain
任意字符串

某些条件字符串具有限制部分、数字部分和格式部分。 例如,在条件字符串“Limit Total Size To 3 Megabytes”中,限制部分为“Limit Total Size To”,数字部分为“3”,格式部分为“Megabytes”。

示例:

<fragment name = "Limit Total Size To">
  <argument name = "number">3</argument>
  <argument name = "format">Megabytes</argument>
</fragment>

对于此类型的条件字符串,下表显示了可能的限制和格式。

限制 可能的数字 可能的格式
Limit Total Size To 任意数字 Kilobytes, Megabytes, Gigabytes
Limit Total Duration To 任意数字 秒、分钟、小时、天

某些条件字符串具有限制部分和数字部分。 例如,在条件字符串“Limit Number of Items to 25”中,限制部分为“Limit Number of Items”,数字部分为“25”。

示例:

<fragment name = "Limit Number of Items">
    <argument name = "number">25</argument>
</fragment>

对于此类型的条件字符串,下表显示了唯一可能的限制。

限制 可能的数字
Limit Number Of Items 任意数字

某些条件字符串具有保护部分和条件部分。 例如,在条件字符串“Protection Is present”中,保护部分为“Protection”,条件部分为“Is”。

示例:

<fragment name = "Protection">
    <argument name = "condition">Is</argument>
</fragment>

对于此类型的条件字符串,下表显示了可能的条件。

保护部分 可能的条件
保护 Is
不是

有一种类型的 fragment 元素不包含条件字符串。 如果 fragment 元素的名称属性为“Randomize Playback Order”,则 fragment 元素不包含任何 argument 元素。 此 fragment 元素指示播放器按随机顺序播放列表。

示例:

<fragment name = "Randomize Playback Order">
</fragment>

某些条件字符串具有排序部分、值部分和条件部分。 例如,在条件字符串“Sort By Title Ascending order”中,排序部分为“Sort By”,值部分为“Title”,条件部分为“Ascending”。 请注意,在这种情况下,值部分是元数据属性。

示例:

<fragment name = "Sort By">
    <argument name = "value">Title</argument>
    <argument name = "condition">Ascending</argument>
</fragment>

对于此类型的条件字符串,下表显示了可能的值和条件。

排序部分 可能值 可能的条件
排序依据 GenreTitle
Date Added
Auto Rating
My Rating
Play Count : Total Overall
Play Count : Morning Totals
Play Count : Afternoon Totals
Play Count : Evening Totals
Play Count : Night Totals
Play Count : Total Weekday
Play Count : Total Weekend
Actor
副标题
工作站名称
频道
Broadcast time
导演
发布年份
写入器
创建器
Date Recorded
Date Encoded
比特率
保护
AscendingDescending
Random

使用 fragment 元素对播放列表进行排序时,必须对应用于要排序的媒体项类型的元数据属性进行排序。 例如,如果要对音乐项进行排序,则无法对 Actor(创作者)排序。 下表显示了可使用哪些元数据属性对哪些媒体类型进行排序。

媒体类型 可能的元数据属性
音乐 GenreTitle
Date Added
Auto Rating
My Rating
Play Count : Total Overall
Play Count : Morning Totals
Play Count :Afternoon Totals
Play Count :Evening Totals
Play Count :Night Totals
Play Count :Total Weekday
Play Count : Total Weekend
视频或电视 GenreActor
副标题
游戏
Date Added
Auto Rating
工作站名称
频道
Broadcast time
导演
发布年份
写入器
创建器
Date Recorded
Date Encoded
比特率
My Rating
保护
Play Count : Total Overall
Play Count : Morning Totals
Play Count : Afternoon Totals
Play Count : Evening Totals
Play Count : Night Totals
Play Count : Total Weekday
Play Count : Total Weekend
单选 TitleDate Added
比特率
照片 Title
其他 GenreTitle
Date Added
Auto Rating
My Rating
比特率
Play Count : Total Overall
Play Count : Morning Totals
Play Count : Afternoon Totals
Play Count : Evening Totals
Play Count : Night Totals
Play Count : Total Weekday
Play Count : Total Weekend

要求

要求
版本
Windows 媒体播放器 9 系列或更高版本

另请参阅

argument 元素

filter 元素

sourceFilter 元素

Windows 媒体播放列表元素参考