Difference between revisions of "TruxtonExport"
Jump to navigation
Jump to search
(Created page with "This class gives you the capability to export files from Truxton. =Attributes and Methods= ==<code>addcriteria(field, value)</code>== Adds criteria to the selection of files...") |
|||
| Line 15: | Line 15: | ||
=Sample= | =Sample= | ||
| − | <source lang="Python" highlight=" | + | <source lang="Python" line highlight="9,12,15-17"> |
import truxton | import truxton | ||
| Line 21: | Line 21: | ||
t = truxton.create() | t = truxton.create() | ||
| − | exporter = t. | + | 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" ) | ||
| + | |||
| + | |||
| + | exporter.execute() | ||
if __name__ == "__main__": | if __name__ == "__main__": | ||
main() | main() | ||
</source> | </source> | ||
Revision as of 09:09, 2 December 2020
This class gives you the capability to export files from Truxton.
Contents
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
1 import truxton
2
3 def main():
4 t = truxton.create()
5
6 exporter = t.newexporter()
7
8 # Limit the number of files exported to 99
9 exporter.addcriteria( exporter.fqlimit, 99 )
10
11 # Make sure the files being exported are at least 4KB
12 exporter.addcriteria( exporter.fqsizeminimum, 4096)
13
14 # We want JPGs, EXIF and GIFs
15 exporter.addcriteria( exporter.fqtype, truxton.Type_JPEG )
16 exporter.addcriteria( exporter.fqtype, truxton.Type_JPEGWithExif)
17 exporter.addcriteria( exporter.fqtype, truxton.Type_GIF)
18
19 # Only output files that have an MD5 starting with E4
20 exporter.addcriteria( exporter.fqhash, "e4" )
21
22
23 exporter.execute()
24
25 if __name__ == "__main__":
26 main()