TruxtonExport
This class gives you the capability to export files from Truxton.
Contents
Attributes and Methods
addcriteria(field, value) -> None
Adds criteria to the selection of files to export. The following are the possible criteria to set.
fqhash
The value parameter is a string containing the hash or partial hash of the file to export.
This corresponds to the [HashID] column of the [File] table.
fqid
The value parameter is a string containing the GUID of the file which corresponds to the [ID] column of the [File] table.
You can specify a comma separated list of identifiers if you want to export more than a single file.
fqlimit
The value parameter is an integer which sets the maximum number of files to export.
fqmedia
The value parameter is a string containing the GUID which corresponds to the [MediaID] column of the [File] table.
You can specify a comma separated list of identifiers if you want to export from multiple media.
fqparentid
The value parameter is a string containing the GUID of the file which corresponds to the [ParentFileID] column of the [File] table.
You can specify a comma separated list of identifiers if you want to export from more than a single parent.
This is useful for exporting the files in a folder in the seized media.
fqsize
The value parameter is an integer which specifies the exact size of the files to export.
This corresponds to the [OSLength] column of the [File] table.
fqsizemaximum
The value parameter is an integer which specifies the maximum size of the files to export.
This corresponds to the [OSLength] column of the [File] table.
fqsizeminimum
The value parameter is an integer which specifies the minimum size of the files to export.
This corresponds to the [OSLength] column of the [File] table.
fqtype
The value parameter is an integer which specifies the type of file to export.
This corresponds to the [FileTypeID] column of the [File] table.
You can specify a comma separated list of file types if you want to export more than a single type.
addoption(field, value) -> None
Sets one of the output options.
eofolder
The value parameter is a string containing the name of the folder to write the exported files.
eoname
The value parameter is a string containing the format of the name of the exported files.
If you don't set this, the original name of the file will be used to export.
However, you can specify a format string.
| Field | Meaning |
|---|---|
{hash}
|
The MD5 hash of the file's contents. |
{name}
|
The original name of the file. |
eotar
The value parameter is a string containing the name of the resulting tar file.
If you do not specify this, the files will be written to the output folder.
execute() -> boolean
After the criteria and options have been set, this function will perform the task of exporting the files from Truxton.
where
Holds the SQL WHERE clause based on the current criteria.
Samples
Pictures in Media
This sample shows how to export 99 images at least 4KB long with an MD5 that begins with "E4" from a piece of media in Truxton.
import sys
sys.path.append('C:/Program Files/Truxton/SDK')
import truxton
def main():
t = truxton.create()
exporter = t.newexporter()
# Limit the number of files exported to 99
exporter.addcriteria( exporter.fqlimit, 99 )
# Make sure the files being exported are at least 4KB
exporter.addcriteria( exporter.fqsizeminimum, 4096)
# We want JPGs, EXIF and GIFs
exporter.addcriteria( exporter.fqtype, truxton.Type_JPEG )
exporter.addcriteria( exporter.fqtype, truxton.Type_JPEGWithExif)
exporter.addcriteria( exporter.fqtype, truxton.Type_GIF)
# Only output files that have an MD5 starting with E4
exporter.addcriteria( exporter.fqhash, "e4" )
# Select files that belong to a particular piece of media
exporter.addcriteria( exporter.fqmedia, "174bcbe6-ef53-170f-8903-3958c45521a4" )
# We want the files to be named with their hash followed by original name
exporter.addoption( exporter.eoname, "{hash}_{name}" )
# Write the exported files to C:\temp
exporter.addoption( exporter.eofolder, "c:\\temp" )
# Write the files to output.tar in c:\temp
exporter.addoption( exporter.eotar, "output.tar" )
exporter.execute()
if __name__ == "__main__":
sys.exit(main())
Unique Videos
This will export all of the unique video files from an instance of Truxton.
import sys
sys.path.append('C:/Program Files/Truxton/SDK')
import truxton
def main():
t = truxton.create()
exporter = t.newexporter()
exporter.addcriteria( exporter.fqgroup, truxton.Type_VideoCategory )
exporter.addoption( exporter.eoname, "{hash}.{ext}" )
exporter.addoption( exporter.eofolder, "c:\\temp" )
exporter.addoption( exporter.eotar, "UniqueVideosFromTruxton.tar" )
exporter.addoption( exporter.eounique, "1" )
exporter.execute()
if __name__ == "__main__":
sys.exit(main())