This should be achievable using existing API endpoints, you'd just need something that can review search responses and choose the best response. Tracks will end up on a filesystem local to the application, but you can use something like rsync or the existing SFTP integration to move them elsewhere.
I'm working on adding webhooks that will fire when files are downloaded; once those are in place it should get a little easier.
Woot! Gooo JP!!