{{ album.track_count }} tracks
@@ -58,11 +62,7 @@ export default { }, play: function () { - webapi.queue_clear().then(() => - webapi.queue_add(this.album.uri).then(() => - webapi.player_play() - ) - ) + webapi.player_play_uri(this.album.uri, true) } } } diff --git a/web-src/src/pages/PageArtist.vue b/web-src/src/pages/PageArtist.vue index 1e651ec9..f6ac1b54 100644 --- a/web-src/src/pages/PageArtist.vue +++ b/web-src/src/pages/PageArtist.vue @@ -5,10 +5,7 @@ - - - - Play + Shuffle @@ -56,11 +53,7 @@ export default { }, play: function () { - webapi.queue_clear().then(() => - webapi.queue_add(this.albums.items.map(a => a.uri).join(',')).then(() => - webapi.player_play() - ) - ) + webapi.player_play_uri(this.albums.items.map(a => a.uri).join(','), true) } } } diff --git a/web-src/src/pages/PageAudiobook.vue b/web-src/src/pages/PageAudiobook.vue index c6499ff1..d54adf6a 100644 --- a/web-src/src/pages/PageAudiobook.vue +++ b/web-src/src/pages/PageAudiobook.vue @@ -53,11 +53,7 @@ export default { methods: { play: function () { - webapi.queue_clear().then(() => - webapi.queue_add(this.album.uri).then(() => - webapi.player_play() - ) - ) + webapi.player_play_uri(this.album.uri, false) } } } diff --git a/web-src/src/pages/PageGenre.vue b/web-src/src/pages/PageGenre.vue index 4335518f..aefda285 100644 --- a/web-src/src/pages/PageGenre.vue +++ b/web-src/src/pages/PageGenre.vue @@ -9,10 +9,7 @@ - - - - Play + Shuffle @@ -69,11 +66,7 @@ export default { methods: { play: function () { - webapi.queue_clear().then(() => - webapi.queue_add(this.genreAlbums.items.map(a => a.uri).join(',')).then(() => - webapi.player_play() - ) - ) + webapi.player_play_uri(this.genreAlbums.items.map(a => a.uri).join(','), true) } } } diff --git a/web-src/src/pages/PagePlaylist.vue b/web-src/src/pages/PagePlaylist.vue index 74ebb168..bdddadd4 100644 --- a/web-src/src/pages/PagePlaylist.vue +++ b/web-src/src/pages/PagePlaylist.vue @@ -5,10 +5,7 @@ - - - - Play + Shuffle @@ -52,11 +49,7 @@ export default { methods: { play: function () { - webapi.queue_clear().then(() => - webapi.queue_add(this.playlist.uri).then(() => - webapi.player_play() - ) - ) + webapi.player_play_uri(this.playlist.uri, true) } } } diff --git a/web-src/src/pages/PagePodcast.vue b/web-src/src/pages/PagePodcast.vue index f874ffce..d5b111a2 100644 --- a/web-src/src/pages/PagePodcast.vue +++ b/web-src/src/pages/PagePodcast.vue @@ -52,11 +52,7 @@ export default { methods: { play: function () { - webapi.queue_clear().then(() => - webapi.queue_add(this.album.uri).then(() => - webapi.player_play() - ) - ) + webapi.player_play_uri(this.album.uri, false) } } } diff --git a/web-src/src/pages/PageTracks.vue b/web-src/src/pages/PageTracks.vue index a27c416f..11eeacd8 100644 --- a/web-src/src/pages/PageTracks.vue +++ b/web-src/src/pages/PageTracks.vue @@ -6,10 +6,7 @@ - - - - Play + Shuffle @@ -59,11 +56,7 @@ export default { }, play: function () { - webapi.queue_clear().then(() => - webapi.queue_add(this.tracks.items.map(a => a.uri).join(',')).then(() => - webapi.player_play() - ) - ) + webapi.player_play_uri(this.tracks.items.map(a => a.uri).join(','), true) } } } diff --git a/web-src/src/pages/SpotifyPageAlbum.vue b/web-src/src/pages/SpotifyPageAlbum.vue index c60a8649..307cd98b 100644 --- a/web-src/src/pages/SpotifyPageAlbum.vue +++ b/web-src/src/pages/SpotifyPageAlbum.vue @@ -6,10 +6,7 @@ - - - - Play + Shuffle @@ -56,12 +53,8 @@ export default { }, play: function () { - webapi.queue_clear().then(() => - webapi.queue_add(this.album.uri).then(() => - webapi.player_play() - ) - ) this.show_details_modal = false + webapi.player_play_uri(this.album.uri, true) } } } diff --git a/web-src/src/pages/SpotifyPagePlaylist.vue b/web-src/src/pages/SpotifyPagePlaylist.vue index b83925e8..801656d0 100644 --- a/web-src/src/pages/SpotifyPagePlaylist.vue +++ b/web-src/src/pages/SpotifyPagePlaylist.vue @@ -5,10 +5,7 @@ - - - - Play + Shuffle @@ -84,12 +81,8 @@ export default { }, play: function () { - webapi.queue_clear().then(() => - webapi.queue_add(this.playlist.uri).then(() => - webapi.player_play() - ) - ) this.show_details_modal = false + webapi.player_play_uri(this.playlist.uri, true) } } } diff --git a/web-src/src/webapi/index.js b/web-src/src/webapi/index.js index a539e59d..eac00331 100644 --- a/web-src/src/webapi/index.js +++ b/web-src/src/webapi/index.js @@ -57,8 +57,18 @@ export default { return axios.get('/api/player') }, - player_play () { - return axios.put('/api/player/play') + player_play_uri (uris, shuffle, position = 0) { + return this.queue_clear().then(() => + this.player_shuffle(shuffle).then(() => + this.queue_add(uris).then(() => + this.player_play({ 'position': position }) + ) + ) + ) + }, + + player_play (options = {}) { + return axios.put('/api/player/play', undefined, { params: options }) }, player_playpos (position) {