socialbaking / karma

MIT License
3 stars 1 forks source link

Fetch seed product files from social media #78

Closed fabiancook closed 1 year ago

fabiancook commented 1 year ago

Discord should be the first goal to fetch product images from.

The discord api should be used to check if there is a channel name matching the product name, if there is, the product media should be fetched.

fabiancook commented 1 year ago

Files stored in R2 will need to have a pre-signed url generated when requested https://developers.cloudflare.com/r2/api/s3/presigned-urls/

fabiancook commented 1 year ago

Seems like some channel names are over matching product names. It also takes too long to fetch all of the servers files, so it should skip syncing files if the time limit is running out.

A running count of file sizes we can transfer in what time so we can estimate accurately how many files we might be able to go through.

Related to #83

fabiancook commented 1 year ago

This is now virtually complete, it syncs from discord in the background task, with rate limits and time remaining in mind.

Images are available to view, and can be searched by name. A random image can be returned, or a specific zero based index can be given in the query string to be able to return a specific image, ordered from most recent.

https://karma.patient.nz/api/version/1/products/image/search/shish?index=0 https://karma.patient.nz/api/version/1/products/image/search/shish?index=1

?index=0 will return the most recent image ?index=1 will return the next most recent image, and so on.