cdown / srt

A simple library and set of tools for parsing, modifying, and composing SRT files.
MIT License
473 stars 44 forks source link

Python2 incompatibility in srt-linear-timeshift #48

Closed mguillau closed 5 years ago

mguillau commented 5 years ago

When running the code on an SRT file I was trying to fix, I encountered an incorrect output. I tracked the problem down to this line:

https://github.com/cdown/srt/blob/3c850e492502178283785c3e69a3ec4b71ec3b0c/srt_tools/srt-linear-timeshift#L58

Which, on my system with python2.7, invoked integer division instead of float division as it should be. I would suggest to either (i) add a multiplication to 1.0 somewhere to force the cast to float, or (ii) add "from future import division" at the start of the file so as to ensure PEP-238 behavior.

cdown commented 5 years ago

Thanks for the report, I'll put out a fix now. You're probably aware that Python 2 is becoming EOL soon, though :-)