Skip to content

Added check for remote sound files (http)#58

Open
lgillstrom wants to merge 10 commits intotonistiigi:developfrom
lgillstrom:master
Open

Added check for remote sound files (http)#58
lgillstrom wants to merge 10 commits intotonistiigi:developfrom
lgillstrom:master

Conversation

@lgillstrom
Copy link

Added check to see if src file is an url instead of a local file. There is probably a more elegant way to do this, but this change is the most minimal modification to support this.

@SargoDarya SargoDarya changed the base branch from master to develop July 11, 2017 18:43
@SargoDarya
Copy link
Collaborator

I like the idea of having remote sources, but this probably isn't the best way of doing it.



opts.logger.debug('Start processing', { file: src})
var remote = src.indexOf('http') == 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better check here would be

/^https?:\/\//.test(src)

that's slightly more expensive but safer. Otherwise we might run into surprises.

if (exists) {
let ffmpeg = spawn('ffmpeg', ['-i', path.resolve(src)]
if (exists || remote) {
let ffmpeg = spawn('ffmpeg', ['-i', remote?src:path.resolve(src)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using the ternary, use spaces. Otherwise it's hard to read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants