mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-14 23:57:27 +00:00
Merge pull request #1273 from Bnyro/playlist
Export playlists as .txt to allow downloading the videos via yt-dlp
This commit is contained in:
commit
791a944d7d
4 changed files with 24 additions and 9 deletions
|
@ -18,6 +18,9 @@
|
|||
<button class="btn mr-1" v-if="authenticated && !isPipedPlaylist" @click="clonePlaylist">
|
||||
{{ $t("actions.clone_playlist") }}<font-awesome-icon class="ml-3" icon="clone" />
|
||||
</button>
|
||||
<button class="btn mr-1" @click="downloadPlaylistAsTxt">
|
||||
{{ $t("actions.download_as_txt") }}
|
||||
</button>
|
||||
<a class="btn" :href="getRssUrl">
|
||||
<font-awesome-icon icon="rss" />
|
||||
</a>
|
||||
|
@ -133,6 +136,13 @@ export default {
|
|||
} else alert(resp.error);
|
||||
});
|
||||
},
|
||||
downloadPlaylistAsTxt() {
|
||||
var data = "";
|
||||
this.playlist.relatedStreams.forEach(element => {
|
||||
data += "https://piped.kavin.rocks" + element.url + "\n";
|
||||
});
|
||||
this.download(data, this.playlist.name + ".txt", "text/plain");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -97,14 +97,7 @@ export default {
|
|||
subscriptions: subscriptions,
|
||||
});
|
||||
|
||||
var file = new Blob([json], { type: "application/json" });
|
||||
|
||||
const elem = document.createElement("a");
|
||||
|
||||
elem.href = URL.createObjectURL(file);
|
||||
elem.download = "subscriptions.json";
|
||||
elem.click();
|
||||
elem.remove();
|
||||
this.download(json, "subscriptions.json", "application/json");
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -88,7 +88,8 @@
|
|||
"different_auth_instance": "Use a different instance for authentication",
|
||||
"instance_auth_selection": "Autentication Instance Selection",
|
||||
"clone_playlist": "Clone Playlist",
|
||||
"clone_playlist_success": "Successfully cloned!"
|
||||
"clone_playlist_success": "Successfully cloned!",
|
||||
"download_as_txt": "Download as .txt"
|
||||
},
|
||||
"comment": {
|
||||
"pinned_by": "Pinned by",
|
||||
|
|
11
src/main.js
11
src/main.js
|
@ -220,6 +220,17 @@ const mixin = {
|
|||
const localSubscriptions = this.getLocalSubscriptions() ?? [];
|
||||
return localSubscriptions.join(",");
|
||||
},
|
||||
/* generate a temporary file and ask the user to download it */
|
||||
download(text, filename, type) {
|
||||
var file = new Blob([text], { type: type });
|
||||
|
||||
const elem = document.createElement("a");
|
||||
|
||||
elem.href = URL.createObjectURL(file);
|
||||
elem.download = filename;
|
||||
elem.click();
|
||||
elem.remove();
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
theme() {
|
||||
|
|
Loading…
Reference in a new issue