Spaces:
Sleeping
Sleeping
Update index.js
Browse files
index.js
CHANGED
@@ -462,7 +462,7 @@ async function GetId(data) {
|
|
462 |
async function addAudioTags(media, title, artist, year, imagecover) {
|
463 |
try {
|
464 |
let audioBuffer = (typeof media === 'string') ? Buffer.from((await axios.get(media, { responseType: 'arraybuffer', maxContentLength: -1 })).data) : (media instanceof Buffer) ? media : (() => { throw new Error('Media harus berupa URL string atau Buffer.'); })();
|
465 |
-
const randomFilename =
|
466 |
const tmpFilePath = path.join(tempDir, randomFilename);
|
467 |
fs.writeFileSync(tmpFilePath, audioBuffer);
|
468 |
const tags = { title, artist, year };
|
@@ -545,4 +545,4 @@ app.get('/ytmp3', async (req, res) => {
|
|
545 |
|
546 |
app.listen(PORT, () => {
|
547 |
console.log(`Server is running on port https://localhost:${PORT}`);
|
548 |
-
});
|
|
|
462 |
async function addAudioTags(media, title, artist, year, imagecover) {
|
463 |
try {
|
464 |
let audioBuffer = (typeof media === 'string') ? Buffer.from((await axios.get(media, { responseType: 'arraybuffer', maxContentLength: -1 })).data) : (media instanceof Buffer) ? media : (() => { throw new Error('Media harus berupa URL string atau Buffer.'); })();
|
465 |
+
const randomFilename = generateRandomName(10) + '.mp3';
|
466 |
const tmpFilePath = path.join(tempDir, randomFilename);
|
467 |
fs.writeFileSync(tmpFilePath, audioBuffer);
|
468 |
const tags = { title, artist, year };
|
|
|
545 |
|
546 |
app.listen(PORT, () => {
|
547 |
console.log(`Server is running on port https://localhost:${PORT}`);
|
548 |
+
});
|