diff --git a/web-src/src/pages/PagePodcast.vue b/web-src/src/pages/PagePodcast.vue index 9786924e..e4fcb8af 100644 --- a/web-src/src/pages/PagePodcast.vue +++ b/web-src/src/pages/PagePodcast.vue @@ -130,15 +130,14 @@ export default { open_remove_podcast_dialog: function () { this.show_album_details_modal = false - webapi.search({ type: 'playlist', query: this.album.name }).then(({ data }) => { - var playlists = data.playlists.items.filter(pl => pl.name === this.album.name && pl.type === 'rss') - - if (playlists.length !== 1) { + webapi.library_track_playlists(this.tracks[0].id).then(({ data }) => { + const rssPlaylists = data.items.filter(pl => pl.type === 'rss') + if (rssPlaylists.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.rss_playlist_to_remove = rssPlaylists[0] this.show_remove_podcast_modal = true }) }, diff --git a/web-src/src/pages/PagePodcasts.vue b/web-src/src/pages/PagePodcasts.vue index 3d9f5109..f657cfa1 100644 --- a/web-src/src/pages/PagePodcasts.vue +++ b/web-src/src/pages/PagePodcasts.vue @@ -167,16 +167,17 @@ export default { 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') + webapi.library_album_tracks(this.selected_album.id, { limit: 1 }).then(({ data }) => { + webapi.library_track_playlists(data.items[0].id).then(({ data }) => { + const rssPlaylists = data.items.filter(pl => pl.type === 'rss') + if (rssPlaylists.length !== 1) { + this.$store.dispatch('add_notification', { text: 'Podcast cannot be removed. Probably it was not added as an RSS playlist.', type: 'danger' }) + return + } - 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 + this.rss_playlist_to_remove = rssPlaylists[0] + this.show_remove_podcast_modal = true + }) }) }, diff --git a/web-src/src/webapi/index.js b/web-src/src/webapi/index.js index e11a0774..cacdbff2 100644 --- a/web-src/src/webapi/index.js +++ b/web-src/src/webapi/index.js @@ -217,8 +217,10 @@ export default { return axios.get('/api/library/albums/' + albumId) }, - library_album_tracks (albumId) { - return axios.get('/api/library/albums/' + albumId + '/tracks') + library_album_tracks (albumId, filter = { limit: -1, offset: 0 }) { + return axios.get('/api/library/albums/' + albumId + '/tracks', { + params: filter + }) }, library_album_track_update (albumId, attributes) { @@ -319,6 +321,10 @@ export default { return axios.get('/api/library/tracks/' + trackId) }, + library_track_playlists (trackId) { + return axios.get('/api/library/tracks/' + trackId + '/playlists') + }, + library_track_update (trackId, attributes = {}) { return axios.put('/api/library/tracks/' + trackId, undefined, { params: attributes }) },