ThreatExchange icon indicating copy to clipboard operation
ThreatExchange copied to clipboard

[py-tx] Implement "File" Content Type

Open Dcallies opened this issue 1 year ago • 0 comments

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

  1. 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
  2. Add PR that allows the hash command to accept file, and then determine which of the "actual" content types it should use. Add a unittest in the e2e test to demonstrate.

Dcallies avatar Oct 30 '24 22:10 Dcallies