babel build
This commit is contained in:
parent
051f95fee7
commit
16def1ccab
7
.babelrc
7
.babelrc
@ -1,13 +1,14 @@
|
|||||||
{
|
{
|
||||||
"presets": [
|
"presets": [
|
||||||
"env",
|
"env",
|
||||||
"react",
|
|
||||||
"stage-0"
|
"stage-0"
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"transform-class-properties",
|
"transform-class-properties",
|
||||||
"transform-decorators",
|
"transform-decorators",
|
||||||
"transform-react-constant-elements",
|
["transform-runtime", {
|
||||||
"transform-react-inline-elements"
|
"polyfill": false,
|
||||||
|
"regenerator": true
|
||||||
|
}]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,7 @@
|
|||||||
*.db
|
*.db
|
||||||
*.bak
|
*.bak
|
||||||
|
tmp.*
|
||||||
values.json
|
values.json
|
||||||
/node_modules/
|
/node_modules/
|
||||||
|
/dist/
|
||||||
/package-lock.json
|
/package-lock.json
|
||||||
|
15
package.json
15
package.json
@ -3,16 +3,23 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "server.js",
|
"main": "server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"build": "babel src -d dist",
|
||||||
|
"start": "node dist/server.js",
|
||||||
|
"download": "node dist/download.js",
|
||||||
|
"populate": "node dist/dbpopulate.js"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"babel-core": "^6.26.3",
|
|
||||||
"babel-env": "^2.4.1",
|
|
||||||
"bluebird": "^3.5.2",
|
"bluebird": "^3.5.2",
|
||||||
"express": "^4.16.3",
|
"express": "^4.16.3",
|
||||||
"express-async-errors": "^3.0.0",
|
"express-async-errors": "^3.0.0",
|
||||||
"fs-extra": "^7.0.0",
|
"fs-extra": "^7.0.0",
|
||||||
"sqlite": "^3.0.0"
|
"sqlite": "^3.0.0",
|
||||||
|
"babel-plugin-transform-runtime": "^6.23.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"babel-core": "^6.26.3",
|
||||||
|
"babel-env": "^2.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ function getVideoInfo (arg) {
|
|||||||
function fetchVideo (data) {
|
function fetchVideo (data) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (data.acodec !== 'mp3' || data.vcodec !== 'none') {
|
if (data.acodec !== 'mp3' || data.vcodec !== 'none') {
|
||||||
let tempName = path.join(__dirname, `/tmp.yt.${data.id}.mp3`)
|
let tempName = path.join(process.cwd(), `/tmp.yt.${data.id}.mp3`)
|
||||||
let ffmpeg = spawn('ffmpeg', ['-hide_banner', '-i', data.url, '-codec:a', 'libmp3lame', '-q:a', 2, '-joint_stereo', 1, '-y', tempName])
|
let ffmpeg = spawn('ffmpeg', ['-hide_banner', '-i', data.url, '-codec:a', 'libmp3lame', '-q:a', 2, '-joint_stereo', 1, '-y', tempName])
|
||||||
|
|
||||||
ffmpeg.stdout.pipe(process.stderr)
|
ffmpeg.stdout.pipe(process.stderr)
|
5
dbpopulate.js → src/dbpopulate.js
Executable file → Normal file
5
dbpopulate.js → src/dbpopulate.js
Executable file → Normal file
@ -1,4 +1,3 @@
|
|||||||
#!/usr/bin/env babel-node
|
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import sqlite from 'sqlite'
|
import sqlite from 'sqlite'
|
||||||
@ -8,11 +7,11 @@ import readline from 'readline'
|
|||||||
import asn from './common/async'
|
import asn from './common/async'
|
||||||
import dl from './common/download'
|
import dl from './common/download'
|
||||||
|
|
||||||
const values = require(path.join(__dirname, 'values.json'))
|
const values = require(path.join(process.cwd(), 'values.json'))
|
||||||
const musicdir = path.resolve(values.directory)
|
const musicdir = path.resolve(values.directory)
|
||||||
|
|
||||||
const dbPromise = Promise.resolve()
|
const dbPromise = Promise.resolve()
|
||||||
.then(() => sqlite.open(path.join(__dirname, values.database), { Promise, cache: true }))
|
.then(() => sqlite.open(path.join(process.cwd(), values.database), { Promise, cache: true }))
|
||||||
.then(db => db.migrate())
|
.then(db => db.migrate())
|
||||||
|
|
||||||
// ffprobe -i <file> -show_entries format=duration -v quiet -of csv="p=0"
|
// ffprobe -i <file> -show_entries format=duration -v quiet -of csv="p=0"
|
3
download.js → src/download.js
Executable file → Normal file
3
download.js → src/download.js
Executable file → Normal file
@ -1,4 +1,3 @@
|
|||||||
#!/usr/bin/env babel-node
|
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
@ -8,7 +7,7 @@ import path from 'path'
|
|||||||
import asn from './common/async'
|
import asn from './common/async'
|
||||||
import dl from './common/download'
|
import dl from './common/download'
|
||||||
|
|
||||||
const values = require(path.join(__dirname, 'values.json'))
|
const values = require(path.join(process.cwd(), 'values.json'))
|
||||||
const musicdir = path.resolve(values.directory)
|
const musicdir = path.resolve(values.directory)
|
||||||
|
|
||||||
const rl = readline.createInterface({
|
const rl = readline.createInterface({
|
7
server.js → src/server.js
Executable file → Normal file
7
server.js → src/server.js
Executable file → Normal file
@ -1,4 +1,3 @@
|
|||||||
#!/usr/bin/env babel-node
|
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import sqlite from 'sqlite'
|
import sqlite from 'sqlite'
|
||||||
import Promise from 'bluebird'
|
import Promise from 'bluebird'
|
||||||
@ -6,11 +5,11 @@ import express from 'express'
|
|||||||
|
|
||||||
require('express-async-errors')
|
require('express-async-errors')
|
||||||
|
|
||||||
const values = require(path.join(__dirname, 'values.json'))
|
const values = require(path.join(process.cwd(), 'values.json'))
|
||||||
const tracksPerPage = 100
|
const tracksPerPage = 100
|
||||||
|
|
||||||
const dbPromise = Promise.resolve()
|
const dbPromise = Promise.resolve()
|
||||||
.then(() => sqlite.open(path.join(__dirname, values.database), { Promise, cache: true }))
|
.then(() => sqlite.open(path.join(process.cwd(), values.database), { Promise, cache: true }))
|
||||||
.then(db => db.migrate())
|
.then(db => db.migrate())
|
||||||
|
|
||||||
const app = express()
|
const app = express()
|
||||||
@ -151,7 +150,7 @@ router.use((err, req, res, next) => {
|
|||||||
|
|
||||||
app.use('/api', router)
|
app.use('/api', router)
|
||||||
app.use('/file/track', express.static(path.resolve(values.directory)))
|
app.use('/file/track', express.static(path.resolve(values.directory)))
|
||||||
app.use('/', express.static(path.join(__dirname, 'public')))
|
app.use('/', express.static(path.join(process.cwd(), 'public')))
|
||||||
|
|
||||||
app.listen(port, '127.0.0.1', function () {
|
app.listen(port, '127.0.0.1', function () {
|
||||||
console.log(`app running on port ${port}`)
|
console.log(`app running on port ${port}`)
|
Loading…
Reference in New Issue
Block a user