Python Sample Export Videos
This sample shows the how to export video files in Python.
Source Code
1 import sys
2 sys.path.append('C:/Program Files/Truxton/SDK')
3 import truxton
4
5 def main():
6
7 t = truxton.create()
8 exporter = t.newexporter()
9 exporter.addcriteria( exporter.fqgroup, truxton.Type_VideoCategory )
10 exporter.addoption( exporter.eoname, "{hash}.{ext}" )
11 exporter.addoption( exporter.eofolder, "c:\\temp" )
12 exporter.addoption( exporter.eotar, "UniqueVideosFromTruxton.tar" )
13 exporter.addoption( exporter.eounique, "1" )
14
15 exporter.execute()
16
17 if __name__ == "__main__":
18 main()
Code Walkthrough
The above code shows how to export a category of file types from Truxton.
Line 8 creates the exporter.
Line 9 tells the exporter that we want all file types in the Type_VideoCategory.
Line 10 tells the exporter to use the MD5 hash as the filename and the extension registered for the type of file as the extension.
Line 11 will cause the exporter to write the output the file to the c:\temp folder.
Line 12 sets the format of the output to TAR in a file named UniqueVideosFromTruxton.tar
Line 43 changes the file type to our identifier for Acme. We talked about file type identifiers in a previous article.
Line 48-51 begins the process of sending this newly identified file to any ETL process that has registered for it.
The first step is to overwrite the filetype, which should contain Type_Unknown, with the identifier for our file type.
The last step is to call route() which tells Truxton to send this message to any ETLs that want it.
Line 54 completes the loop by getting another message from the acme message queue.