first release

This commit is contained in:
genio
2021-11-18 21:46:38 +01:00
parent 9ea28f281a
commit f0034c57d8
14 changed files with 182 additions and 62 deletions

View File

@@ -1,10 +1,17 @@
const { spawn } = require('child_process');
const logger = require('./logger');
const settings = require('../settings.json');
let settings;
try {
settings = require('../settings.json');
}
catch (e) {
console.warn("settings.json not found")
}
const download = (socket, url) => {
const ytldp = spawn('./lib/yt-dlp.exe',
['-o', `${settings.download_path}%(title)s.%(ext)s`, url]
['-o', `${settings.download_path || './downloads/'}%(title)s.%(ext)s`, url]
)
ytldp.stdout.on('data', data => {
@@ -27,12 +34,6 @@ const abortDownload = (socket) => {
logger('download', 'Aborted')
}
const kill = async () => {
return process.platform === 'win32' ?
spawn('taskkill', ['/IM', 'yt-dlp.exe', '/F', '/T']) :
spawn('killall', ['yt-dlp'])
}
module.exports = {
download: download,
abortDownload: abortDownload