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

Is it possible to add a list of clips to a sequence? #68

Open
seanmcnally98 opened this issue Jun 20, 2023 · 0 comments
Open

Is it possible to add a list of clips to a sequence? #68

seanmcnally98 opened this issue Jun 20, 2023 · 0 comments

Comments

@seanmcnally98
Copy link

seanmcnally98 commented Jun 20, 2023

Trying to get all the mp4 files in a directory added to my project, then added to the active sequence. I'm aware a loop could add them one by one, but I'm wondering if it's possible to use insertClip to add multiple at once, similar to dragging them onto the timeline. I'm a bit of a novice when it comes to coding, so perhaps my syntax is wrong. Here's my code:

import pymiere
import os
from pymiere.wrappers import time_from_seconds
project = pymiere.objects.app.project

directory = r'D:\Media_Folder'

media_path = [os.path.join(directory, filename) for filename in os.listdir(directory) if filename.endswith('.MP4')]
# import media into Premiere  
success = project.importFiles(  
media_path, # can import a list of media if there are no brackets around media_path
suppressUI=True,  
targetBin=project.getInsertionBin(),  
importAsNumberedStills=False  
        )  
#find media we imported  
items = project.rootItem.findItemsMatchingMediaPath(media_path, ignoreSubclips=False)  
#add clip to active sequence  
project.activeSequence.videoTracks[0].insertClip(items[0], time_from_seconds(0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant