mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-24 05:03:17 -05:00
[web-src] Add links to Spotify artist/album in track details dialog
This commit is contained in:
parent
99e0cfe6bb
commit
5c5c3e4a47
@ -55,7 +55,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<span class="heading">Type</span>
|
<span class="heading">Type</span>
|
||||||
<span class="title is-6">{{ track.media_kind }} - {{ track.data_kind }}</span>
|
<span class="title is-6">{{ track.media_kind }} - {{ track.data_kind }} <span class="has-text-weight-normal" v-if="track.data_kind === 'spotify'">(<a @click="open_spotify_artist">artist</a>, <a @click="open_spotify_album">album</a>)</span></span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<span class="heading">Added at</span>
|
<span class="heading">Added at</span>
|
||||||
@ -88,6 +88,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import webapi from '@/webapi'
|
import webapi from '@/webapi'
|
||||||
|
import SpotifyWebApi from 'spotify-web-api-js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ModalDialogTrack',
|
name: 'ModalDialogTrack',
|
||||||
@ -96,6 +97,7 @@ export default {
|
|||||||
|
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
spotify_track: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -135,6 +137,16 @@ export default {
|
|||||||
this.$router.push({ name: 'Genre', params: { genre: this.track.genre } })
|
this.$router.push({ name: 'Genre', params: { genre: this.track.genre } })
|
||||||
},
|
},
|
||||||
|
|
||||||
|
open_spotify_artist: function () {
|
||||||
|
this.$emit('close')
|
||||||
|
this.$router.push({ path: '/music/spotify/artists/' + this.spotify_track.artists[0].id })
|
||||||
|
},
|
||||||
|
|
||||||
|
open_spotify_album: function () {
|
||||||
|
this.$emit('close')
|
||||||
|
this.$router.push({ path: '/music/spotify/albums/' + this.spotify_track.album.id })
|
||||||
|
},
|
||||||
|
|
||||||
mark_new: function () {
|
mark_new: function () {
|
||||||
webapi.library_track_update(this.track.id, { 'play_count': 'reset' }).then(() => {
|
webapi.library_track_update(this.track.id, { 'play_count': 'reset' }).then(() => {
|
||||||
this.$emit('play_count_changed')
|
this.$emit('play_count_changed')
|
||||||
@ -148,6 +160,20 @@ export default {
|
|||||||
this.$emit('close')
|
this.$emit('close')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
'track' () {
|
||||||
|
if (this.track && this.track.data_kind === 'spotify') {
|
||||||
|
const spotifyApi = new SpotifyWebApi()
|
||||||
|
spotifyApi.setAccessToken(this.$store.state.spotify.webapi_token)
|
||||||
|
spotifyApi.getTrack(this.track.path.slice(this.track.path.lastIndexOf(':') + 1)).then((response) => {
|
||||||
|
this.spotify_track = response
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.spotify_track = {}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user