Diaoul / babelfish

BabelFish is a Python library to work with countries and languages
BSD 3-Clause "New" or "Revised" License
25 stars 14 forks source link

babelfish.exceptions.ReverseError: u'fra' #1

Closed hadim closed 10 years ago

hadim commented 10 years ago
(sub)hadim boromir ~ $ subliminal /media/hadim/MediaHadi2/movies/Un.Prophete.2009/ -l fr -v
INFO:subliminal.video:Scanning directory u'/media/hadim/MediaHadi2/movies/Un.Prophete.2009/'
INFO:subliminal.video:Scanning video u'Un.Prophete.2009.mkv' in u'/media/hadim/MediaHadi2/movies/Un.Prophete.2009'
INFO:enzyme.mkv:Reading Segment element
INFO:enzyme.parsers.ebml.core:MasterElement EBML ignored
INFO:enzyme.parsers.ebml.core:Maximum level 0 reached for children of MasterElement Segment
INFO:enzyme.mkv:Reading SeekHead element
INFO:enzyme.mkv:Processing element Info from SeekHead at position 4410
INFO:enzyme.mkv:Processing element Tracks from SeekHead at position 4485
Traceback (most recent call last):
  File "/home/hadim/local/virtualenvs/sub/bin/subliminal", line 9, in <module>
    load_entry_point('subliminal==0.7.1', 'console_scripts', 'subliminal')()
  File "build/bdist.linux-x86_64/egg/subliminal/cli.py", line 70, in subliminal
  File "build/bdist.linux-x86_64/egg/subliminal/video.py", line 279, in scan_videos
  File "build/bdist.linux-x86_64/egg/subliminal/video.py", line 219, in scan_video
  File "build/bdist.linux-x86_64/egg/subliminal/video.py", line 219, in <setcomp>
  File "/home/hadim/local/virtualenvs/sub/local/lib/python2.7/site-packages/babelfish/language.py", line 51, in fromcode
    return cls(*CONVERTERS[converter].reverse(code))
  File "/home/hadim/local/virtualenvs/sub/local/lib/python2.7/site-packages/babelfish/converters/alpha3b.py", line 34, in reverse
    raise ReverseError(alpha3b)
babelfish.exceptions.ReverseError: u'fra'

Shouldn't you catch systematic error ? I guess mkv have a lot of possible code for language... You should only display an error.

Diaoul commented 10 years ago

Spec states ISO-639-2 bibliographical and expicitly "fre" for french: http://matroska.org/technical/specs/index.html#languages You're MKV is crap.

Indeed I need to catch this.

hadim commented 10 years ago

Sure, and it won't be the only crap mkv dude :-) Catch it, log it and everything is fine.

Diaoul commented 10 years ago

Fixed in subliminal