Agreed. Although I'd much sooner recommend just using Mopidy. Mopidy supports spotify and many other music services, and has a number of low-effort ways of controlling playback programmatically.
But for sure the interesting part of this is the method, not the purpose.
But for sure the interesting part of this is the method, not the purpose.