2018-08-11 01:47:10 -04:00
|
|
|
<template>
|
|
|
|
<div>
|
2019-01-27 00:36:19 -05:00
|
|
|
<content-with-heading v-if="new_episodes.items.length > 0">
|
|
|
|
<template slot="heading-left">
|
|
|
|
<p class="title is-4">New episodes</p>
|
|
|
|
</template>
|
|
|
|
<template slot="content">
|
|
|
|
<list-item-track v-for="track in new_episodes.items" :key="track.id" :track="track" @click="play_track(track)">
|
|
|
|
<template slot="actions">
|
|
|
|
<a @click="open_track_dialog(track)">
|
|
|
|
<span class="icon has-text-dark"><i class="mdi mdi-dots-vertical mdi-18px"></i></span>
|
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
</list-item-track>
|
2019-01-29 11:50:47 -05:00
|
|
|
<modal-dialog-track :show="show_track_details_modal" :track="selected_track" @close="show_track_details_modal = false" @play_count_changed="reload_new_episodes" />
|
2019-01-27 00:36:19 -05:00
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
|
|
|
|
2018-08-11 01:47:10 -04:00
|
|
|
<content-with-heading>
|
|
|
|
<template slot="heading-left">
|
|
|
|
<p class="title is-4">Podcasts</p>
|
|
|
|
<p class="heading">{{ albums.total }} podcasts</p>
|
|
|
|
</template>
|
|
|
|
<template slot="content">
|
2018-12-16 03:17:43 -05:00
|
|
|
<list-item-album v-for="album in albums.items" :key="album.id" :album="album" :media_kind="'podcast'" @click="open_album(album)">
|
2018-12-15 03:56:09 -05:00
|
|
|
<template slot="actions">
|
2019-01-27 00:36:19 -05:00
|
|
|
<a @click="open_album_dialog(album)">
|
2018-12-15 03:56:09 -05:00
|
|
|
<span class="icon has-text-dark"><i class="mdi mdi-dots-vertical mdi-18px"></i></span>
|
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
</list-item-album>
|
2019-01-27 00:36:19 -05:00
|
|
|
<modal-dialog-album :show="show_album_details_modal" :album="selected_album" :media_kind="'podcast'" @close="show_album_details_modal = false" />
|
2018-08-11 01:47:10 -04:00
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { LoadDataBeforeEnterMixin } from './mixin'
|
|
|
|
import ContentWithHeading from '@/templates/ContentWithHeading'
|
2019-01-27 00:36:19 -05:00
|
|
|
import ListItemTrack from '@/components/ListItemTrack'
|
2018-08-11 01:47:10 -04:00
|
|
|
import ListItemAlbum from '@/components/ListItemAlbum'
|
2019-01-27 00:36:19 -05:00
|
|
|
import ModalDialogTrack from '@/components/ModalDialogTrack'
|
2018-12-15 03:56:09 -05:00
|
|
|
import ModalDialogAlbum from '@/components/ModalDialogAlbum'
|
2018-08-11 01:47:10 -04:00
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
|
|
|
const albumsData = {
|
|
|
|
load: function (to) {
|
2019-01-27 00:36:19 -05:00
|
|
|
return Promise.all([
|
|
|
|
webapi.library_podcasts(),
|
|
|
|
webapi.library_podcasts_new_episodes()
|
|
|
|
])
|
2018-08-11 01:47:10 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
set: function (vm, response) {
|
2019-01-27 00:36:19 -05:00
|
|
|
vm.albums = response[0].data
|
|
|
|
vm.new_episodes = response[1].data.tracks
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PagePodcasts',
|
|
|
|
mixins: [ LoadDataBeforeEnterMixin(albumsData) ],
|
2019-01-27 00:36:19 -05:00
|
|
|
components: { ContentWithHeading, ListItemTrack, ListItemAlbum, ModalDialogTrack, ModalDialogAlbum },
|
2018-08-11 01:47:10 -04:00
|
|
|
|
|
|
|
data () {
|
|
|
|
return {
|
2018-12-15 03:56:09 -05:00
|
|
|
albums: {},
|
2019-01-27 00:36:19 -05:00
|
|
|
new_episodes: { items: [] },
|
2018-12-15 03:56:09 -05:00
|
|
|
|
2019-01-27 00:36:19 -05:00
|
|
|
show_album_details_modal: false,
|
|
|
|
selected_album: {},
|
|
|
|
|
|
|
|
show_track_details_modal: false,
|
|
|
|
selected_track: {}
|
2018-12-15 03:56:09 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2018-12-16 03:17:43 -05:00
|
|
|
open_album: function (album) {
|
|
|
|
this.$router.push({ path: '/podcasts/' + album.id })
|
|
|
|
},
|
|
|
|
|
2019-01-27 00:36:19 -05:00
|
|
|
play_track: function (track) {
|
|
|
|
webapi.player_play_uri(track.uri, false)
|
|
|
|
},
|
|
|
|
|
|
|
|
open_track_dialog: function (track) {
|
|
|
|
this.selected_track = track
|
|
|
|
this.show_track_details_modal = true
|
|
|
|
},
|
|
|
|
|
|
|
|
open_album_dialog: function (album) {
|
2018-12-15 03:56:09 -05:00
|
|
|
this.selected_album = album
|
2019-01-27 00:36:19 -05:00
|
|
|
this.show_album_details_modal = true
|
2019-01-29 11:50:47 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
reload_new_episodes: function () {
|
|
|
|
webapi.library_podcasts_new_episodes().then(({ data }) => {
|
|
|
|
this.new_episodes = data.tracks
|
|
|
|
})
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
</style>
|