Fails if a low binary coded decimal is passed to it
SolenOchHavet opened this issue · comments
If a too low binary coded decimal is provided, the Timecode class will fail. I believe it's when it's under one hour:
import timecode
# This line will fail. Should output: 00:41:17:00
timecode.Timecode(24, 16663)
The reason it fails is because the created hex string is too short. This classmethod call returns wrong values:
>> timecode.Timecode.parse_timecode(16663)
('41', '17', '', '')`
>> # While the correct value for this operation should be:
('0', '41', '17', '0')
I couldn't find a clever solution for the bug so I'm just using a dirty if check for now and shift the values and making sure that any variable at least contain '0' if it's empty.
Fixed in 2f65a78
But your assumption is wrong
>>> timecode.Timecode.parse_timecode(16663) # will return
(0, 0, 41, 17)
Also notice that it will now return a tuple of integers instead of a tuple of strings.