[web-src] Make use of extended queue/item/add endpoint

Should speed up starting playback from the web ui (reduces number of web 
api requests)
This commit is contained in:
chme
2019-02-22 13:20:04 +01:00
parent d931385886
commit df455ce069
6 changed files with 55 additions and 37 deletions

View File

@@ -39,23 +39,17 @@ export default {
methods: {
play: function () {
this.$emit('close')
webapi.search({ 'type': 'tracks', 'expression': 'path starts with "' + this.directory.path + '" order by path asc' }).then(({ data }) => {
webapi.player_play_uri(data.tracks.items.map(a => a.uri).join(','), false)
})
webapi.player_play_expression('path starts with "' + this.directory.path + '" order by path asc', false)
},
queue_add: function () {
this.$emit('close')
webapi.search({ 'type': 'tracks', 'expression': 'path starts with "' + this.directory.path + '" order by path asc' }).then(({ data }) => {
webapi.queue_add(data.tracks.items.map(a => a.uri).join(','))
})
webapi.queue_expression_add('path starts with "' + this.directory.path + '" order by path asc')
},
queue_add_next: function () {
this.$emit('close')
webapi.search({ 'type': 'tracks', 'expression': 'path starts with "' + this.directory.path + '" order by path asc' }).then(({ data }) => {
webapi.queue_add_next(data.tracks.items.map(a => a.uri).join(','))
})
webapi.queue_expression_add_next('path starts with "' + this.directory.path + '" order by path asc')
}
}
}

View File

@@ -39,23 +39,17 @@ export default {
methods: {
play: function () {
this.$emit('close')
webapi.library_genre_tracks(this.genre.name).then(({ data }) =>
webapi.player_play_uri(data.tracks.items.map(a => a.uri).join(','), false)
)
webapi.player_play_expression('genre is "' + this.genre.name + '" and media_kind is music', false)
},
queue_add: function () {
this.$emit('close')
webapi.library_genre_tracks(this.genre.name).then(({ data }) =>
webapi.queue_add(data.tracks.items.map(a => a.uri).join(','))
)
webapi.queue_expression_add('genre is "' + this.genre.name + '" and media_kind is music')
},
queue_add_next: function () {
this.$emit('close')
webapi.library_genre_tracks(this.genre.name).then(({ data }) =>
webapi.queue_add_next(data.tracks.items.map(a => a.uri).join(','))
)
webapi.queue_expression_add_next('genre is "' + this.genre.name + '" and media_kind is music')
},
open_genre: function () {