mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-30 18:43:17 +00:00
download playlists as txt
This commit is contained in:
parent
e0cf9e6182
commit
fa88624f8b
@ -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,22 @@ 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");
|
||||
},
|
||||
download(text, filename) {
|
||||
var element = document.createElement("a");
|
||||
element.setAttribute("href", "data:text/plain;charset=utf-8," + encodeURIComponent(text));
|
||||
element.setAttribute("download", filename);
|
||||
element.style.display = "none";
|
||||
document.body.appendChild(element);
|
||||
element.click();
|
||||
document.body.removeChild(element);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -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",
|
||||
|
@ -220,6 +220,15 @@ const mixin = {
|
||||
const localSubscriptions = this.getLocalSubscriptions();
|
||||
return localSubscriptions.join(",");
|
||||
},
|
||||
download(text, filename) {
|
||||
var element = document.createElement("a");
|
||||
element.setAttribute("href", "data:text/plain;charset=utf-8," + encodeURIComponent(text));
|
||||
element.setAttribute("download", filename);
|
||||
element.style.display = "none";
|
||||
document.body.appendChild(element);
|
||||
element.click();
|
||||
document.body.removeChild(element);
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
theme() {
|
||||
|
Loading…
Reference in New Issue
Block a user