Skip to content
/ Subsy Public

Access to subtitles from various file formats

License

Notifications You must be signed in to change notification settings

john-hen/Subsy

Repository files navigation

Subsy

Access to subtitles from various file formats

This library is not fundamentally different from established ones, but offers some helpful abstractions that those others don't. First and foremost, subtitles loaded from a file are represented as a linked list. This makes it possible to implement search patterns and sanitization strategies that take the preceding or following subtitle into account, for example to recognize a running sentence.

>>> import subsy
>>> subtitles = subsy.load('subtitles.srt')
>>> first = subtitles[0]
>>> first.text
'How are you?'
>>> second = first.next
>>> second.text
'great, thanks.'
>>> second.text = 'Great, thanks.'
>>> subtitles.save()

Subtitles can be loaded from and saved to these file formats:

  • Subrip (.srt)
  • Advanced Substation Alpha (.ass)
  • Substation Alpha (.ssa)
  • WebVTT (.vtt)
  • SubViewer (.sub)

The text encoding of input files is detected automatically.

release documentation


Continuous integration

I published this library mostly to use as a demo project for continuous integration, for me to learn how to set up and configure the various CI services by different providers. For the small, pure-Python package that this is, such effort is certainly overkill. But the configuration files would not be all that different for bigger projects. And the limitations of the CI services would be the same.

The goal for each of them: Make sure the tests pass for all supported Python versions on all three platforms: Linux, Windows, macOS. GitHub Actions was by far the easiest to set up. CircleCI is similarly easy, and unlike any other provider offers terminal access to the test runner for debugging purposes, but does not support macOS in the free plan. Travis CI and AppVeyor are the veterans, and it shows. The configuration syntax is clunky, less streamlined and flexible than the competition's. Buddy is easy to use, but lacks features and macOS support. I wanted to test Azure Pipelines, but, of late, Microsoft requires application via email for the free plan, and I couldn't be bothered. For projects already on GitHub, there is little reason to use anything but GitHub Actions.

Travis CI AppVeyor CircleCI GitHub Buddy

codecov Codacy