FTLam11 / Audio-Station-Scrobbler

Got a Synology NAS? Scrobble your music played via Audio Station
MIT License
18 stars 2 forks source link
audio-station fronkin lastfm music scrobble synology

Audio-Station-Scrobbler

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. Installing and Running Server Code

System Requirements

Cloning/Downloading Server Repository

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:

  1. Download this repository to your computer.
  2. Extract it and upload the entire folder to your NAS. I created a shared folder and uploaded to there.

Configuration

  1. SSH into your NAS. Run sudo -i to switch to the root user. Navigate into the directory uploaded from the previous section.

  2. Install dependencies by running npm install. Start the server by running npm start.

  3. In DSM, go to Control Panel > Task Scheduler. You will create a task to automatically run the server whenever your NAS boots up.

  4. Click Create -> Triggered Task -> User-defined script.

  5. In the General tab, enter a task name and then check the Enabled box.

  6. 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

  7. 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.

II. Last.fm Authorization

This section explains how to obtain an API account and get the necessary information to scrobble your music.

Create API Account

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.

Grant Application Permissions

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.

Get Session Key

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.

III. Install Plugin

Install the plugin from this repository. It is required. The plugin feeds song information to the scrobbling server.

IV. Restart Server

Restart your NAS in order for the scrobbling server to automatically run in the background. That's all folks, get scrobbling!

Limitations/Potential Issues

To-Dos

Contribution

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!

AAAHHHHHHH SHIIIIIEEEEEEEEEETTTTTTTTTT