TruxtonExport

From truxwiki.com
Revision as of 09:11, 2 December 2020 by Sam (talk | contribs)
Jump to navigation Jump to search

This class gives you the capability to export files from Truxton.

Attributes and Methods

addcriteria(field, value)

Adds criteria to the selection of files to export.

addoption(field, value)

Sets one of the output options.

execute()

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.

Sample

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" )

  # 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__":
  main()