AcademySoftwareFoundation / AcademySoftwareFoundation/OpenTimelineIO
RationalTime shouldn't allow to set 0 as rate
- Dominant language
- C++
- Stars
- 2k
- Forks
- 351
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 1
Description
## Bug Report
### Incorrect Functionality and General Questions
Describe the issue here.
## To Reproduce
1. Operating System: Any
2. Python version: Python3.9
4. OpenTimelineIO 0.14.0
```py
from opentimelineio.opentime import RationalTime, TimeRange
from opentimelineio.schema import Clip, Track, Timeline
time = RationalTime(0.0, 25)
tl = Timeline()
track = Track("Track 1")
clip = Clip("movie.mkv")
clip.source_range = TimeRange(
RationalTime(30, 0), # Must raise an error
RationalTime(10, 0), # Must raise an error
)
track.append(clip)
tl.tracks.append(track)
print(clip.source_range.duration.is_invalid_time())
# >> True
print(tl.duration())
# >> RationalTime(inf, 1)
# 'inf' is very tough to handle
```
## Expected Behavior
Setting `0` as `RationalTime.rate` value must raise a `ValueError("Rate must be positive.")`.
I'm not sure a rate could be negative though, unless it means the movie must be played reversed by the software.
Contributor guide
Research direction
Start at the opentimelineio.opentime.RationalTime entry point and reproduce the supplied Python snippet with a zero rate. Verify the existing behavior for invalid rates, then make completion mean that setting rate to 0 raises ValueError("Rate must be positive.").
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100