appendItem(String URI, [String type], [Object metadata])
Append an item to the page. This should be used to populate data when page.type == ‘directory’
URI - URI to be opened when the item is activated (clicked)
type - Type of the item
- directory - Directory that can be browsed
- file - Any type of file or unknown file format
- video - Video file
- audio - Audio track
- image - Image that can be displayed
- album - Collection of audio tracks
- station - Icecast/shoutcast music station (see di.fm plugin for example)
metadata - Additional information about the item
Depending on the type of item, different information will be visible:
- video : following properties are displayed
- title
- icon
- description
- duration
- rating
- year
- genre
- directory : following properties are displayed
- title
- icon
- item : following properties are displayed
- title
- description
- video : following properties are displayed
metadata visible
movian
显示使用的是 glw ui
,布局文件为 .view
,默认为 showtime/glwskins/flat
以 type:video
为例来说明显示
pages/video.view
中搜索 metadata
可以搜索到使用了
max: $self.media.metadata.duration;
caption: $self.media.metadata.title;
source: $self.media.metadata.icon;
因此 metadata
是携带数据给 UI
用于显示,部分数据是在默认结构中使用到的,这部分可以直接使用对应的 key
。
也可以进行扩展,同时使用自行设计的 UI,例如插件 somafm
page.options.createInt('childTilesX', 'Tiles by X', 6, 1, 10, 1, '', function(v) {
page.metadata.childTilesX = v;
}, true);
page.options.createInt('childTilesY', 'Tiles by Y', 2, 1, 4, 1, '', function(v) {
page.metadata.childTilesY = v;
}, true);
page.options.createBool('informationBar', 'Information Bar', 1, function(v) {
page.metadata.informationBar = v;
}, true);
在 view
中使用
.childTilesX = $page.model.metadata.childTilesX ?? 6;
.childTilesY = $page.model.metadata.childTilesY ?? 2;
metadata
沟通 js
和 ui