nofxx / subtitle_it

Download, edit and create subtitles. Supports various formats.
MIT License
35 stars 9 forks source link

`search_subtitles': undefined method `inject' for "":String (NoMethodError) #16

Open msx2 opened 9 years ago

msx2 commented 9 years ago
/Users/msx2/.rvm/gems/ruby-2.2.2/gems/subtitle_it-2.0.0/lib/subtitle_it/subdown.rb:52:in `search_subtitles': undefined method `inject' for "":String (NoMethodError)
    from /Users/msx2/.rvm/gems/ruby-2.2.2/gems/subtitle_it-2.0.0/lib/subtitle_it/bin.rb:20:in `run!'
    from /Users/msx2/.rvm/gems/ruby-2.2.2/gems/subtitle_it-2.0.0/lib/subtitle_it/bin.rb:89:in `run!'
    from /Users/msx2/.rvm/gems/ruby-2.2.2/gems/subtitle_it-2.0.0/bin/subtitle_it:66:in `<top (required)>'
    from /Users/msx2/.rvm/gems/ruby-2.2.2/bin/subtitle_it:23:in `load'
    from /Users/msx2/.rvm/gems/ruby-2.2.2/bin/subtitle_it:23:in `<main>'
nofxx commented 9 years ago

@msx2 That's for every movie? I'm trying to debug but not sure what the result was. If you could add a breakpoint, binding.pry, and show what result['data'] is on line #51 Should be an array, only scenario I can think of is that empty results changed or when it's only 1 it's returning string now.

msx2 commented 9 years ago

@nofxx I didn't get into the source that much at the time. But I believe this was for the case when the string was returned, because there was only one entry in opensubtitles.org directory for each of the few titles I've checked. After a few days and as more of the subtitles emerged, it seems to work just fine.

But would be awesome if it could handle single result case :)

Will debug the source when I see the issue again.

nofxx commented 9 years ago

Yeah, should be it. Gonna give a look when I got some time.

msx2 commented 9 years ago

@nofxx FYI, I did result.inspect in line 51 and it got me:

{"status"=>"200 OK", "data"=>"", "seconds"=>0.005}

and there's one match so far for Extant.S02E09.HDTV.x264-LOL in opensubtitles.org