Not being able to scrobble tracks with Audio Station is no bueno. After brainstorming some crazy ideas, I conjured up a scheme. Read through the entire README before you try anything, thanks! Time for some storytelling.
I sniffed the network traffic while using Audio Station and noted HTTP request patterns during playback of each song. Here is the low-down:
I have no clue what your system environment is like, but I'll attempt to provide detailed steps with minimal overhead. If you know what you're doing (ipkg is setup, Git is installed, etc...), just clone this repository to your NAS and skip this section. Otherwise, follow along below:
SSH into your NAS. Run sudo -i
to switch to the root user. Navigate into the directory uploaded from the previous section.
Install dependencies by running npm install
. Start the server by running npm start
.
In DSM, go to Control Panel > Task Scheduler. You will create a task to automatically run the server whenever your NAS boots up.
Click Create -> Triggered Task -> User-defined script.
In the General tab, enter a task name and then check the Enabled box.
In the Task Settings tab, edit and paste the following:
exec /usr/local/bin/node path_to_scrobbler_directory/bin/server.js
For example, in my environment this is:
exec /usr/local/bin/node /volume1/code/Audio-Station-Scrobbler/bin/server.js
Click OK to save this task.
Keep your SSH connection open so the server can continue to run for now. It's necessary for the following section.
This section explains how to obtain an API account and get the necessary information to scrobble your music.
To use the Last.fm API, sign up for an account. The only field that matters is Callback URL. Set Callback URL to:
http://local_address_of_your_nas:3000
Zang, now you have your own API key and API secret.
Complete the following URL with your API key and open it up in your browser.
http://www.last.fm/api/auth/?api_key=xxx
Log in if neccesary and grant your application permission to your account. Last.fm will redirect to the callback URL you specified earlier. Take note of the displayed authorization token, it is tied to your user account and API key and is valid for 60 minutes.
Complete the following URL with your API key, authorization token, and API secret. Open the URL in your browser.
local_address_of_your_nas:3000/auth/q?api_key=xxx&token=xxx&secret=xxx
Your NAS will request a session key from Last.fm. Assuming all the information you provided is correct, your API key, API secret, and session key will be stored your NAS environment. According to Last.fm, the lifetime of session keys are infinite.
You can close your SSH connection now. Proceed to plugin installation.
Install the plugin from this repository. It is required. The plugin feeds song information to the scrobbling server.
Restart your NAS in order for the scrobbling server to automatically run in the background. That's all folks, get scrobbling!
env.js
is lost, you'll need to start the entire setup/installation process over again since your API information and session key are stored. Alternatively, you could persist them to your bash profile.Is something broken? Does this README need to be updated? Open an issue, or even better, help me fix my shit! Suggestions and improvements are welcome!
npm test