aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--player.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/player.js b/player.js
index d2326d5..43408aa 100644
--- a/player.js
+++ b/player.js
@@ -200,12 +200,21 @@
function downloadHistory() {
const historyArray = getHistory();
let element = document.createElement("a");
+ let playListData = '#EXTM3U';
+ historyArray.forEach((musicData) => {
+ playListData = `${playListData}
+
+#EXTINF:${(musicData.duration/60000).toFixed(2)}, ${musicData.title}
+https://retrowave.ru/${musicData.streamUrl}
+`;
+ });
+
element.setAttribute(
"href",
- "data:application/json;charset=utf-8," +
- encodeURIComponent(JSON.stringify(historyArray))
+ "data:audio/x-mpegurl;;charset=utf-8," +
+ encodeURIComponent(playListData)
);
- element.setAttribute("download", "history.json");
+ element.setAttribute("download", "retrowave_playlist.m3u");
element.style.display = "none";
document.body.appendChild(element);