Comparing version 1.1.4 to 1.1.5
40
index.js
@@ -226,2 +226,4 @@ | ||
this.emit('error', e); | ||
if([ "Cannot call write after a stream was destroyed", "This socket is closed" ].includes(e.message)) { | ||
@@ -267,3 +269,3 @@ if(this.saveOptions) { | ||
var play_files = this.resolveFilePaths(files, settings.url); | ||
var play_files = this.resolveFilePaths(files/*, settings.url*/); | ||
this.respawnCB = null; | ||
@@ -305,27 +307,25 @@ | ||
resolveFilePaths(plist, isUrl) { | ||
// ftw remake (24.11.2019) | ||
resolveFilePaths(plist/*, _isUrl*/) { | ||
this.currentPlaylist = []; | ||
var ret = []; | ||
plist.forEach((audio)=> { | ||
if(!isUrl) { | ||
var realPath = path.resolve(this.fileDir, audio); | ||
if (!fs.existsSync(realPath)) { | ||
this.emit('error', new Error('File does not exist: ' + realPath)); | ||
return; | ||
for(const audio of plist) { | ||
let audioPath = audio.path || audio.url || audio; | ||
const isLocal = !(/(http(s)?:\/\/.)/i).test(audioPath); | ||
if(!isLocal) { | ||
audioPath = path.resolve(this.fileDir, audioPath); | ||
if (!fs.existsSync(audioPath)) { | ||
this.emit('error', new Error('File does not exist: ' + audioPath)); | ||
continue; | ||
} | ||
} | ||
this.currentPlaylist.push({ | ||
url: audioPath, | ||
name: (audio.name || audio.url || 'TrackName') | ||
}); | ||
} | ||
let url = isUrl? (audio.url? audio.url: audio): realPath; | ||
let id = ret.push(url); | ||
let ga = { id, url }; | ||
if(isUrl && audio.name) | ||
ga = { ...ga, name: audio.name }; | ||
this.currentPlaylist.push(ga); | ||
}); | ||
return this.currentPlaylist; | ||
// return ret; | ||
} | ||
@@ -332,0 +332,0 @@ |
{ | ||
"name": "playerxtwo", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Test node player", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13381