Veetaha / snowpity

Apache License 2.0
6 stars 1 forks source link

Eagerly cache media #23

Open Veetaha opened 1 year ago

Veetaha commented 1 year ago

We may poll the media hosting for new media and cache it eagerly in the background. For sure, it doesn't make sense to cache everything that's already available, but new posts for sure.

For example, we could query derpibooru every minute or so, upload the media to our telegram cache, and save the ID or some other token for pagination to know where to start querying on the next pass. We must filter images that underwent the full processing on derpibooru, such that they have the representations that we use (e.g. MP4 for GIFs and videos, and optimized view_url).

Beware that derpibooru takes some time to optimize media after artists upload it. They do it in the background and serve an unoptimized version of the art. The optimization they do is the process of lossless image compression, which reduces the media file size drastically, therefore really want to use that!