Difference between revisions of "Python Sample Export Videos"
| Line 24: | Line 24: | ||
=Code Walkthrough= | =Code Walkthrough= | ||
| − | The above code shows how to export a category of | + | The above code shows how to export a category of files from Truxton. |
Line 8 creates the exporter. | Line 8 creates the exporter. | ||
Revision as of 10:56, 30 March 2021
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 files 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 13 tells the exporter to only output one copy of a file. Only unique file contents will be output, no copies.
Line 15 begins the process of exporting the files. This provides no feedback, we suggest you monitor the output folder.