From 6c3eb2304d8d0993bc7849275c10d0d71f2e8f6b Mon Sep 17 00:00:00 2001 From: Bnyro Date: Thu, 21 Jul 2022 22:51:41 +0200 Subject: [PATCH] clone playlist from youtube --- src/components/PlaylistPage.vue | 27 +++++++++++++++++++++++++-- src/components/PreferencesPage.vue | 2 +- src/components/SearchResults.vue | 2 +- src/locales/en.json | 4 +++- src/main.js | 2 ++ 5 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/components/PlaylistPage.vue b/src/components/PlaylistPage.vue index d54d63da..4cddd1fe 100644 --- a/src/components/PlaylistPage.vue +++ b/src/components/PlaylistPage.vue @@ -2,7 +2,7 @@
-

+

@@ -15,7 +15,10 @@ @@ -59,6 +62,10 @@ export default { getRssUrl: _this => { return _this.authApiUrl() + "/rss/playlists/" + _this.$route.query.list; }, + isPipedPlaylist() { + // FIXME: this checks whether it's a YouTube or a Piped playlist + return this.$route.query.list.includes("-"); + }, }, mounted() { this.getPlaylistData(); @@ -109,6 +116,22 @@ export default { removeVideo(index) { this.playlist.relatedStreams.splice(index, 1); }, + async clonePlaylist() { + const playlistId = this.$route.query.list; + this.fetchJson(this.authApiUrl() + "/import/playlist", null, { + method: "POST", + headers: { + Authorization: this.getAuthToken(), + }, + body: JSON.stringify({ + playlistId: playlistId, + }), + }).then(resp => { + if (!resp.error) { + alert(this.$t("actions.clone_playlist_success")); + } else alert(resp.error); + }); + }, }, }; diff --git a/src/components/PreferencesPage.vue b/src/components/PreferencesPage.vue index 7dc68ae8..a797a2ff 100644 --- a/src/components/PreferencesPage.vue +++ b/src/components/PreferencesPage.vue @@ -244,7 +244,7 @@ class="input w-auto" type="password" /> - +

diff --git a/src/components/SearchResults.vue b/src/components/SearchResults.vue index 7cc1c08a..0e16f69a 100644 --- a/src/components/SearchResults.vue +++ b/src/components/SearchResults.vue @@ -1,5 +1,5 @@