local and radio
This commit is contained in:
parent
23038c99a2
commit
b976e330ca
14
bin/radio.js
Normal file
14
bin/radio.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
var player = require('play-sound')(opts = {})
|
||||||
|
// const { exec } = require("child_process");
|
||||||
|
|
||||||
|
async function playRadio(album) {
|
||||||
|
const localPlayList = album.split(":")
|
||||||
|
const stream = localPlayList[1] + ':' + localPlayList[2]
|
||||||
|
const audio = player.play(stream, { mplayer: ['-playlist'] }, function (err) {
|
||||||
|
if (err && !err.killed) throw err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
playRadio
|
||||||
|
}
|
@ -3,6 +3,7 @@ var _ = require('lodash')
|
|||||||
var fs = require('fs')
|
var fs = require('fs')
|
||||||
var rpn = require('request-promise-native')
|
var rpn = require('request-promise-native')
|
||||||
var localPlayFunctions = require('./bin/local')
|
var localPlayFunctions = require('./bin/local')
|
||||||
|
var radioPlayFunctions = require('./bin/radio')
|
||||||
|
|
||||||
var myArgs = process.argv.slice(2);
|
var myArgs = process.argv.slice(2);
|
||||||
|
|
||||||
@ -103,6 +104,9 @@ async function playFile() {
|
|||||||
if (album.includes('local:')) {
|
if (album.includes('local:')) {
|
||||||
console.log('local')
|
console.log('local')
|
||||||
await localPlayFunctions.playLocal(album)
|
await localPlayFunctions.playLocal(album)
|
||||||
|
} else if (album.includes('radio:')) {
|
||||||
|
console.log('radio')
|
||||||
|
await radioPlayFunctions.playRadio(album)
|
||||||
} else {
|
} else {
|
||||||
console.log('spotify')
|
console.log('spotify')
|
||||||
let response;
|
let response;
|
||||||
@ -139,7 +143,8 @@ async function playFile() {
|
|||||||
throw Error(`Request error: ${e}`);
|
throw Error(`Request error: ${e}`);
|
||||||
}
|
}
|
||||||
this.response = response;
|
this.response = response;
|
||||||
this.response.body = response.body }
|
this.response.body = response.body
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,8 @@ async function buildPage() {
|
|||||||
sid = `spotify:album:${id}`
|
sid = `spotify:album:${id}`
|
||||||
} else if (i.includes("/playlist/")) {
|
} else if (i.includes("/playlist/")) {
|
||||||
sid = `spotify:playlist:${id}`
|
sid = `spotify:playlist:${id}`
|
||||||
|
} else if (i.includes(".m3u")) {
|
||||||
|
sid = `radio:${id}`
|
||||||
} else if (i.includes("local:")) {
|
} else if (i.includes("local:")) {
|
||||||
sid = `${id}`
|
sid = `${id}`
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user