jodevsa / subscene_scraper

Library to download subtitles from subscene.com
13 stars 6 forks source link

Concurrency #1

Closed waclock closed 7 years ago

waclock commented 7 years ago

Hello, I was trying to use this, scanning a folder (I'm using electron to build the project), and I'm having a few problems trying to use the library.

If there's only one movie, there's no problem, however if I try scanning all movie files, nothing's found. Basically my code is the following:

        for (var i = 0, path; path = dir[i]; i++) {
          new subtitleForFile(path,folderPath,function(err,ppath){
            console.log(err)
          });
        }
export function subtitleForFile(file,folderPath,callback){
  var extension = Path.extname(file.toLowerCase())
  const movieExtensions = ['.mkv','.mp4','.avi']
  if(movieExtensions.indexOf(extension) != -1){
    var parsedFile = ptn(file)
    console.log(parsedFile);
    subscene_scraper(parsedFile.title,'english',folderPath,function(err,savedPath,data){
      if(err){
        callback(err)
      }else{
        callback(err,path_of_sub)
      }
    });
  }
}
jodevsa commented 7 years ago

@waclock , i hope you try now with re-installing the latest version and give us the feedback.

waclock commented 7 years ago

Thank you, this solved the issue!

Maybe you should set the latest commit as a new release? Otherwise NPM won't update the package (I updated it manually)

jodevsa commented 7 years ago

We will update it on NPM shortly.