Difference between revisions of "TruxtonExport"
| (15 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
=Attributes and Methods= | =Attributes and Methods= | ||
| − | ==<code>addcriteria(field, value)</code>== | + | ==<code>addcriteria(field, value) -> None</code>== |
Adds criteria to the selection of files to export. | Adds criteria to the selection of files to export. | ||
| − | |||
The following are the possible criteria to set. | The following are the possible criteria to set. | ||
===<code>fqhash</code>=== | ===<code>fqhash</code>=== | ||
| − | The <code>value</code> | + | The <code>value</code> parameter is a string containing the hash or partial hash of the file to export. |
| + | This corresponds to the <code>[HashID]</code> column of the <code><nowiki>[</nowiki>[[File Table|File]]<nowiki>]</nowiki></code> table. | ||
===<code>fqid</code>=== | ===<code>fqid</code>=== | ||
| − | The <code>value</code> | + | The <code>value</code> parameter is a string containing the [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID] of the file which corresponds to the <code>[ID]</code> column of the <code><nowiki>[</nowiki>[[File Table|File]]<nowiki>]</nowiki></code> table. |
You can specify a comma separated list of identifiers if you want to export more than a single file. | You can specify a comma separated list of identifiers if you want to export more than a single file. | ||
===<code>fqlimit</code>=== | ===<code>fqlimit</code>=== | ||
| − | + | The <code>value</code> parameter is an integer which sets the maximum number of files to export. | |
===<code>fqmedia</code>=== | ===<code>fqmedia</code>=== | ||
| − | The | + | The <code>value</code> parameter is a string containing the [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID] which corresponds to the <code>[MediaID]</code> column of the <code><nowiki>[</nowiki>[[File Table|File]]<nowiki>]</nowiki></code> table. |
| + | You can specify a comma separated list of identifiers if you want to export from multiple media. | ||
===<code>fqparentid</code>=== | ===<code>fqparentid</code>=== | ||
| − | The | + | The <code>value</code> parameter is a string containing the [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID] of the file which corresponds to the <code>[ParentFileID]</code> column of the <code><nowiki>[</nowiki>[[File Table|File]]<nowiki>]</nowiki></code> 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. | This is useful for exporting the files in a folder in the seized media. | ||
===<code>fqsize</code>=== | ===<code>fqsize</code>=== | ||
| − | The | + | The <code>value</code> parameter is an integer which specifies the exact size of the files to export. |
| + | This corresponds to the <code>[OSLength]</code> column of the <code><nowiki>[</nowiki>[[File Table|File]]<nowiki>]</nowiki></code> table. | ||
| + | |||
| + | ===<code>fqsizemaximum</code>=== | ||
| + | The <code>value</code> parameter is an integer which specifies the maximum size of the files to export. | ||
| + | This corresponds to the <code>[OSLength]</code> column of the <code><nowiki>[</nowiki>[[File Table|File]]<nowiki>]</nowiki></code> table. | ||
===<code>fqsizeminimum</code>=== | ===<code>fqsizeminimum</code>=== | ||
| − | The minimum | + | The <code>value</code> parameter is an integer which specifies the minimum size of the files to export. |
| − | + | This corresponds to the <code>[OSLength]</code> column of the <code><nowiki>[</nowiki>[[File Table|File]]<nowiki>]</nowiki></code> table. | |
| − | |||
| − | |||
===<code>fqtype</code>=== | ===<code>fqtype</code>=== | ||
| − | The type of file to export. | + | The <code>value</code> parameter is an integer which specifies the [[File Types Supported|type]] of file to export. |
| + | This corresponds to the <code>[FileTypeID]</code> column of the <code><nowiki>[</nowiki>[[File Table|File]]<nowiki>]</nowiki></code> table. | ||
You can specify a comma separated list of file types if you want to export more than a single type. | You can specify a comma separated list of file types if you want to export more than a single type. | ||
| − | ==<code>addoption(field, value)</code>== | + | ==<code>addoption(field, value) -> None</code>== |
Sets one of the output options. | Sets one of the output options. | ||
| − | ==<code>execute()</code>== | + | ===<code>eofolder</code>=== |
| + | The <code>value</code> parameter is a string containing the name of the folder to write the exported files. | ||
| + | |||
| + | ===<code>eoname</code>=== | ||
| + | The <code>value</code> 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. | ||
| + | |||
| + | {| class="wikitable" | ||
| + | ! Field | ||
| + | ! Meaning | ||
| + | |- | ||
| + | | <code>{hash}</code> | ||
| + | | The MD5 hash of the file's contents. | ||
| + | |- | ||
| + | | <code>{name}</code> | ||
| + | | The original name of the file. | ||
| + | |} | ||
| + | |||
| + | ===<code>eotar</code>=== | ||
| + | The <code>value</code> parameter is a string containing the name of the resulting [https://en.wikipedia.org/wiki/Tar_(computing) tar] file. | ||
| + | If you do not specify this, the files will be written to the output folder. | ||
| + | |||
| + | ==<code>execute() -> boolean</code>== | ||
After the criteria and options have been set, this function will perform the task of exporting the files from Truxton. | After the criteria and options have been set, this function will perform the task of exporting the files from Truxton. | ||
| Line 46: | Line 76: | ||
Holds the SQL <code>WHERE</code> clause based on the current criteria. | Holds the SQL <code>WHERE</code> clause based on the current criteria. | ||
| − | = | + | =Samples= |
| − | <source lang="Python" highlight=" | + | ==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. | ||
| + | <source lang="Python" highlight="11,14,16-19,22,25,28,31,34,36"> | ||
| + | import sys | ||
| + | sys.path.append('C:/Program Files/Truxton/SDK') | ||
import truxton | import truxton | ||
| Line 84: | Line 118: | ||
if __name__ == "__main__": | if __name__ == "__main__": | ||
| − | main() | + | sys.exit(main()) |
| + | </source> | ||
| + | |||
| + | ==Unique Videos== | ||
| + | This will export all of the unique video files from an instance of Truxton. | ||
| + | <source lang="Python" highlight="9-13,15"> | ||
| + | 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()) | ||
</source> | </source> | ||
Latest revision as of 11:20, 18 August 2023
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())