Giter VIP home page Giter VIP logo

Comments (4)

Diaoul avatar Diaoul commented on June 21, 2024

A convenience method in pysrt would be welcome to check for valid subtitles files.

from pysrt.

byroot avatar byroot commented on June 21, 2024

I'm not sure if pysrt should consider an empty text as an error.
All I can say right now is that it's not an intended behavior, in fact I never tough about that possibility.

I think it's reasonable to consider them as valid unless you know some players that fail to parse them ?

from pysrt.

byroot avatar byroot commented on June 21, 2024

I'm also ok to implement a kind of pysrt.validate(path, encoding=None), but i'm not sure of the best behavior:

  • Should I just return a boolean or the error list ?
  • If I fail to parse because of an encoding error should I raise or consider the file as invalid ?

Your feedback on this one is welcome.

from pysrt.

Diaoul avatar Diaoul commented on June 21, 2024

My personal taste is pysrt.is_valid(path, ignore_encoding_errors=True) that checks for subtitle file error. When having issues with encoding, most readers will just display unreadable characters but will read the file anyway hence the ignore_encoding_errors.
I think it's important to dissociate structure validation and encoding issues.

I wouldn't use the error list but I agree that could be useful for some.

from pysrt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.