Skip to content

Commit

Permalink
Change from pysrt to srt
Browse files Browse the repository at this point in the history
  • Loading branch information
infinitymdm authored and ptrcnull committed Jan 22, 2024
1 parent bea94ab commit a19634b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/user/how_it_works.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ Various libraries are used by subliminal and are key to its success:
* `dogpile.cache <http://dogpilecache.readthedocs.org>`_ to cache intermediate search results
* `stevedore <http://docs.openstack.org/developer/stevedore/>`_ to manage the provider entry point
* `chardet <http://chardet.readthedocs.org>`_ to detect subtitles' encoding
* `pysrt <https://github.com/byroot/pysrt>`_ to validate downloaded subtitles
* `srt <https://github.com/cdown/srt>`_ to validate downloaded subtitles
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def find_version(*file_paths):

install_requirements = ['guessit>=3.0.0', 'babelfish>=0.5.2', 'enzyme>=0.4.1', 'beautifulsoup4>=4.4.0',
'requests>=2.0', 'click>=4.0', 'dogpile.cache>=0.6.0', 'stevedore>=1.20.0',
'chardet>=2.3.0', 'pysrt>=1.0.1', 'six>=1.9.0', 'appdirs>=1.3', 'rarfile>=2.7',
'chardet>=2.3.0', 'srt>=3.5.0', 'six>=1.9.0', 'appdirs>=1.3', 'rarfile>=2.7',
'pytz>=2012c']
if sys.version_info < (3, 2):
install_requirements.append('futures>=3.0')
Expand Down
9 changes: 4 additions & 5 deletions subliminal/subtitle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os

import chardet
import pysrt
import srt

from six import text_type

Expand Down Expand Up @@ -95,10 +95,9 @@ def is_valid(self):
return False

try:
pysrt.from_string(self.text, error_handling=pysrt.ERROR_RAISE)
except pysrt.Error as e:
if e.args[0] < 80:
return False
srt.parse(self.text)
except srt.SRTParseError:
return False

return True

Expand Down

0 comments on commit a19634b

Please sign in to comment.