Spotify on a ZSUN Wifi Card Reader

listening to Spotify

ZSUN Card reader

Bought this guy from China recently. It's a pretty neat little device that will hopefully work with my car's radio through its USB port. I'd like to be able to sync my Spotify CarFi playlist to it.

Here's some data on what it is:

Hardware
AR9331 SoC
64MB RAM
16MB SPI Flash
GL827L USB SD Card Reader

ZSUN card reader

Continuing on the work of these gentlemen:
https://wiki.hackerspace.pl/projects:zsun-wifi-card-reader
And:
http://www.zoobab.com/zsun-sd11x-wifi-card-reader

I would like to create something resembling this:

Spotify car sync

Graph of top level view of the concept

OK, let's get to it!

Luckily, the ZSUN guys where nice enough to leave a telnet port open and also strangely enough the root password found its way to people's home as well. Well whatever the cause it's pretty awesome that we pretty much get a half-baked 16MB Raspberry Pi equivalent for about a 1/4 of the price of a regular Pi (won't mention the #Zero since that turns out is pretty hard to get these days).
If you want get regular telnet, there are ways but I never got around to it. If it ain't broken, etc...
I found socat adequate for the job, even though it proved to be quite irritating at times.

socat - TCP4:10.168.168.1:11880
login: root
Password: zsun1188

Hello ZSUN

The ZSUN reader has the ability to bridge your wifi through it's tiny guts and connect to the Internetz. Thing is, every time it reboots, it refreshes its configuration. That's why we will need to create our own config file that will be run after every startup.

You can find it here:
https://github.com/piotrekkmt/spotify-carfi

You will need to place it in your /etc/rc.d/
and append a line at the end of your /etc/rc.d/rcS file.

peter.conf

#!/bin/bash      
wlanconfig ath0 destroy; wlanconfig ath0 create wlandev wifi0 wlanmode managed essid "The Promised LAN"; wpa_supplicant -B -iath0 -c/etc/ath/peter.conf -Dwext; ifconfig ath0 inet 192.168.1.200/24 up;
Temporary solution

As a temporary solution, I'm running the Spotify Car-Fi playlist download if there's a specific USB device plugged in using an Apple Script.

Change the name of a USB stick to CARFI.

Put your runOnCarfi.scpt in
~/Library/Workflows/Applications/Folder Actions/

AppleScript to run:

on adding folder items to thisFolder after receiving theseItems
	repeat with thisItem in theseItems
		try
			set fileTarget to "CARFI"
			fileTarget as alias
			display dialog "CARFI found - running Spotify script"
			do shell script POSIX path of thisItem & "carfi.sh"
      display dialog "CARFI music updated"
		end try
	end repeat
end adding folder items to