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>
|
2020-02-21 15:21:08 -05:00
|
|
|
<template slot="heading-right">
|
|
|
|
<div class="buttons is-centered">
|
|
|
|
<a class="button is-small" @click="mark_all_played">
|
|
|
|
<span class="icon">
|
|
|
|
<i class="mdi mdi-pencil"></i>
|
|
|
|
</span>
|
|
|
|
<span>Mark All Played</span>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template slot="content">
|
2019-01-27 00:36:19 -05:00
|
|
|
<list-item-track v-for="track in new_episodes.items" :key="track.id" :track="track" @click="play_track(track)">
|
2019-01-31 05:42:40 -05:00
|
|
|
<template slot="progress">
|
|
|
|
<range-slider
|
|
|
|
class="track-progress"
|
|
|
|
min="0"
|
|
|
|
:max="track.length_ms"
|
|
|
|
step="1"
|
|
|
|
:disabled="true"
|
|
|
|
:value="track.seek_ms" >
|
|
|
|
</range-slider>
|
|
|
|
</template>
|
2019-01-27 00:36:19 -05:00
|
|
|
<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>
|
2020-02-21 15:21:08 -05:00
|
|
|
<template slot="heading-right">
|
|
|
|
<div class="buttons is-centered">
|
2020-04-12 03:37:32 -04:00
|
|
|
<a class="button is-small" @click="open_add_podcast_dialog">
|
2020-02-21 15:21:08 -05:00
|
|
|
<span class="icon">
|
|
|
|
<i class="mdi mdi-rss"></i>
|
|
|
|
</span>
|
2020-04-12 03:37:32 -04:00
|
|
|
<span>Add Podcast</span>
|
2020-02-21 15:21:08 -05:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</template>
|
2018-08-11 01:47:10 -04:00
|
|
|
<template slot="content">
|
2020-09-20 06:25:38 -04:00
|
|
|
<list-albums :albums="albums.items"
|
|
|
|
@play_count_changed="reload_new_episodes()"
|
|
|
|
@podcast-deleted="reload_podcasts()">
|
|
|
|
</list-albums>
|
2020-04-12 03:37:32 -04:00
|
|
|
<modal-dialog-add-rss
|
2020-09-20 06:25:38 -04:00
|
|
|
:show="show_url_modal"
|
|
|
|
@close="show_url_modal = false"
|
|
|
|
@podcast_added="reload_podcasts()" />
|
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'
|
2020-09-20 06:25:38 -04:00
|
|
|
import ListAlbums from '@/components/ListAlbums'
|
2019-01-27 00:36:19 -05:00
|
|
|
import ModalDialogTrack from '@/components/ModalDialogTrack'
|
2020-02-21 15:21:08 -05:00
|
|
|
import ModalDialogAddRss from '@/components/ModalDialogAddRss'
|
2019-01-31 05:42:40 -05:00
|
|
|
import RangeSlider from 'vue-range-slider'
|
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([
|
2020-06-30 04:24:11 -04:00
|
|
|
webapi.library_albums('podcast'),
|
2019-01-27 00:36:19 -05:00
|
|
|
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',
|
2020-04-11 13:43:53 -04:00
|
|
|
mixins: [LoadDataBeforeEnterMixin(albumsData)],
|
2020-09-20 06:25:38 -04:00
|
|
|
components: { ContentWithHeading, ListItemTrack, ListAlbums, ModalDialogTrack, ModalDialogAddRss, RangeSlider },
|
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
|
|
|
|
2020-02-21 15:21:08 -05:00
|
|
|
show_url_modal: false,
|
|
|
|
|
2019-01-27 00:36:19 -05:00
|
|
|
show_track_details_modal: false,
|
2020-09-20 06:25:38 -04:00
|
|
|
selected_track: {}
|
2018-12-15 03:56:09 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
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
|
|
|
|
},
|
|
|
|
|
2020-02-21 15:21:08 -05:00
|
|
|
mark_all_played: function () {
|
|
|
|
this.new_episodes.items.forEach(ep => {
|
2020-04-11 13:43:53 -04:00
|
|
|
webapi.library_track_update(ep.id, { play_count: 'increment' })
|
2020-02-21 15:21:08 -05:00
|
|
|
})
|
|
|
|
this.new_episodes.items = { }
|
|
|
|
},
|
|
|
|
|
2020-04-12 03:37:32 -04:00
|
|
|
open_add_podcast_dialog: function (item) {
|
2020-02-21 15:21:08 -05:00
|
|
|
this.show_url_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
|
|
|
|
})
|
2020-02-21 15:21:08 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
reload_podcasts: function () {
|
2020-06-30 04:24:11 -04:00
|
|
|
webapi.library_albums('podcast').then(({ data }) => {
|
2020-02-21 15:21:08 -05:00
|
|
|
this.albums = data
|
|
|
|
this.reload_new_episodes()
|
|
|
|
})
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
</style>
|