ThreatExchange
ThreatExchange copied to clipboard
[py-tx] Implement "File" Content Type
Implement a new ContentType called "file" which represents the contents of a file. Files always have string names.
This will eventually feed into something like this: https://github.com/facebook/ThreatExchange/pull/1065
The end goal is we want to provide for the library to figure out whether it's a file or a photo automatically, and route it to the right one.
# Should be detected as a image
$ tx hash file file.png
pdq facefacefacefacefacefacefacefacefaceface
# Should be detected as a video
$ tx hash file file.png
pdq facefacefacefacefacefacefacefacefaceface
To do this, break this up into segments
- Add a PR that adds FileContent, with a method that can map to whether it's PhotoContent or VideoContent based on file name. Add some tests
- Add PR that allows the
hashcommand to accept file, and then determine which of the "actual" content types it should use. Add a unittest in the e2e test to demonstrate.