2018-12-15 09:56:09 +01:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<transition name="fade">
|
2022-02-19 06:39:14 +01:00
|
|
|
<div v-if="show" class="modal is-active">
|
|
|
|
<div class="modal-background" @click="$emit('close')" />
|
2018-12-15 09:56:09 +01:00
|
|
|
<div class="modal-content fd-modal-card">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-content">
|
2022-05-20 13:44:22 +02:00
|
|
|
<p class="title is-4" v-text="item.title" />
|
|
|
|
<p class="subtitle" v-text="item.artist" />
|
2018-12-15 09:56:09 +01:00
|
|
|
<div class="content is-small">
|
2023-12-09 21:35:51 +01:00
|
|
|
<p v-if="item.album">
|
2022-05-29 18:49:00 +02:00
|
|
|
<span
|
|
|
|
class="heading"
|
|
|
|
v-text="$t('dialog.queue-item.album')"
|
|
|
|
/>
|
|
|
|
<a
|
|
|
|
class="title is-6 has-text-link"
|
|
|
|
@click="open_album"
|
|
|
|
v-text="item.album"
|
|
|
|
/>
|
2018-12-15 09:56:09 +01:00
|
|
|
</p>
|
|
|
|
<p v-if="item.album_artist">
|
2022-05-29 18:49:00 +02:00
|
|
|
<span
|
|
|
|
class="heading"
|
|
|
|
v-text="$t('dialog.queue-item.album-artist')"
|
|
|
|
/>
|
|
|
|
<a
|
|
|
|
class="title is-6 has-text-link"
|
|
|
|
@click="open_album_artist"
|
|
|
|
v-text="item.album_artist"
|
|
|
|
/>
|
2018-12-15 09:56:09 +01:00
|
|
|
</p>
|
2018-12-16 12:32:10 +01:00
|
|
|
<p v-if="item.composer">
|
2022-05-29 18:49:00 +02:00
|
|
|
<span
|
|
|
|
class="heading"
|
|
|
|
v-text="$t('dialog.queue-item.composer')"
|
|
|
|
/>
|
2022-05-20 13:44:22 +02:00
|
|
|
<span class="title is-6" v-text="item.composer" />
|
2018-12-16 12:32:10 +01:00
|
|
|
</p>
|
2023-12-09 21:35:51 +01:00
|
|
|
<p v-if="item.year">
|
2022-05-20 13:44:22 +02:00
|
|
|
<span class="heading" v-text="$t('dialog.queue-item.year')" />
|
|
|
|
<span class="title is-6" v-text="item.year" />
|
2018-12-15 09:56:09 +01:00
|
|
|
</p>
|
2019-02-14 08:24:03 +01:00
|
|
|
<p v-if="item.genre">
|
2022-05-29 18:49:00 +02:00
|
|
|
<span
|
|
|
|
class="heading"
|
|
|
|
v-text="$t('dialog.queue-item.genre')"
|
|
|
|
/>
|
|
|
|
<a
|
|
|
|
class="title is-6 has-text-link"
|
|
|
|
@click="open_genre"
|
|
|
|
v-text="item.genre"
|
|
|
|
/>
|
2018-12-15 09:56:09 +01:00
|
|
|
</p>
|
2023-12-09 21:35:51 +01:00
|
|
|
<p v-if="item.disc_number">
|
2022-05-29 18:49:00 +02:00
|
|
|
<span
|
|
|
|
class="heading"
|
|
|
|
v-text="$t('dialog.queue-item.position')"
|
|
|
|
/>
|
|
|
|
<span
|
|
|
|
class="title is-6"
|
|
|
|
v-text="[item.disc_number, item.track_number].join(' / ')"
|
|
|
|
/>
|
2018-12-15 09:56:09 +01:00
|
|
|
</p>
|
2023-12-09 21:35:51 +01:00
|
|
|
<p v-if="item.length_ms">
|
2022-05-29 18:49:00 +02:00
|
|
|
<span
|
|
|
|
class="heading"
|
|
|
|
v-text="$t('dialog.queue-item.duration')"
|
|
|
|
/>
|
|
|
|
<span
|
|
|
|
class="title is-6"
|
|
|
|
v-text="$filters.durationInHours(item.length_ms)"
|
|
|
|
/>
|
2018-12-15 09:56:09 +01:00
|
|
|
</p>
|
|
|
|
<p>
|
2022-05-20 13:44:22 +02:00
|
|
|
<span class="heading" v-text="$t('dialog.queue-item.path')" />
|
|
|
|
<span class="title is-6" v-text="item.path" />
|
2018-12-15 09:56:09 +01:00
|
|
|
</p>
|
2019-02-22 13:20:48 +01:00
|
|
|
<p>
|
2022-05-20 13:44:22 +02:00
|
|
|
<span class="heading" v-text="$t('dialog.queue-item.type')" />
|
|
|
|
<span class="title is-6">
|
2022-05-29 18:49:00 +02:00
|
|
|
<span
|
2022-06-19 16:32:46 +02:00
|
|
|
v-text="
|
|
|
|
[
|
|
|
|
$t('media.kind.' + item.media_kind),
|
|
|
|
$t('data.kind.' + item.data_kind)
|
|
|
|
].join(' - ')
|
|
|
|
"
|
2022-05-29 18:49:00 +02:00
|
|
|
/>
|
2022-05-20 13:44:22 +02:00
|
|
|
</span>
|
2019-02-22 13:20:48 +01:00
|
|
|
</p>
|
2023-12-09 21:35:51 +01:00
|
|
|
<p v-if="item.samplerate">
|
2022-05-29 18:49:00 +02:00
|
|
|
<span
|
|
|
|
class="heading"
|
|
|
|
v-text="$t('dialog.queue-item.quality')"
|
|
|
|
/>
|
2020-06-30 09:31:50 +02:00
|
|
|
<span class="title is-6">
|
2022-05-20 13:44:22 +02:00
|
|
|
<span v-text="item.type" />
|
2022-05-29 18:49:00 +02:00
|
|
|
<span
|
|
|
|
v-if="item.samplerate"
|
|
|
|
v-text="
|
|
|
|
$t('dialog.queue-item.samplerate', {
|
|
|
|
rate: item.samplerate
|
|
|
|
})
|
|
|
|
"
|
|
|
|
/>
|
|
|
|
<span
|
|
|
|
v-if="item.channels"
|
|
|
|
v-text="
|
|
|
|
$t('dialog.queue-item.channels', {
|
|
|
|
channels: $filters.channels(item.channels)
|
|
|
|
})
|
|
|
|
"
|
|
|
|
/>
|
|
|
|
<span
|
|
|
|
v-if="item.bitrate"
|
|
|
|
v-text="
|
|
|
|
$t('dialog.queue-item.bitrate', { rate: item.bitrate })
|
|
|
|
"
|
|
|
|
/>
|
2020-06-30 09:31:50 +02:00
|
|
|
</span>
|
2019-06-04 22:13:35 +01:00
|
|
|
</p>
|
2018-12-15 09:56:09 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<footer class="card-footer">
|
|
|
|
<a class="card-footer-item has-text-dark" @click="remove">
|
2023-06-30 21:41:40 +02:00
|
|
|
<mdicon class="icon" name="delete" size="16" />
|
2022-05-29 18:49:00 +02:00
|
|
|
<span
|
|
|
|
class="is-size-7"
|
|
|
|
v-text="$t('dialog.queue-item.remove')"
|
|
|
|
/>
|
2018-12-15 09:56:09 +01:00
|
|
|
</a>
|
|
|
|
<a class="card-footer-item has-text-dark" @click="play">
|
2023-06-30 21:41:40 +02:00
|
|
|
<mdicon class="icon" name="play" size="16" />
|
2022-05-20 13:44:22 +02:00
|
|
|
<span class="is-size-7" v-text="$t('dialog.queue-item.play')" />
|
2018-12-15 09:56:09 +01:00
|
|
|
</a>
|
|
|
|
</footer>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-05-29 18:49:00 +02:00
|
|
|
<button
|
|
|
|
class="modal-close is-large"
|
|
|
|
aria-label="close"
|
|
|
|
@click="$emit('close')"
|
|
|
|
/>
|
2018-12-15 09:56:09 +01:00
|
|
|
</div>
|
|
|
|
</transition>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-02-22 13:20:48 +01:00
|
|
|
import SpotifyWebApi from 'spotify-web-api-js'
|
2023-07-10 20:43:10 +02:00
|
|
|
import webapi from '@/webapi'
|
2018-12-15 09:56:09 +01:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'ModalDialogQueueItem',
|
2024-02-27 17:18:58 +01:00
|
|
|
props: { show: Boolean, item: Object },
|
2022-02-19 07:05:59 +01:00
|
|
|
emits: ['close'],
|
2018-12-15 09:56:09 +01:00
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
data() {
|
2019-02-22 13:20:48 +01:00
|
|
|
return {
|
|
|
|
spotify_track: {}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
watch: {
|
|
|
|
item() {
|
|
|
|
if (this.item && this.item.data_kind === 'spotify') {
|
|
|
|
const spotifyApi = new SpotifyWebApi()
|
|
|
|
spotifyApi.setAccessToken(this.$store.state.spotify.webapi_token)
|
|
|
|
spotifyApi
|
|
|
|
.getTrack(this.item.path.slice(this.item.path.lastIndexOf(':') + 1))
|
|
|
|
.then((response) => {
|
|
|
|
this.spotify_track = response
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
this.spotify_track = {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-12-15 09:56:09 +01:00
|
|
|
methods: {
|
2023-06-07 21:25:54 +02:00
|
|
|
open_album() {
|
2023-12-09 21:35:51 +01:00
|
|
|
if (this.item.data_kind === 'spotify') {
|
|
|
|
this.$router.push({
|
|
|
|
name: 'music-spotify-album',
|
|
|
|
params: { id: this.spotify_track.album.id }
|
|
|
|
})
|
|
|
|
} else if (this.item.media_kind === 'podcast') {
|
2023-07-10 10:03:05 +02:00
|
|
|
this.$router.push({
|
|
|
|
name: 'podcast',
|
|
|
|
params: { id: this.item.album_id }
|
|
|
|
})
|
2023-07-24 19:51:00 +02:00
|
|
|
} else if (this.item.media_kind === 'audiobook') {
|
2023-07-10 09:52:52 +02:00
|
|
|
this.$router.push({
|
2023-07-10 20:08:35 +02:00
|
|
|
name: 'audiobooks-album',
|
2023-07-10 09:52:52 +02:00
|
|
|
params: { id: this.item.album_id }
|
|
|
|
})
|
2023-12-09 21:35:51 +01:00
|
|
|
} else if (this.item.media_kind === 'music') {
|
2023-07-10 20:43:10 +02:00
|
|
|
this.$router.push({
|
|
|
|
name: 'music-album',
|
|
|
|
params: { id: this.item.album_id }
|
|
|
|
})
|
2019-02-01 16:20:01 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
open_album_artist() {
|
2023-12-09 21:35:51 +01:00
|
|
|
if (this.item.data_kind === 'spotify') {
|
|
|
|
this.$router.push({
|
|
|
|
name: 'music-spotify-artist',
|
|
|
|
params: { id: this.spotify_track.artists[0].id }
|
|
|
|
})
|
|
|
|
} else if (
|
|
|
|
this.item.media_kind === 'music' ||
|
|
|
|
this.item.media_kind === 'podcast'
|
|
|
|
) {
|
|
|
|
this.$router.push({
|
|
|
|
name: 'music-artist',
|
|
|
|
params: { id: this.item.album_artist_id }
|
|
|
|
})
|
|
|
|
} else if (this.item.media_kind === 'audiobook') {
|
|
|
|
this.$router.push({
|
|
|
|
name: 'audiobooks-artist',
|
|
|
|
params: { id: this.item.album_artist_id }
|
|
|
|
})
|
|
|
|
}
|
2019-02-01 16:20:01 +00:00
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
open_genre() {
|
2023-07-10 20:54:52 +02:00
|
|
|
this.$router.push({
|
2023-07-24 19:51:00 +02:00
|
|
|
name: 'genre-albums',
|
|
|
|
params: { name: this.item.genre },
|
|
|
|
query: { media_kind: this.item.media_kind }
|
2023-07-10 20:54:52 +02:00
|
|
|
})
|
2023-12-09 22:02:11 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
play() {
|
|
|
|
this.$emit('close')
|
|
|
|
webapi.player_play({ item_id: this.item.id })
|
|
|
|
},
|
|
|
|
|
|
|
|
remove() {
|
|
|
|
this.$emit('close')
|
|
|
|
webapi.queue_remove(this.item.id)
|
2018-12-15 09:56:09 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<style></style>
|