byroot / ruby-osdb

OSDb library for Ruby http://trac.opensubtitles.org/projects/opensubtitles/wiki/XMLRPC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error in the recursive mode

runa opened this issue · comments

Hey :)
I was trying the new -a switch and I got an error in recursive mode:

$ /usr/local/bin/getsub -l eng -a -t srt -s hnp .
* Search subtitles for .
Something crashed.
Feel free to report the error here: https://github.com/byroot/ruby-osdb/issues
With the following debug informations:

Errno::EISDIR: Is a directory - .:
/var/lib/gems/1.9.1/gems/osdb-0.1.0/lib/osdb/movie_file.rb:45:in `read'
/var/lib/gems/1.9.1/gems/osdb-0.1.0/lib/osdb/movie_file.rb:45:in `block in compute_hash'
/var/lib/gems/1.9.1/gems/osdb-0.1.0/lib/osdb/movie_file.rb:43:in `open'
/var/lib/gems/1.9.1/gems/osdb-0.1.0/lib/osdb/movie_file.rb:43:in `compute_hash'
/var/lib/gems/1.9.1/gems/osdb-0.1.0/lib/osdb/movie_file.rb:23:in `hash'
/var/lib/gems/1.9.1/gems/osdb-0.1.0/lib/osdb/search/movie_hash.rb:12:in `search_subs_for'
/var/lib/gems/1.9.1/gems/osdb-0.1.0/lib/osdb/subtitle_finder.rb:13:in `block in find_sub_for'
/var/lib/gems/1.9.1/gems/osdb-0.1.0/lib/osdb/subtitle_finder.rb:12:in `each'
/var/lib/gems/1.9.1/gems/osdb-0.1.0/lib/osdb/subtitle_finder.rb:12:in `find_sub_for'
/var/lib/gems/1.9.1/gems/osdb-0.1.0/bin/getsub:63:in `block in run!'
/var/lib/gems/1.9.1/gems/osdb-0.1.0/bin/getsub:54:in `each'
/var/lib/gems/1.9.1/gems/osdb-0.1.0/bin/getsub:54:in `run!'
/var/lib/gems/1.9.1/gems/osdb-0.1.0/bin/getsub:159:in `<top (required)>'
/usr/local/bin/getsub:23:in `load'
/usr/local/bin/getsub:23:in `<main>'

Good catch. If you give a directory as argument it will crash.

You can workaround with globing.

$ /usr/local/bin/getsub -l eng -a -t srt -s hnp *

(replace . by *)

I'll fix that tomorrow.

Thanks

Version 1.0.1 have been release with this fix.

Sorry for the inconvenience.