Git Product home page Git Product logo

ttml2srt's People

Contributors

arvvoid avatar ilyakharlamov avatar moisespr123 avatar yuppity avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ttml2srt's Issues

Preserve positioning with {\an8}

some xml based subtitles has region field, that specifies if the text is supposed to appear on the top or the bottom.
{\an8}, though not a native tag for srt, works with most players to display text on the top.

<layout>
<region tts:displayAlign="before" xml:id="region0"/>
<region tts:displayAlign="after" xml:id="region1"/>
</layout>

timestamps without milliseconds

Hi, I found an EBU-TT-D file where some timestamps are without milliseconds. I made this small change to accommodate this:

def fraction_timestamp_to_ms(self, timestamp):
    """Convert hh:mm:ss.fraction to milliseconds
    """
    if '.' in timestamp:
      hh, mm, ss, fraction = re.split(r'[:.]', timestamp)
    else:
      hh, mm, ss = re.split(r'[:]', timestamp)
      fraction = '0'
    hh, mm, ss = [int(i) for i in (hh, mm, ss)]
    # Resolution beyond ms is useless for our purposes
    ms = int(fraction[:3])
    
    return self._scaler(self._hhmmss_to_ms(hh, mm, ss) + ms)

error converting ttml from BBC iPlayer

Hi,

i got this error

$ python3 ttml2srt.py Doctor\ Who:\ Unleashed\,\ 60th\ Anniversary\ Specials\,\ Wild\ Blue\ Yonder\ \[m001t439\].en.ttml Doctor\ Who:\ Unleashed\,\ 60th\ Anniversary\ Specials\,\ Wild\ Blue\ Yonder\ \[m001t439\].en.srt
Traceback (most recent call last):
  File "ttml2srt.py", line 572, in <module>
    ttml.write2file(getattr(args, 'output-file') or '-')
  File "ttml2srt.py", line 489, in write2file
    for parag in self.paragraphs(generator=True):
  File "ttml2srt.py", line 462, in paragraphs
    for i, s in enumerate(self.to_paragraphs()))
  File "ttml2srt.py", line 380, in to_paragraphs
    [self.process_parag(p) for p in self.lines], key=lambda x: x[0])
  File "ttml2srt.py", line 380, in <listcomp>
    [self.process_parag(p) for p in self.lines], key=lambda x: x[0])
  File "ttml2srt.py", line 371, in process_parag
    ms_begin, subrip_begin = self.timeexpr_to_subrip(begin)
  File "ttml2srt.py", line 310, in timeexpr_to_subrip
    ms = self.timeexpr_to_ms(time_expr) + self.shift
  File "ttml2srt.py", line 131, in timeexpr_to_ms
    return self._timeexpr_to_ms(*args)
  File "ttml2srt.py", line 139, in _timeexpr_to_ms
    return self.timeexpr_to_ms(time_expr)
  File "ttml2srt.py", line 250, in frame_timestamp_to_ms
    hh, mm, ss, frames = [int(i) for i in timestamp.split('.')[0].split(':')]
ValueError: not enough values to unpack (expected 4, got 3)

when trying to convert this file
231203ttmlError.zip

please have a look into it, thx!

Missing License

Hello,

a license is missing, is this an error or is intentional?

I am using this code with some minor modifications in my hbo go add-on for kodi under GPL license TTML2SRT Class in the Add-on. Am I permitted to do so?

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.