atuttle / zoidbox

An IRC bot that (attempts to) bring the knowledge and wit of @boyzoid to ##coldfusion on freenode
3 stars 6 forks source link

Fixed Spotify plugin to manage magnets and open URIs and removed reachie... #45

Closed coldfumonkeh closed 9 years ago

coldfumonkeh commented 9 years ago

Fixed Spotify plugin to manage magnets and open URIs and removed reachie-stupidity

The Spotify plugin now manages both types of publicly available links to share and if it's a magnet URI provided the bot will also return the open.spotify.com link as well as artist / track names. Also fixed the channel names so it works with zoidbox and the cf channel.

Removed reachie stupidity because, well, it was stupid.

atuttle commented 9 years ago

Can you stop into #zoidbox and show us how this works some time soon?

coldfumonkeh commented 9 years ago

No problem, will do. Also added basic details below.

The plugin was born from a few scenarios in the channel where Spotify URIs were posted to share links to artists / tracks / albums. The magnet-style URIs are pretty useless; they are ideal for pasting into the Spotify app for instant access to content but not great for sharing in the context of a chat room.

Take this example (if posted into the channel):

spotify:track:6JEK0CvvjDjjMUBFoXShNZ

This gives no context or information on what it will open. The plugin will take this URI and parse it to the Spotify API to return a more informative description of the shared item as well as a link to open it directly in the web version of Spotify:

Spotify track: Never Gonna Give You Up by Rick Astley ~ https://open.spotify.com/track/6JEK0CvvjDjjMUBFoXShNZ

The updated patch in commit 73a39d2 goes one step further to reverse this process a little. The Spotify app no longer generates the magnet URI but DOES accept them. If you share a link now it would be the open.spotify.com link similar to above. The revision addresses this and generates the same descriptive output if a 'true' web URL was shared, but omitting the link as it is already available like so:

Spotify track: Never Gonna Give You Up by Rick Astley

The plugin will work for links to albums, artists and tracks.