fcuking chrisnjgnhkj43
This commit is contained in:
parent
d3510680de
commit
ee7b8ceb24
|
@ -0,0 +1 @@
|
||||||
|
DEEZER_ARL=deezer_arl
|
|
@ -144,3 +144,4 @@ dist
|
||||||
# .nfs files are created when an open file is removed but is still being accessed
|
# .nfs files are created when an open file is removed but is still being accessed
|
||||||
.nfs*
|
.nfs*
|
||||||
|
|
||||||
|
data/**
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
"name": "deemix-web-frontend",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "a dumb frontend for just getting some got damned songs",
|
||||||
|
"main": "src/index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "http://git.oat.zone/oat/deemix-web-frontend.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"deemix",
|
||||||
|
"piracy"
|
||||||
|
],
|
||||||
|
"author": "oatmealine",
|
||||||
|
"license": "AGPL-3.0",
|
||||||
|
"dependencies": {
|
||||||
|
"deemix": "git+https://git.freezer.life/RemixDev/deemix-js",
|
||||||
|
"deezer-js": "^1.2.4",
|
||||||
|
"dotenv": "^10.0.0",
|
||||||
|
"express": "^4.17.1",
|
||||||
|
"express-ws": "^5.0.2",
|
||||||
|
"ws": "^8.2.3"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"bufferutil": "^4.0.5",
|
||||||
|
"utf-8-validate": "^5.0.7"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,242 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>deemix.oat.zone</title>
|
||||||
|
<meta name="viewport" content="width=device-width">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/axios@0.20.0/dist/axios.min.js"></script>
|
||||||
|
<script>
|
||||||
|
window.onload = () => {
|
||||||
|
const placeholders = [
|
||||||
|
'xilent - we are dust',
|
||||||
|
'joyryde - brave',
|
||||||
|
'phaseone - the risen ep',
|
||||||
|
'blanke & godlands - hellraiser',
|
||||||
|
'camellia - blackmagik blazing',
|
||||||
|
't+pazolite - without permission',
|
||||||
|
'the brig - vindicate',
|
||||||
|
'bossfight - next wave'
|
||||||
|
];
|
||||||
|
|
||||||
|
function download(url) {
|
||||||
|
console.log(url);
|
||||||
|
fetch(url)
|
||||||
|
.then(response => response.blob())
|
||||||
|
.then(blob => {
|
||||||
|
const link = document.createElement("a");
|
||||||
|
link.href = URL.createObjectURL(blob);
|
||||||
|
link.download = url.split('/').pop();
|
||||||
|
link.target = '_blank';
|
||||||
|
link.click();
|
||||||
|
})
|
||||||
|
.catch(console.error);
|
||||||
|
}
|
||||||
|
|
||||||
|
const search = document.getElementById('album-search');
|
||||||
|
search.setAttribute('placeholder', placeholders[Math.floor(Math.random() * placeholders.length)]);
|
||||||
|
search.addEventListener('change', async (e) => {
|
||||||
|
document.getElementById('progress-album').innerHTML = '';
|
||||||
|
document.getElementById('progress-bar-wrapper').innerHTML = '';
|
||||||
|
document.getElementById('albums').innerHTML = '<div class="lds-ring"><div></div><div></div><div></div><div></div></div>';
|
||||||
|
const d = await axios.get('http://localhost:4500/api/search', {params: {search: e.target.value}});
|
||||||
|
console.log(d);
|
||||||
|
document.getElementById('albums').innerHTML = d.data.map(d =>
|
||||||
|
`<div class="album" id="album-${d.id}"><span class="album-image-wrapper"><img class="album-image" width="128" height="128" src="https://e-cdns-images.dzcdn.net/images/cover/${d.cover}/128x128-000000-80-0-0.jpg"></span><span class="big">${d.title}</span><br><span class="small">by ${d.artist.name}</span><br><img class="album-download" width="48" height="48" src="https://img.icons8.com/material-sharp/48/000000/download--v1.png"></div>`
|
||||||
|
).join('<br>\n');
|
||||||
|
for (c of document.getElementById('albums').children) {
|
||||||
|
if (c.children[5]) {
|
||||||
|
let id = c.id.split('-')[1];
|
||||||
|
c.children[5].onclick = (a) => {
|
||||||
|
let coverArt
|
||||||
|
console.log(id);
|
||||||
|
document.getElementById('albums').innerHTML = '';
|
||||||
|
document.getElementById('progress-album').innerHTML = '<div class="lds-ring"><div></div><div></div><div></div><div></div></div>';
|
||||||
|
const ws = new WebSocket('ws://localhost:4500/api/album?id=' + id);
|
||||||
|
ws.onmessage = (m) => {
|
||||||
|
const d = JSON.parse(m.data);
|
||||||
|
console.log(d);
|
||||||
|
|
||||||
|
if (d.key === 'downloadInfo') {
|
||||||
|
document.getElementById('progress-album').innerHTML = `<div class="album" id="album-${d.data.data.id}"><span class="album-image-wrapper"><img class="album-image" width="128" height="128" src="${coverArt}"></span><span class="big">${d.data.data.title}</span><br><span class="small">by ${d.data.data.artist}</span><br><span class="small" id="progress-state">${d.data.state}</span></div>`;
|
||||||
|
} else if (d.key === 'updateQueue') {
|
||||||
|
if (d.data.progress) {
|
||||||
|
document.getElementById('progress-bar-wrapper').innerHTML = `<br><div id="progress-bar"><div id="progress-bar-inner" style="height:100%;width:${d.data.progress}%"></div></div>`
|
||||||
|
}
|
||||||
|
} else if (d.key === 'coverArt') {
|
||||||
|
console.log(d.data);
|
||||||
|
coverArt = d.data;
|
||||||
|
} else if (d.key === 'download') {
|
||||||
|
download('http://localhost:4500' + d.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #0a0a0f;
|
||||||
|
color: #fff;
|
||||||
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
margin: 5px;
|
||||||
|
width: 550px;
|
||||||
|
max-width: 98%;
|
||||||
|
padding: 15px;
|
||||||
|
font-size: x-large;
|
||||||
|
border: none;
|
||||||
|
background-color: #112;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 7px;
|
||||||
|
box-shadow: 0px 0px 15px #000;
|
||||||
|
border-bottom: 0rem solid rgb(131, 131, 243);
|
||||||
|
transition: 0.1s border-bottom ease-out, 0.1s background-color ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:focus, input:hover {
|
||||||
|
border-bottom: 0.25rem solid rgb(131, 131, 243);
|
||||||
|
background-color: #161626;
|
||||||
|
}
|
||||||
|
|
||||||
|
.album {
|
||||||
|
padding: 15px;
|
||||||
|
margin: 2px;
|
||||||
|
background-color: #161627;
|
||||||
|
font-size: large;
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow: 0px 0px 12px #000;
|
||||||
|
transition: 0.1s border-left ease-out, 0.1s background-color ease-in-out;
|
||||||
|
border-left: 0rem solid rgb(131, 131, 243);
|
||||||
|
height: 96px;
|
||||||
|
}
|
||||||
|
.album:hover {
|
||||||
|
border-left: 0.25rem solid rgb(131, 131, 243);
|
||||||
|
background-color: #181829;
|
||||||
|
}
|
||||||
|
.small {
|
||||||
|
font-size: medium;
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
.big {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
#albums {
|
||||||
|
margin-top: 20px;
|
||||||
|
width: 600px;
|
||||||
|
max-width: 98%;
|
||||||
|
}
|
||||||
|
#progress {
|
||||||
|
width: 600px;
|
||||||
|
max-width: 98%;
|
||||||
|
}
|
||||||
|
.album-image {
|
||||||
|
width: auto;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 0px solid rgb(131, 131, 243);
|
||||||
|
transition: 0.1s border ease-out, 0.1s box-shadow ease-out;
|
||||||
|
margin: none;
|
||||||
|
padding: none;
|
||||||
|
box-shadow: 0px 0px 0px #000;
|
||||||
|
}
|
||||||
|
.album:hover .album-image {
|
||||||
|
border: 2px solid rgb(131, 131, 243);
|
||||||
|
box-shadow: 0px 0px 30px #000;
|
||||||
|
}
|
||||||
|
.album-image-wrapper {
|
||||||
|
border: 2px solid rgba(0, 0, 0, 0);
|
||||||
|
transition: 0.1s border ease-out;
|
||||||
|
float: right;
|
||||||
|
max-height: 100%;
|
||||||
|
width: 96px;
|
||||||
|
padding: none;
|
||||||
|
margin: none;
|
||||||
|
}
|
||||||
|
.album:hover .album-image-wrapper {
|
||||||
|
border: 0px solid rgba(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
.album-download {
|
||||||
|
position: relative;
|
||||||
|
top: 20px;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: 0.1s filter ease-out;
|
||||||
|
filter: invert(100%);
|
||||||
|
}
|
||||||
|
.album-download:hover {
|
||||||
|
filter: invert(100%) sepia(100%) saturate(800%) brightness(70%) hue-rotate(180deg);
|
||||||
|
}
|
||||||
|
.lds-ring {
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
width: 80px;
|
||||||
|
height: 80px;
|
||||||
|
}
|
||||||
|
.lds-ring div {
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
width: 64px;
|
||||||
|
height: 64px;
|
||||||
|
margin: 8px;
|
||||||
|
border: 8px solid #fed;
|
||||||
|
border-radius: 50%;
|
||||||
|
animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
|
||||||
|
border-color: #fed transparent transparent transparent;
|
||||||
|
}
|
||||||
|
.lds-ring div:nth-child(1) {
|
||||||
|
animation-delay: -0.45s;
|
||||||
|
}
|
||||||
|
.lds-ring div:nth-child(2) {
|
||||||
|
animation-delay: -0.3s;
|
||||||
|
}
|
||||||
|
.lds-ring div:nth-child(3) {
|
||||||
|
animation-delay: -0.15s;
|
||||||
|
}
|
||||||
|
@keyframes lds-ring {
|
||||||
|
0% {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#progress-bar {
|
||||||
|
background-color: #161627;
|
||||||
|
border-radius: 10px;
|
||||||
|
width: 100%;
|
||||||
|
height: 12px;
|
||||||
|
}
|
||||||
|
#progress-bar-inner {
|
||||||
|
background-color: rgb(131, 131, 243);
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<span id="main">
|
||||||
|
<input type="search" id="album-search" name="q">
|
||||||
|
<div id="progress"><div id="progress-album"></div><div id="progress-bar-wrapper"></div></div>
|
||||||
|
<div id="albums"><div class="album"><span class="album-image-wrapper"><img class="album-image" src="https://e-cdns-images.dzcdn.net/images/cover/6a1d32f0417bb637ab690c6aa140abb5/128x128-000000-80-0-0.jpg" width="128" height="128"></span><span class="big">The Risen EP</span><br><span class="small">by Phaseone</span><br><img class="album-download" src="https://img.icons8.com/material-sharp/48/000000/download--v1.png" width="48" height="48"></div><br>
|
||||||
|
<div class="album"><span class="album-image-wrapper"><img class="album-image" src="https://e-cdns-images.dzcdn.net/images/cover/7305784fa30507f10c45814cc29acf07/128x128-000000-80-0-0.jpg" width="128" height="128"></span><span class="big">Scars EP</span><br><span class="small">by Dirtyphonics</span><br><img class="album-download" src="https://img.icons8.com/material-sharp/48/000000/download--v1.png" width="48" height="48"></div><br>
|
||||||
|
<div class="album"><span class="album-image-wrapper"><img class="album-image" src="https://e-cdns-images.dzcdn.net/images/cover/7caad9d265bd66ca9e9ea6bd6b163ac5/128x128-000000-80-0-0.jpg" width="128" height="128"></span><span class="big">Touching The Stars</span><br><span class="small">by Phaseone</span><br><img class="album-download" src="https://img.icons8.com/material-sharp/48/000000/download--v1.png" width="48" height="48"></div><br>
|
||||||
|
<div class="album"><span class="album-image-wrapper"><img class="album-image" src="https://e-cdns-images.dzcdn.net/images/cover/ded1430ebbecfc33e96a90e67624948e/128x128-000000-80-0-0.jpg" width="128" height="128"></span><span class="big">Dreamscape</span><br><span class="small">by Phaseone</span><br><img class="album-download" src="https://img.icons8.com/material-sharp/48/000000/download--v1.png" width="48" height="48"></div><br>
|
||||||
|
<div class="album"><span class="album-image-wrapper"><img class="album-image" src="https://e-cdns-images.dzcdn.net/images/cover/c955807762a467505ecd47fd1f93c0e8/128x128-000000-80-0-0.jpg" width="128" height="128"></span><span class="big">Crash & Burn</span><br><span class="small">by PhaseOne, Northlane</span><br><img class="album-download" src="https://img.icons8.com/material-sharp/48/000000/download--v1.png" width="48" height="48"></div><br>
|
||||||
|
<div class="album"><span class="album-image-wrapper"><img class="album-image" src="https://e-cdns-images.dzcdn.net/images/cover/db4667686d283fe1ac511de6e5a72eb0/128x128-000000-80-0-0.jpg" width="128" height="128"></span><span class="big">Double Up EP</span><br><span class="small">by In Hearts Wake</span><br><img class="album-download" src="https://img.icons8.com/material-sharp/48/000000/download--v1.png" width="48" height="48"></div><br>
|
||||||
|
<div class="album"><span class="album-image-wrapper"><img class="album-image" src="https://e-cdns-images.dzcdn.net/images/cover/5ebd20c93cb10ca88c56f3ab07ccba10/128x128-000000-80-0-0.jpg" width="128" height="128"></span><span class="big">Dead Line EP</span><br><span class="small">by Phaseone</span><br><img class="album-download" src="https://img.icons8.com/material-sharp/48/000000/download--v1.png" width="48" height="48"></div></div>
|
||||||
|
</span>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,98 @@
|
||||||
|
const express = require('express');
|
||||||
|
const deezer = require('deezer-js');
|
||||||
|
const deemix = require('deemix');
|
||||||
|
const path = require('path');
|
||||||
|
const { inspect } = require('util');
|
||||||
|
const ws = require('ws');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
const port = process.env.PORT || 4500;
|
||||||
|
|
||||||
|
require('dotenv').config();
|
||||||
|
|
||||||
|
const app = new express();
|
||||||
|
const expressWs = require('express-ws')(app);
|
||||||
|
const deezerInstance = new deezer.Deezer();
|
||||||
|
let deemixDownloader;
|
||||||
|
|
||||||
|
let deemixSettings = deemix.settings.DEFAULTS
|
||||||
|
deemixSettings.downloadLocation = path.join(process.cwd(), 'data/');
|
||||||
|
deemixSettings.maxBitrate = String(deezer.TrackFormats.FLAC);
|
||||||
|
deemixSettings.overwriteFile = deemix.settings.OverwriteOption.OVERWRITE;
|
||||||
|
|
||||||
|
app.use('/data', express.static('data', {extensions: ['flac', 'mp3']}));
|
||||||
|
app.get('/api/search', async (req, res) => {
|
||||||
|
if (!req.query.search) return res.sendStatus(400);
|
||||||
|
|
||||||
|
let s = await deezerInstance.api.search_album(req.query.search, {
|
||||||
|
strict: true,
|
||||||
|
limit: 7,
|
||||||
|
});
|
||||||
|
|
||||||
|
let format = s.data.map(s => {
|
||||||
|
return {
|
||||||
|
id: s.id,
|
||||||
|
title: s.title,
|
||||||
|
cover: s.md5_image,
|
||||||
|
artist: {
|
||||||
|
id: s.artist.id,
|
||||||
|
name: s.artist.name
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
res.send(format);
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
app.get('/api/album', async (req, res) => {
|
||||||
|
if (!req.query.id) return res.sendStatus(400);
|
||||||
|
let dlObj = await deemix.generateDownloadObject(deezerInstance, 'https://www.deezer.com/album/' + req.query.id, deezer.TrackFormats.FLAC);
|
||||||
|
deemixDownloader = new deemix.downloader.Downloader(deezerInstance, dlObj, deemixSettings, listener);
|
||||||
|
|
||||||
|
console.log(await deemixDownloader.start());
|
||||||
|
|
||||||
|
res.send('a');
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
|
app.get('/api/album', async (req, res) => {
|
||||||
|
console.log('get route', req.testing);
|
||||||
|
res.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
app.ws('/api/album', async (ws, req) => {
|
||||||
|
if (!req.query.id) return ws.close();
|
||||||
|
|
||||||
|
const listener = {
|
||||||
|
send(key, data) {
|
||||||
|
if (data.downloaded) {
|
||||||
|
ws.send(JSON.stringify({key: 'download', data: data.downloadPath.replace(process.cwd(), '')}));
|
||||||
|
setTimeout(() => {
|
||||||
|
fs.unlinkSync(data.downloadPath);
|
||||||
|
}, 1000 * 60 * 60 /* 1 hour */);
|
||||||
|
}
|
||||||
|
|
||||||
|
ws.send(JSON.stringify({key, data}));
|
||||||
|
console.log(`[${key}] ${inspect(data)}`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const album = await deezerInstance.api.get_album(req.query.id);
|
||||||
|
|
||||||
|
listener.send('coverArt', album.cover_medium);
|
||||||
|
|
||||||
|
let dlObj = await deemix.generateDownloadObject(deezerInstance, 'https://www.deezer.com/album/' + req.query.id, deezer.TrackFormats.FLAC);
|
||||||
|
deemixDownloader = new deemix.downloader.Downloader(deezerInstance, dlObj, deemixSettings, listener);
|
||||||
|
|
||||||
|
await deemixDownloader.start();
|
||||||
|
|
||||||
|
ws.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
deezerInstance.login_via_arl(process.env.DEEZER_ARL).then(() => {
|
||||||
|
console.log('logged into deezer');
|
||||||
|
app.listen(port, () => {
|
||||||
|
console.log('hosting on ' + port);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue