mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-11-26 23:47:25 +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
@ -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,13 @@ 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", "text/plain");
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -97,14 +97,7 @@ export default {
|
|||||||
subscriptions: subscriptions,
|
subscriptions: subscriptions,
|
||||||
});
|
});
|
||||||
|
|
||||||
var file = new Blob([json], { type: "application/json" });
|
this.download(json, "subscriptions.json", "application/json");
|
||||||
|
|
||||||
const elem = document.createElement("a");
|
|
||||||
|
|
||||||
elem.href = URL.createObjectURL(file);
|
|
||||||
elem.download = "subscriptions.json";
|
|
||||||
elem.click();
|
|
||||||
elem.remove();
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -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",
|
||||||
|
11
src/main.js
11
src/main.js
@ -220,6 +220,17 @@ const mixin = {
|
|||||||
const localSubscriptions = this.getLocalSubscriptions() ?? [];
|
const localSubscriptions = this.getLocalSubscriptions() ?? [];
|
||||||
return localSubscriptions.join(",");
|
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: {
|
computed: {
|
||||||
theme() {
|
theme() {
|
||||||
|
Loading…
Reference in New Issue
Block a user