I’m using the Quicktime Generation Example script and would like to delete the frame sequence after a mov file is successfully created. How can I do this?
You could write another event plugin, or modify the Quicktime Generation example, to also watch for Quicktime jobs that complete. When they do, you can get the image sequence info from the job’s plugin info and delete the sequence from the event plugin.
Cheers,
- Ryan
I’ve modified the script to delete the image sequence but I’m receiving an error:
“No module named os”
I can see the os module in C:\Program Files\Thinkbox\Deadline\python\2.6.7\x64\lib and in C:\Program Files\Thinkbox\Deadline\python\2.6.7\win32\lib
import os
filelist = [ os.remove(f) for f in outputDirectory if f.endswith(".tga") ]
In Deadline 5.2, all of our Python stuff uses IronPython by default, which does not support a bunch of the native Python modules (including ‘os’).
You can workaround this by either making your Event Plugin use Python.NET (which will work fine with any C Python stuff), or by sticking with IronPython and using .NET functions instead of the Python ones. I’d recommend the former, since we’ve gotten rid of IronPython in Deadline 6.0, so you’ll have to use Python.NET sooner or later if you plan on upgrading
To make your event plugin a Python.NET plugin, just add this line at the top of your script:
#Python.NET
Note that there’s a couple small differences between Python.NET and IronPython scripts. The main one is that since Python.NET doesn’t handle polymorphism properly (from .NET classes to Python classes), you have to add event handlers for your functions instead of just relying on overriding them, like so:
## Python.NET scripts need to use event handlers to "override" functionality. So setup
## the relevant event listeners in the constructor.
def __init__( self ):
self.OnJobSubmittedEvent += self.OnJobSubmitted
self.OnJobStartedEvent += self.OnJobStarted
self.OnJobFinishedEvent += self.OnJobFinished
self.OnJobRequeuedEvent += self.OnJobRequeued
self.OnJobFailedEvent += self.OnJobFailed
Hope this helps!
Cheers,
- Jon
So I’ve got Deadline 6 up and running and have created an Event Plugin that deletes a rendered image sequence after the quicktime file is generated. Unfortunately, it’s not working. I suspect I’m not calling job.JobOutputDirectories properly, as doing a print of job.JobOutputDirectories produces ‘System.String[]’. This seems like an easy task but I don’t know Python so I’m mostly cutting and pasting from various online sources. Any help or tips would be greatly appreciated.
[code]#Python.NET
import os
import re
from System.IO import *
from System.Text import *
from Deadline.Events import *
from Deadline.Scripting import *
######################################################################
This is the function that Deadline calls to get an instance of the
main DeadlineEventListener class.
######################################################################
def GetDeadlineEventListener():
return MyEvent()
######################################################################
This is the main DeadlineEventListener class for MyEvent.
######################################################################
class MyEvent (DeadlineEventListener):
def __init__( self ):
self.OnJobFinishedCallback += self.OnJobFinished
self.OnJobSubmittedCallback += self.OnJobSubmitted
self.OnJobStartedCallback += self.OnJobStarted
self.OnJobRequeuedCallback += self.OnJobRequeued
self.OnJobFailedCallback += self.OnJobFailed
def OnJobFinished( self, job ):
if job.JobPlugin != "Quicktime":
return
outputDirectory = job.JobOutputDirectories
filelist = [ os.remove(f) for f in outputDirectory if f.endswith(".tga") ][/code]