Author Topic: Spotify for Classic  (Read 7273 times)

Offline Protools5LEGuy

  • Global Moderator
  • Platinum Member
  • *****
  • Posts: 2761
Spotify for Classic
« on: January 07, 2019, 11:15:58 AM »
https://68kmla.org/forums/index.php?/topic/55998-building-a-spotify-player-for-my-mac-se30/



Ants:
Quote
The app is called MacPlayer and works thanks to the magic of Spotify Connect. The speaker itself streams and plays the music, and the Mac simply tells the speaker which song to play (as well as volume, current playlist, shuffle mode and other settings). Communication is over Wifi:






Quote
The first version is pretty basic, it just plays your Spotify playlists. You can browse tracks, and the app displays 1-bit album art, which I think is a bit of fun
Quote
The app performs well on a stock SE/30, although it does rely on a bit of help from the on-board OpenWRT Wifi router to handle the HTTPS communication with the Spotify API. The router has stunnel installed on it, which acts as a HTTP to HTTPS tunnel. I updated the MacWifi Extension to allow the Mac to create SSL tunnels on the router as needed. Here’s a video of how the app performs (no music unfortunately due to Copyright):
[youtube]yXZ-QK0kFjs[/youtube]
Quote



Another problem I had to solve was authenticating the app with a Spotify account. Like most modern web API’s, Spotify uses OAuth to allow third party apps to access their services. However the OAuth flow requires a modern web browser for users to enter their login details. To overcome this, I wrote an OAuth bridge for vintage Macs which delegates the login part of the process to another device such as a smartphone. The first steps are handled on the Mac:

 





Quote
And then completed on a modern device:







Quote
The final hurdle was with text encoding. The modern web uses UTF-8 for encoding text - which is a variant of Unicode. However, Unicode support was only available on PowerPC Macs as of MacOS 8.5, prior to that it was Apple’s own MacRoman encoding. I was able to port a Unix library, libiconv, to the Mac which performs a “best guess” conversion between UTF-8 and MacRoman – so far from my testing it’s been flawless (on English text).

If you’d like to give MacPlayer a go, you’ll need the following:

 

 

    A Spotify Premium account (only Premium accounts can use Spotify Connect)
    A Spotify Connect speaker/device (any modern Mac or PC with Spotify installed can also act as a target device)
    A 68k Mac with an Ethernet Card
    An OpenWRT wifi router, such as the GL-AR300M. Follow the setup instructions on the MacWifi Readme.
    The latest version of the MacWifi Extension.
    Then download the MacPlayer app.

 

Just note that the first version is pretty limited, and probably buggy :)


Looking ahead, I’d like to get the app more functional – and colour monitor support is definitely on the wish list – but for now I’m going to take a break and enjoy the fruits of my labour.
Looking for MacOS 9.2.4

Offline mrhappy

  • Platinum Member
  • *****
  • Posts: 1152
  • new to the forums
Re: Spotify for Classic
« Reply #1 on: January 07, 2019, 07:16:46 PM »
Holy Cow... that's pretty wild!! ;D

Offline krieg000

  • Active Member
  • *
  • Posts: 8
Re: Spotify for Classic
« Reply #2 on: October 30, 2022, 08:37:47 AM »
Hope this works!  :D

Offline krieg000

  • Active Member
  • *
  • Posts: 8
Re: Spotify for Classic
« Reply #3 on: October 30, 2022, 08:44:09 AM »
This also is required: