Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested fix for #476 #488

Merged
merged 3 commits into from Apr 12, 2019
Merged
Changes from 2 commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -595,6 +595,9 @@ def from_timecode(timecode_str, rate):
# Check if rate is drop frame
rate_is_dropframe = rate in VALID_DROPFRAME_TIMECODE_RATES

# Make sure only DF timecodes are treated as such
treat_as_df = rate_is_dropframe and ';' in timecode_str

# Check if timecode indicates drop frame
if ';' in timecode_str:
if not rate_is_dropframe:
@@ -620,7 +623,7 @@ def from_timecode(timecode_str, rate):
timecode_str, nominal_fps - 1))

dropframes = 0
if rate_is_dropframe:
if rate_is_dropframe and treat_as_df:
This conversation was marked as resolved by ssteinbach

This comment has been minimized.

Copy link
@ssteinbach

ssteinbach Apr 12, 2019

Member

rate_is_dropframe is already factored into treat_as_df in line 599, I think this can just be:

Suggested change
if rate_is_dropframe and treat_as_df:
if treat_as_df:

This comment has been minimized.

Copy link
@apetrynet

apetrynet Apr 12, 2019

Author Contributor

Agree :)

if rate == 29.97:
dropframes = 2

@@ -565,6 +565,28 @@ def test_immutable(self):
with self.assertRaises(AttributeError):
t1.value = 12

def test_passing_ndf_tc_at_df_rate(self):
DF_TC = "01:00:02;05"
NDF_TC = "00:59:58:17"
frames = 107957

tc1 = otio.opentime.to_timecode(
otio.opentime.RationalTime(frames, 29.97)
)
self.assertEqual(tc1, DF_TC)

tc2 = otio.opentime.to_timecode(
otio.opentime.RationalTime(frames, 29.97),
30
)
self.assertEqual(tc2, NDF_TC)

t1 = otio.opentime.from_timecode(DF_TC, 29.97)
self.assertEqual(t1.value, frames)

t2 = otio.opentime.from_timecode(NDF_TC, 29.97)
self.assertEqual(t2.value, frames)


class TestTimeTransform(unittest.TestCase):

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.