mirror of
https://github.com/IrosTheBeggar/mStream.git
synced 2025-10-27 07:31:02 +00:00
Upgrraded howler + more transcoding stuff
This commit is contained in:
parent
ff7c88fcb9
commit
ef5fcffc0e
@ -6,8 +6,6 @@ exports.setup = function (mstream, program) {
|
||||
var dest = fe.join(__dirname, "ffmpeg");
|
||||
var platform = ffbinaries.detectPlatform();
|
||||
|
||||
console.log(platform);
|
||||
|
||||
ffbinaries.downloadFiles(
|
||||
["ffmpeg", "ffprobe"],
|
||||
{ platform: platform, quiet: true, destination: dest },
|
||||
@ -16,8 +14,6 @@ exports.setup = function (mstream, program) {
|
||||
console.log("err", err);
|
||||
console.log("data", data);
|
||||
|
||||
console.log();
|
||||
|
||||
var ffmpegPath = fe.join(
|
||||
dest,
|
||||
ffbinaries.getBinaryFilename("ffmpeg", platform)
|
||||
@ -33,8 +29,14 @@ exports.setup = function (mstream, program) {
|
||||
ffmpeg.setFfmpegPath(ffmpegPath);
|
||||
ffmpeg.setFfprobePath(ffprobePath);
|
||||
|
||||
mstream.get("/transcode", function (req, res) {
|
||||
ffmpeg("/Users/paulsori/f.flac")
|
||||
mstream.get("/transcode/*", function (req, res) {
|
||||
let pathInfo = program.getVPathInfo(req.params[0]);
|
||||
if (pathInfo === false) {
|
||||
res.json({ "success": false });
|
||||
return;
|
||||
}
|
||||
|
||||
ffmpeg(pathInfo.fullPath)
|
||||
.noVideo()
|
||||
.format('mp3')
|
||||
.audioBitrate('128k')
|
||||
@ -48,7 +50,6 @@ exports.setup = function (mstream, program) {
|
||||
// save to stream
|
||||
.pipe(res, { end: true });
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
@ -63,6 +63,8 @@ exports.serveit = function (program, callback) {
|
||||
|
||||
// This is a convenience function. It gets the vPath from any url string
|
||||
program.getVPathInfo = function (url) {
|
||||
// TODO: Verify user has access to this vpath
|
||||
|
||||
// remove leading slashes
|
||||
if (url.charAt(0) === '/') {
|
||||
url = url.substr(1);
|
||||
|
||||
@ -125,7 +125,6 @@ var MSTREAMAPI = (function () {
|
||||
makePOSTRequest("/lastfm/scrobble-by-metadata", { artist: artist, album: album, track: trackName }, callback);
|
||||
}
|
||||
|
||||
|
||||
// LOGIN
|
||||
mstreamModule.login = function (username, password, callback) {
|
||||
makePOSTRequest("/login", { username: username, password: password }, callback);
|
||||
@ -141,8 +140,6 @@ var MSTREAMAPI = (function () {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Special helper function
|
||||
MSTREAMPLAYER.addSongWizard = function (filepath, metadata, lookupMetadata) {
|
||||
// Escape filepath
|
||||
@ -152,7 +149,7 @@ var MSTREAMAPI = (function () {
|
||||
filepath = filepath.substr(1);
|
||||
}
|
||||
|
||||
var url = mstreamModule.currentServer.host + '/media/' + filepath;
|
||||
var url = mstreamModule.currentServer.host + '/transcode/' + filepath;
|
||||
|
||||
if (mstreamModule.currentServer.token) {
|
||||
url = url + '?token=' + mstreamModule.currentServer.token;
|
||||
|
||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user