diff --git a/web-src/src/pages/PagePodcast.vue b/web-src/src/pages/PagePodcast.vue
index 7a2654db..9786924e 100644
--- a/web-src/src/pages/PagePodcast.vue
+++ b/web-src/src/pages/PagePodcast.vue
@@ -2,12 +2,6 @@
@@ -53,7 +47,19 @@
:media_kind="'podcast'"
:new_tracks="new_tracks"
@close="show_album_details_modal = false"
- @play_count_changed="reload_tracks" />
+ @play_count_changed="reload_tracks"
+ @remove_podcast="open_remove_podcast_dialog" />
+
+
+ Permanently remove this podcast from your library?
+ (This will also remove the RSS playlist {{ rss_playlist_to_remove.name }}.)
+
+
@@ -64,6 +70,7 @@ import ContentWithHeading from '@/templates/ContentWithHeading'
import ListItemTrack from '@/components/ListItemTrack'
import ModalDialogTrack from '@/components/ModalDialogTrack'
import ModalDialogAlbum from '@/components/ModalDialogAlbum'
+import ModalDialog from '@/components/ModalDialog'
import RangeSlider from 'vue-range-slider'
import webapi from '@/webapi'
@@ -84,7 +91,7 @@ const albumData = {
export default {
name: 'PagePodcast',
mixins: [LoadDataBeforeEnterMixin(albumData)],
- components: { ContentWithHeading, ListItemTrack, ModalDialogTrack, RangeSlider, ModalDialogAlbum },
+ components: { ContentWithHeading, ListItemTrack, ModalDialogTrack, RangeSlider, ModalDialogAlbum, ModalDialog },
data () {
return {
@@ -94,7 +101,10 @@ export default {
show_details_modal: false,
selected_track: {},
- show_album_details_modal: false
+ show_album_details_modal: false,
+
+ show_remove_podcast_modal: false,
+ rss_playlist_to_remove: {}
}
},
@@ -118,20 +128,25 @@ export default {
this.show_details_modal = true
},
- rss_unsubscribe: function () {
+ open_remove_podcast_dialog: function () {
+ this.show_album_details_modal = false
webapi.search({ type: 'playlist', query: this.album.name }).then(({ data }) => {
- var plids = [...new Set(data.playlists.items
- .filter(pl => pl.name === this.album.name)
- .map(pl => pl.id))]
+ var playlists = data.playlists.items.filter(pl => pl.name === this.album.name && pl.type === 'rss')
- if (plids.length === 1) {
- plids.forEach(pl => {
- webapi.library_playlist_delete(pl)
- })
- this.$router.push({ path: '/podcasts' })
- } else {
- this.$store.dispatch('add_notification', { text: 'Failed to delete playlist, unable to find unique plid', type: 'danger' })
+ if (playlists.length !== 1) {
+ this.$store.dispatch('add_notification', { text: 'Podcast cannot be removed. Probably it was not added as an RSS playlist.', type: 'danger' })
+ return
}
+
+ this.rss_playlist_to_remove = playlists[0]
+ this.show_remove_podcast_modal = true
+ })
+ },
+
+ remove_podcast: function () {
+ this.show_remove_podcast_modal = false
+ webapi.library_playlist_delete(this.rss_playlist_to_remove.id).then(() => {
+ this.$router.replace({ path: '/podcasts' })
})
},
diff --git a/web-src/src/pages/PagePodcasts.vue b/web-src/src/pages/PagePodcasts.vue
index 9915b58f..d0c166e8 100644
--- a/web-src/src/pages/PagePodcasts.vue
+++ b/web-src/src/pages/PagePodcasts.vue
@@ -59,7 +59,24 @@
-
+
+
+
+ Permanently remove this podcast from your library?
+ (This will also remove the RSS playlist {{ rss_playlist_to_remove.name }}.)
+
+
@@ -74,6 +91,7 @@ import ListItemAlbum from '@/components/ListItemAlbum'
import ModalDialogTrack from '@/components/ModalDialogTrack'
import ModalDialogAlbum from '@/components/ModalDialogAlbum'
import ModalDialogAddRss from '@/components/ModalDialogAddRss'
+import ModalDialog from '@/components/ModalDialog'
import RangeSlider from 'vue-range-slider'
import webapi from '@/webapi'
@@ -94,7 +112,7 @@ const albumsData = {
export default {
name: 'PagePodcasts',
mixins: [LoadDataBeforeEnterMixin(albumsData)],
- components: { ContentWithHeading, ListItemTrack, ListItemAlbum, ModalDialogTrack, ModalDialogAlbum, ModalDialogAddRss, RangeSlider },
+ components: { ContentWithHeading, ListItemTrack, ListItemAlbum, ModalDialogTrack, ModalDialogAlbum, ModalDialogAddRss, ModalDialog, RangeSlider },
data () {
return {
@@ -107,7 +125,10 @@ export default {
show_url_modal: false,
show_track_details_modal: false,
- selected_track: {}
+ selected_track: {},
+
+ show_remove_podcast_modal: false,
+ rss_playlist_to_remove: {}
}
},
@@ -141,6 +162,28 @@ export default {
this.show_url_modal = true
},
+ open_remove_podcast_dialog: function () {
+ this.show_album_details_modal = false
+ webapi.search({ type: 'playlist', query: this.selected_album.name }).then(({ data }) => {
+ var playlists = data.playlists.items.filter(pl => pl.name === this.selected_album.name && pl.type === 'rss')
+
+ if (playlists.length !== 1) {
+ this.$store.dispatch('add_notification', { text: 'Podcast cannot be removed. Probably it was not added as an RSS playlist.', type: 'danger' })
+ return
+ }
+
+ this.rss_playlist_to_remove = playlists[0]
+ this.show_remove_podcast_modal = true
+ })
+ },
+
+ remove_podcast: function () {
+ this.show_remove_podcast_modal = false
+ webapi.library_playlist_delete(this.rss_playlist_to_remove.id).then(() => {
+ this.reload_podcasts()
+ })
+ },
+
reload_new_episodes: function () {
webapi.library_podcasts_new_episodes().then(({ data }) => {
this.new_episodes = data.tracks