TOPS mplay python
import subprocess
import os
def onGenerate(work_item):
# Get the parent graph
parent = work_item.parentItemHolder
# Collect output file paths from upstream items
all_inputs = parent.inputItems
file_paths = []
for item in all_inputs:
# Adjust 'file' if your attribute is named differently
path = item.attribValue('file')
if path and os.path.exists(path):
file_paths.append(path)
if file_paths:
# Launch mplay with all the output files
subprocess.Popen(["mplay"] + file_paths)
else:
print("No valid flipbook files found.")
return True
No Comments