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

Moving timeline playhead #27

Closed
MarcoP91 opened this issue Mar 21, 2023 · 8 comments
Closed

Moving timeline playhead #27

MarcoP91 opened this issue Mar 21, 2023 · 8 comments
Labels
enhancement New feature or request

Comments

@MarcoP91
Copy link

First of all, thank you very much for this repo, I am enjoying it a lot.

I wanted to ask, is there a way to move the playhead? If I add to the timeline a list of MediaPoolItems, they get added one after another; I would like to add a video and an audio file "at the same time". Is that possible? If not, is there a way to set the time location of a MediaPoolItem?

@MarcoP91 MarcoP91 added the enhancement New feature or request label Mar 21, 2023
@MarcoP91
Copy link
Author

I have done it:

timeline.settings._obj.GetCurrentTimecode() to get the current playhead position

timeline.settings._obj.SetCurrentTimecode('01:00:20:00') to move it to the specified position

@MarcoP91
Copy link
Author

My bad, by using mediapool.append_to_timeline() the new clips get added at the end nonetheless. }
Is there a way to modify the time location of a MediaPoolItem?

@MarcoP91 MarcoP91 reopened this Mar 21, 2023
@in03
Copy link
Collaborator

in03 commented Mar 23, 2023

Hey @MarcoP91! Pydavinci doesn't fully support all of Resolve's API yet, but unfortunately I don't think even Resolve's API supports inserting clips into timeline yet... I haven't got Resolve handy atm, but you can check the scripting README in your copy of Resolve to see what's supported.

@in03
Copy link
Collaborator

in03 commented Mar 23, 2023

timeline.settings._obj.GetCurrentTimecode() to get the current playhead position
timeline.settings._obj.SetCurrentTimecode('01:00:20:00') to move it to the specified position

Also @MarcoP91 not sure if you're aware, but PyDavinci's timecode property is Resolve's Get/SetCurrentTimecode. I noticed the property setter is missing though, so I've added that ready for the next release, but it should be as easy as:

timeline.settings.timecode to get current playhead position
timeline.settings.timecode = "01:00:20:00" to set it 😄

@MarcoP91
Copy link
Author

MarcoP91 commented Mar 26, 2023

Ok, thank you 👍

I created a workaround with osascript, I'll leave it here:

`query = f"""
osascript -e '
tell application "Davinci Resolve"
activate
delay 0.1
tell application "System Events"
key code 123
delay 0.1
key code 123
delay 0.1
keystroke "y"
delay 0.1
keystroke "d" using command down
delay 0.1
keystroke "{seconds}"
delay 0.1
keystroke return
end tell
end tell
'
"""
os.system(query)

`

@SW-Daren
Copy link

SW-Daren commented Apr 25, 2023

Apparently AppendToTimeline() has some new parameters in DR 18 that allows for this. See this forum thread for details: https://forum.blackmagicdesign.com/viewtopic.php?f=21&t=113040

@LittleTerry
Copy link

Apparently AppendToTimeline() has some new parameters in DR 18 that allows for this. See this forum thread for details: https://forum.blackmagicdesign.com/viewtopic.php?f=21&t=113040

cool!

@pedrolabonia
Copy link
Owner

Fixed in by #28

Closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants