JSON API, matching improvements, mild-to-moderate rewrite

Okay, I'm ready to say this is at least as good as the previous agent.  I think I've preserved all the critical patches applied over the past two years while updating to the JSON API and tweaking some of the matching parameters to work better with most libraries.

I have not yet received the official Miloš Seal of Approval for Music Agents, but initial reports are positive :)