2018-08-11 01:47:10 -04:00
|
|
|
<template>
|
2020-04-18 00:57:55 -04:00
|
|
|
<section class="fd-is-fullheight" style="display: flex; flex-direction: column;">
|
|
|
|
<div class="" style="max-height: calc(100vh - 25rem); padding: 1.5rem; overflow: hidden; flex-grow: 1;flex-shrink: 1;" v-show="artwork_visible">
|
|
|
|
<img :src="artwork_url"
|
|
|
|
class="fd-has-action"
|
|
|
|
style="width: 100%;height: 100%;object-fit: contain;filter: drop-shadow(0px 0px 1px rgba(0,0,0,.3)) drop-shadow(0px 0px 10px rgba(0,0,0,.3));"
|
|
|
|
@load="artwork_loaded"
|
|
|
|
@error="artwork_error"
|
|
|
|
@click="open_dialog(now_playing)">
|
|
|
|
</div>
|
|
|
|
<div class="fd-has-padding-left-right">
|
|
|
|
<div class="container has-text-centered">
|
|
|
|
<p class="control has-text-centered fd-progress-now-playing">
|
|
|
|
<range-slider
|
|
|
|
class="seek-slider fd-has-action"
|
|
|
|
min="0"
|
|
|
|
:max="state.item_length_ms"
|
|
|
|
:value="item_progress_ms"
|
|
|
|
:disabled="state.state === 'stop'"
|
|
|
|
step="1000"
|
|
|
|
@change="seek" >
|
|
|
|
</range-slider>
|
|
|
|
</p>
|
|
|
|
<p class="content">
|
|
|
|
<span>{{ item_progress_ms | duration }} / {{ now_playing.length_ms | duration }}</span>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="fd-has-padding-left-right">
|
|
|
|
<div class="container has-text-centered fd-has-margin-top">
|
|
|
|
<h1 class="title is-5">
|
|
|
|
{{ now_playing.title }}
|
|
|
|
</h1>
|
|
|
|
<h2 class="title is-6">
|
|
|
|
{{ now_playing.artist }}
|
|
|
|
</h2>
|
|
|
|
<h2 class="subtitle is-6 has-text-grey has-text-weight-bold" v-if="composer">
|
|
|
|
{{ composer }}
|
|
|
|
</h2>
|
|
|
|
<h3 class="subtitle is-6">
|
|
|
|
{{ now_playing.album }}
|
|
|
|
</h3>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!--
|
2018-11-09 23:16:25 -05:00
|
|
|
<div class="hero-head fd-has-padding-left-right">
|
|
|
|
<div class="container has-text-centered fd-has-margin-top">
|
2020-04-18 00:57:55 -04:00
|
|
|
<h1 class="title is-5">
|
2018-08-11 01:47:10 -04:00
|
|
|
{{ now_playing.title }}
|
|
|
|
</h1>
|
2018-11-09 23:16:25 -05:00
|
|
|
<h2 class="title is-6">
|
2018-08-11 01:47:10 -04:00
|
|
|
{{ now_playing.artist }}
|
|
|
|
</h2>
|
2019-08-23 13:40:17 -04:00
|
|
|
<h2 class="subtitle is-6 has-text-grey has-text-weight-bold" v-if="composer">
|
|
|
|
{{ composer }}
|
|
|
|
</h2>
|
2018-11-09 23:16:25 -05:00
|
|
|
<h3 class="subtitle is-6">
|
2018-08-11 01:47:10 -04:00
|
|
|
{{ now_playing.album }}
|
|
|
|
</h3>
|
2018-11-09 23:16:25 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="hero-body fd-is-fullheight-body has-text-centered" v-show="artwork_visible">
|
2020-04-18 00:57:55 -04:00
|
|
|
<figure class="image is-square">
|
|
|
|
<img :src="artwork_url"
|
|
|
|
class="fd-has-shadow fd-image-fullheight fd-has-action"
|
|
|
|
style="width: auto; max-height: calc(100vh - 25rem); margin: 0 auto;"
|
|
|
|
@load="artwork_loaded"
|
|
|
|
@error="artwork_error"
|
|
|
|
@click="open_dialog(now_playing)">
|
|
|
|
</figure>
|
2018-12-16 03:53:57 -05:00
|
|
|
</div>
|
|
|
|
<div class="hero-body fd-is-fullheight-body has-text-centered" v-show="!artwork_visible">
|
2018-12-21 00:27:15 -05:00
|
|
|
<a @click="open_dialog(now_playing)" class="button is-white is-medium">
|
|
|
|
<span class="icon has-text-grey-light"><i class="mdi mdi-information-outline"></i></span>
|
2018-12-16 03:53:57 -05:00
|
|
|
</a>
|
2018-11-09 23:16:25 -05:00
|
|
|
</div>
|
|
|
|
<div class="hero-foot fd-has-padding-left-right">
|
|
|
|
<div class="container has-text-centered fd-has-margin-bottom">
|
2018-08-11 01:47:10 -04:00
|
|
|
<p class="control has-text-centered fd-progress-now-playing">
|
|
|
|
<range-slider
|
|
|
|
class="seek-slider fd-has-action"
|
|
|
|
min="0"
|
|
|
|
:max="state.item_length_ms"
|
|
|
|
:value="item_progress_ms"
|
|
|
|
:disabled="state.state === 'stop'"
|
|
|
|
step="1000"
|
|
|
|
@change="seek" >
|
|
|
|
</range-slider>
|
|
|
|
</p>
|
|
|
|
<p class="content">
|
|
|
|
<span>{{ item_progress_ms | duration }} / {{ now_playing.length_ms | duration }}</span>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-04-18 00:57:55 -04:00
|
|
|
-->
|
|
|
|
<modal-dialog-queue-item :show="show_details_modal" :item="selected_item" @close="show_details_modal = false" />
|
2018-08-11 01:47:10 -04:00
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2018-12-16 03:53:57 -05:00
|
|
|
import ModalDialogQueueItem from '@/components/ModalDialogQueueItem'
|
2018-08-11 01:47:10 -04:00
|
|
|
import RangeSlider from 'vue-range-slider'
|
|
|
|
import webapi from '@/webapi'
|
|
|
|
import * as types from '@/store/mutation_types'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PageNowPlaying',
|
2020-04-18 00:57:55 -04:00
|
|
|
components: { ModalDialogQueueItem, RangeSlider },
|
2018-08-11 01:47:10 -04:00
|
|
|
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
item_progress_ms: 0,
|
2018-11-09 23:16:25 -05:00
|
|
|
interval_id: 0,
|
2018-12-16 03:53:57 -05:00
|
|
|
artwork_visible: false,
|
|
|
|
|
|
|
|
show_details_modal: false,
|
|
|
|
selected_item: {}
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
created () {
|
|
|
|
this.item_progress_ms = this.state.item_progress_ms
|
|
|
|
webapi.player_status().then(({ data }) => {
|
|
|
|
this.$store.commit(types.UPDATE_PLAYER_STATUS, data)
|
|
|
|
if (this.state.state === 'play') {
|
|
|
|
this.interval_id = window.setInterval(this.tick, 1000)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
destroyed () {
|
|
|
|
if (this.interval_id > 0) {
|
|
|
|
window.clearTimeout(this.interval_id)
|
|
|
|
this.interval_id = 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
state () {
|
|
|
|
return this.$store.state.player
|
|
|
|
},
|
2019-08-23 13:40:17 -04:00
|
|
|
|
2018-08-11 01:47:10 -04:00
|
|
|
now_playing () {
|
|
|
|
return this.$store.getters.now_playing
|
2018-10-27 14:57:42 -04:00
|
|
|
},
|
2018-11-09 23:16:25 -05:00
|
|
|
|
|
|
|
artwork_url: function () {
|
2019-07-06 03:21:47 -04:00
|
|
|
return webapi.artwork_url_append_size_params(this.now_playing.artwork_url)
|
2019-08-23 13:40:17 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
settings_option_show_composer_now_playing () {
|
|
|
|
return this.$store.getters.settings_option_show_composer_now_playing
|
|
|
|
},
|
|
|
|
|
|
|
|
settings_option_show_composer_for_genre () {
|
|
|
|
return this.$store.getters.settings_option_show_composer_for_genre
|
|
|
|
},
|
|
|
|
|
|
|
|
composer () {
|
|
|
|
if (this.settings_option_show_composer_now_playing) {
|
|
|
|
if (!this.settings_option_show_composer_for_genre ||
|
|
|
|
(this.now_playing.genre &&
|
|
|
|
this.settings_option_show_composer_for_genre.toLowerCase()
|
|
|
|
.split(',')
|
|
|
|
.findIndex(elem => this.now_playing.genre.toLowerCase().indexOf(elem.trim()) >= 0) >= 0)) {
|
|
|
|
return this.now_playing.composer
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
tick: function () {
|
|
|
|
this.item_progress_ms += 1000
|
|
|
|
},
|
|
|
|
|
|
|
|
seek: function (newPosition) {
|
|
|
|
webapi.player_seek(newPosition).catch(() => {
|
|
|
|
this.item_progress_ms = this.state.item_progress_ms
|
|
|
|
})
|
2018-10-27 14:57:42 -04:00
|
|
|
},
|
|
|
|
|
2018-11-09 23:16:25 -05:00
|
|
|
artwork_loaded: function () {
|
|
|
|
this.artwork_visible = true
|
|
|
|
},
|
|
|
|
|
|
|
|
artwork_error: function () {
|
|
|
|
this.artwork_visible = false
|
2018-12-16 03:53:57 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
open_dialog: function (item) {
|
|
|
|
this.selected_item = item
|
|
|
|
this.show_details_modal = true
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
'state' () {
|
|
|
|
if (this.interval_id > 0) {
|
|
|
|
window.clearTimeout(this.interval_id)
|
|
|
|
this.interval_id = 0
|
|
|
|
}
|
|
|
|
this.item_progress_ms = this.state.item_progress_ms
|
|
|
|
if (this.state.state === 'play') {
|
|
|
|
this.interval_id = window.setInterval(this.tick, 1000)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
</style>
|