2018-08-11 07:47:10 +02:00
|
|
|
<template>
|
2023-06-23 22:23:32 +02:00
|
|
|
<div class="fd-page">
|
|
|
|
<content-with-heading>
|
|
|
|
<template #heading-left>
|
|
|
|
<div class="title is-4" v-text="album.name" />
|
|
|
|
</template>
|
|
|
|
<template #heading-right>
|
|
|
|
<div class="buttons is-centered">
|
|
|
|
<a
|
|
|
|
class="button is-small is-light is-rounded"
|
|
|
|
@click="show_details_modal = true"
|
|
|
|
>
|
2023-06-30 21:41:40 +02:00
|
|
|
<mdicon class="icon" name="dots-horizontal" size="16" />
|
2023-06-23 22:23:32 +02:00
|
|
|
</a>
|
|
|
|
<a class="button is-small is-dark is-rounded" @click="play">
|
2023-06-30 21:41:40 +02:00
|
|
|
<mdicon class="icon" name="play" size="16" />
|
2023-06-23 22:23:32 +02:00
|
|
|
<span v-text="$t('page.podcast.play')" />
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template #content>
|
|
|
|
<p
|
|
|
|
class="heading has-text-centered-mobile"
|
|
|
|
v-text="$t('page.podcast.track-count', { count: album.track_count })"
|
|
|
|
/>
|
|
|
|
<list-tracks
|
|
|
|
:tracks="tracks"
|
|
|
|
:show_progress="true"
|
|
|
|
@play-count-changed="reload_tracks"
|
|
|
|
/>
|
|
|
|
<modal-dialog-album
|
|
|
|
:show="show_details_modal"
|
|
|
|
:album="album"
|
|
|
|
:media_kind="'podcast'"
|
|
|
|
:new_tracks="new_tracks"
|
|
|
|
@close="show_details_modal = false"
|
|
|
|
@play-count-changed="reload_tracks"
|
|
|
|
@remove-podcast="open_remove_podcast_dialog"
|
|
|
|
/>
|
|
|
|
<modal-dialog
|
|
|
|
:show="show_remove_podcast_modal"
|
|
|
|
:title="$t('page.podcast.remove-podcast')"
|
|
|
|
:delete_action="$t('page.podcast.remove')"
|
|
|
|
@close="show_remove_podcast_modal = false"
|
|
|
|
@delete="remove_podcast"
|
2022-05-29 18:49:00 +02:00
|
|
|
>
|
2023-06-23 22:23:32 +02:00
|
|
|
<template #modal-content>
|
|
|
|
<p v-text="$t('page.podcast.remove-info-1')" />
|
|
|
|
<p class="is-size-7">
|
|
|
|
(<span v-text="$t('page.podcast.remove-info-2')" />
|
|
|
|
<b v-text="rss_playlist_to_remove.name" />)
|
|
|
|
</p>
|
|
|
|
</template>
|
|
|
|
</modal-dialog>
|
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
|
|
|
</div>
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-02-19 06:18:01 +01:00
|
|
|
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
|
2023-07-10 10:03:05 +02:00
|
|
|
import { GroupByList } from '@/lib/GroupByList'
|
2022-02-19 07:47:54 +01:00
|
|
|
import ListTracks from '@/components/ListTracks.vue'
|
2022-02-19 06:18:01 +01:00
|
|
|
import ModalDialog from '@/components/ModalDialog.vue'
|
2023-07-10 10:03:05 +02:00
|
|
|
import ModalDialogAlbum from '@/components/ModalDialogAlbum.vue'
|
2018-08-11 07:47:10 +02:00
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
2022-02-19 06:18:01 +01:00
|
|
|
const dataObject = {
|
2023-06-07 21:25:54 +02:00
|
|
|
load(to) {
|
2018-08-11 07:47:10 +02:00
|
|
|
return Promise.all([
|
2023-07-10 10:03:05 +02:00
|
|
|
webapi.library_album(to.params.id),
|
|
|
|
webapi.library_podcast_episodes(to.params.id)
|
2018-08-11 07:47:10 +02:00
|
|
|
])
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
set(vm, response) {
|
2018-08-11 07:47:10 +02:00
|
|
|
vm.album = response[0].data
|
2023-03-23 23:19:55 +01:00
|
|
|
vm.tracks = new GroupByList(response[1].data.tracks)
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PagePodcast',
|
2022-02-19 06:18:01 +01:00
|
|
|
components: {
|
|
|
|
ContentWithHeading,
|
2022-02-19 07:47:54 +01:00
|
|
|
ListTracks,
|
2023-07-10 10:03:05 +02:00
|
|
|
ModalDialog,
|
|
|
|
ModalDialogAlbum
|
2022-02-19 06:18:01 +01:00
|
|
|
},
|
2018-08-11 07:47:10 +02:00
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
|
dataObject.load(to).then((response) => {
|
|
|
|
next((vm) => dataObject.set(vm, response))
|
|
|
|
})
|
|
|
|
},
|
|
|
|
beforeRouteUpdate(to, from, next) {
|
|
|
|
const vm = this
|
|
|
|
dataObject.load(to).then((response) => {
|
|
|
|
dataObject.set(vm, response)
|
|
|
|
next()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
2018-08-11 07:47:10 +02:00
|
|
|
return {
|
|
|
|
album: {},
|
2023-03-23 23:19:55 +01:00
|
|
|
tracks: new GroupByList(),
|
2023-06-02 23:13:44 +02:00
|
|
|
show_details_modal: false,
|
2020-04-12 09:16:48 +02:00
|
|
|
show_remove_podcast_modal: false,
|
|
|
|
rss_playlist_to_remove: {}
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-04-12 07:29:07 +02:00
|
|
|
computed: {
|
2022-02-19 06:39:14 +01:00
|
|
|
new_tracks() {
|
2023-03-23 23:19:55 +01:00
|
|
|
return this.tracks.items.filter((track) => track.play_count === 0).length
|
2020-04-12 07:29:07 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-08-11 07:47:10 +02:00
|
|
|
methods: {
|
2023-06-07 21:25:54 +02:00
|
|
|
play() {
|
2018-11-06 21:44:01 +01:00
|
|
|
webapi.player_play_uri(this.album.uri, false)
|
2018-12-15 09:56:09 +01:00
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
open_remove_podcast_dialog() {
|
2023-06-03 18:52:17 +02:00
|
|
|
webapi
|
|
|
|
.library_track_playlists(this.tracks.items[0].id)
|
|
|
|
.then(({ data }) => {
|
|
|
|
this.rss_playlist_to_remove = data.items.filter(
|
|
|
|
(pl) => pl.type === 'rss'
|
|
|
|
)[0]
|
|
|
|
this.show_remove_podcast_modal = true
|
|
|
|
this.show_details_modal = false
|
|
|
|
})
|
2020-04-12 09:16:48 +02:00
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
remove_podcast() {
|
2020-04-12 09:16:48 +02:00
|
|
|
this.show_remove_podcast_modal = false
|
2022-02-19 06:39:14 +01:00
|
|
|
webapi
|
|
|
|
.library_playlist_delete(this.rss_playlist_to_remove.id)
|
|
|
|
.then(() => {
|
|
|
|
this.$router.replace({ path: '/podcasts' })
|
|
|
|
})
|
2020-02-21 20:21:08 +00:00
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
reload_tracks() {
|
2019-01-29 17:50:47 +01:00
|
|
|
webapi.library_podcast_episodes(this.album.id).then(({ data }) => {
|
2023-03-23 23:19:55 +01:00
|
|
|
this.tracks = new GroupByList(data.tracks)
|
2019-01-29 17:50:47 +01:00
|
|
|
})
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<style></style>
|