mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-11-10 10:18:23 +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">
|
<button class="btn mr-1" v-if="authenticated && !isPipedPlaylist" @click="clonePlaylist">
|
||||||
{{ $t("actions.clone_playlist") }}<font-awesome-icon class="ml-3" icon="clone" />
|
{{ $t("actions.clone_playlist") }}<font-awesome-icon class="ml-3" icon="clone" />
|
||||||
</button>
|
</button>
|
||||||
|
<button class="btn mr-1" @click="downloadPlaylistAsTxt">
|
||||||
|
{{ $t("actions.download_as_txt") }}
|
||||||
|
</button>
|
||||||
<a class="btn" :href="getRssUrl">
|
<a class="btn" :href="getRssUrl">
|
||||||
<font-awesome-icon icon="rss" />
|
<font-awesome-icon icon="rss" />
|
||||||
</a>
|
</a>
|
||||||
@ -133,6 +136,22 @@ export default {
|
|||||||
} else alert(resp.error);
|
} 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>
|
</script>
|
||||||
|
@ -88,7 +88,8 @@
|
|||||||
"different_auth_instance": "Use a different instance for authentication",
|
"different_auth_instance": "Use a different instance for authentication",
|
||||||
"instance_auth_selection": "Autentication Instance Selection",
|
"instance_auth_selection": "Autentication Instance Selection",
|
||||||
"clone_playlist": "Clone Playlist",
|
"clone_playlist": "Clone Playlist",
|
||||||
"clone_playlist_success": "Successfully cloned!"
|
"clone_playlist_success": "Successfully cloned!",
|
||||||
|
"download_as_txt": "Download as .txt"
|
||||||
},
|
},
|
||||||
"comment": {
|
"comment": {
|
||||||
"pinned_by": "Pinned by",
|
"pinned_by": "Pinned by",
|
||||||
|
@ -220,6 +220,15 @@ const mixin = {
|
|||||||
const localSubscriptions = this.getLocalSubscriptions();
|
const localSubscriptions = this.getLocalSubscriptions();
|
||||||
return localSubscriptions.join(",");
|
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: {
|
computed: {
|
||||||
theme() {
|
theme() {
|
||||||
|
Loading…
Reference in New Issue
Block a user