Giter Site home page Giter Site logo

soundcloud-rp's Introduction

Soundcloud Rich Presence

Adds Discord Rich Presence support to Soundcloud.

Introduction

Soundcloud Rich Presence allows you to show off your Soundcloud listening session to your friends using Discord Rich Presence.

It is a combination of a server, communicating with discord itself, and a user-script, running on your browser to send playback information to the server. Sadly, due to restrictions in the rich presence protocol, it is mandatory to run both the server and the user-script in order for the system to work.

Artwork upload is not available by default due to Discord's asset limit (150). In order to activate it, you need to create a new app on the developer interface, and set the new ClientID and your APIKey of the developer interface. More details at Artwork Upload.

Preview

With artwork upload

Profile Popup

Without artwork upload

Profile Popup

Installation

You will need to install nodejs (v10) and npm (v6) first. Make sure the node & npm commands are installed on your PATH.

Server:

  1. Clone the repository somewhere on your hard drive or unzip this archive if you don't have git installed
  2. Open a terminal in the soundcloud-rp directory
  3. Install the dependencies with npm install
  4. Retrieve your Soundcloud ClientID :
    • Open Soundcloud then hit Ctrl+Shift+I to open the devtools
    • Go to the Network tab
    • Filter by api-v2.soundcloud.com
    • Click on the first result. If there is no results, try changing page on Soundcloud to trigger some requests
    • Scroll down to the Query String Parameters section
    • Look for the client_id field and copy the value
    • Paste it in the corresponding field of the config/default.json file
  5. Start the server with npm run start
  6. Additionnaly create a systemd service (linux) or startup shortcut (windows) to start the server on bootup

Browser:

  1. Install a userscript extension for your browser like Tampermonkey
  2. Download & install soundcloud-rp.user.js
  3. Open soundcloud & enjoy

Artwork upload

Here is a step by step guide to activate artwork upload:

  1. In the config/default.json file, change uploadArtwork from false to true
  2. Go to the developer interface of Discord
  3. Create a new app, give it a cool name and save it
  4. Paste the Client ID (found in App Details on the top of the page) into the config/default.json file
  5. Scroll down and click "Enable Rich Presence"
  6. Hit save changes just in case
  7. Retrieve your APIKey
    • Hit ctrl+shift+i to open the devtools
    • Go to the Network tab
    • Filter by /api/
    • Click on the first result. If there is no results, try changing page to trigger some requests
    • Scroll down to the Request Headers section
    • Look for the authorization field and copy the value
    • Paste it in the corresponding field of the config/default.json file (do not forget to wrap it in double quotes as in "value")
  8. Restart your server and it should be ok!

soundcloud-rp's People

Contributors

blackofworld avatar demaisj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

soundcloud-rp's Issues

Setting up soundcloud-rp as a Windows service and automatically run it on the background

This is not really an issue, but a small guide that I hope @demaisj will add in the README, about how to setup soundcloud-rp as a Windows service and automatically run the soudcnloud-rp server as a service (and so a background process).

  1. Install node-windows globally: npm install -g node-windows
  2. Symlink node-windows into your project root: npm link node-windows inside your project.
  3. Create a service.js file which contains:
var Service = require('node-windows').Service;

var svc = new Service({
  name: 'Soundcloud to Discord-RP',
  description: 'Get a Soundcloud integration in Discord-RP.',
  script: 'C:\\path\\to\\bin\\soundcloud-rp-binary',
  nodeOptions: ['--harmony', '--max_old_space_size=4096']
});

svc.on('install',function(){
  svc.start();
});

svc.install();
  1. In the service.js, make sure to edit the script path to match YOUR soundcloud-rp location. You can retrieve the path by going into the folder explorer, getting into your soundcloud-rp\bin then right-click soundcloud-rp (yes, the one without extension which is a file), click on properties then copy the path value. Make sure to double the \ and add soundcloud-rp at the end of the path.

The final path result should look like C:\\Users\\TotomInc\\Github\\soundcloud-rp\\bin\\soundcloud-rp.

  1. Once the script is done, you need to start a terminal where your soundcloud-rp folder is and run: node service.js. This will create a new Windows service, running the soundcloud-rp server.

  2. You can verify the service have been added by checking the services.msc, to do it press windows key + R and type services.msc. You should find a service with name Soundcloud to Discord-RP. You can edit the service properties and disable it, remove it or even stop running it at startup.

Weird error

I'm getting this strange error when trying to start the server
nodejs error

Windows Script Host error

So, I did everything as it was written in the instructions, however during the last stop I encounter a major problem. I can't install the .js file. This screen pops up. https://imgur.com/7sEptLo
I've tried restarting my PC, as well as searching for a solution on the Internet. Nothing seems to work, it also says that there's an incorrect line in the code in line 13, but as far as I know, there's none.

Not an Issue

Anyway to run the server part of it on a actual server like Ubuntu-server, I already tried to by switching the ports and IP to my local ubuntu-server 18.04LTS environment and running npm im able to connect and view Client.js at http://192.168.50.120:7769/client.js

Failed to connect to discord on Raspbian 9

I'm trying to setup soundcloud-rp on my Raspberry PI running on Raspbian 9.

Running DEBUG=soundcloud-rp:* npm run start gives me:

  soundcloud-rp:trace rpc.constructor +0ms
  soundcloud-rp:trace rpc.init +7ms
  soundcloud-rp:trace rpc.connect +2ms
  soundcloud-rp:rpc Connecting to discord... +0ms
  soundcloud-rp:server Listening on port 7769 +768ms
  soundcloud-rp:trace rpc.connect.fail +11ms
  soundcloud-rp:rpc Failed to connect to discord Error: Could not connect
    at Socket.onerror (/home/pi/soundcloud-rp/node_modules/discord-rpc/src/transports/IPC.js:32:16)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at emitErrorNT (internal/streams/destroy.js:64:8)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9) +1ms
  soundcloud-rp:rpc Trying again in 10 seconds... +5ms
  • Node: v8.11.4 (latest LTS)
  • NPM: v5.6.0

EDIT: switched to latest Node (10.11.0) and it still gives the same error.

Fail to load client.js

Hi !

I followed all the steps mentionned in the readme but when I try to launch the "npm run start", nothing happens. When I check into my web browser (firefox) logs, I've got an error telling me:

"Échec du chargement pour l’élément <script> dont la source est « http://127.0.0.1:7769/client.js »."
"Fail to load for <script> element whose source is « http://127.0.0.1:7769/client.js »"

Do you know where it could come from ? Btw I'm under windows 10 and everything's up to date =)

Server connected to Discord but strange issue is preventing Rich Presence from showing.

Hello, I used Soundcloud Rich Presence back in 2018/19, and recently returned to it. I have installed the latest versions of Node.js and npm and updated the version of the repo, the soundcloud-rp.user.js and the necessary dependencies. The Rich Presence was briefly working for about 5 minutes, however after a song finished I paused SoundCloud and it hasn't been working ever since. I've tried restarting the server many times, closing/opening SoundCloud and uninstalling/reinstalling the dependencies, none of which have sorted the issue.

I ran set DEBUG=soundcloud-rp:* & npm run start and this was the result:

> soundcloud-rp@2.0.3 start
> node bin/soundcloud-rp

  soundcloud-rp:trace rpc.constructor +0ms
  soundcloud-rp:trace rpc.init +2ms
  soundcloud-rp:trace rpc.connect +0ms
  soundcloud-rp:rpc Connecting to discord... +0ms
  soundcloud-rp:server Listening on port 7769 +682ms
  soundcloud-rp:trace rpc.event.ready +192ms
  soundcloud-rp:trace rpc.connect.success +0ms
  soundcloud-rp:rpc Connected to discord! +0ms
  soundcloud-rp:trace client.connection p6SX_1Gbl4NJQWlGAAAA +2s
  soundcloud-rp:trace client.connection sIa-49lDPoTapXlLAAAB +745ms
  soundcloud-rp:trace client.event p6SX_1Gbl4NJQWlGAAAA activity { url: 'https://soundcloud.com/leotrixofficial/taking-back', pos: 3 } +16s
  soundcloud-rp:trace activity { url: 'https://soundcloud.com/leotrixofficial/taking-back', pos: 3 } +2ms
  soundcloud-rp:trace rpc.getActivity +1ms
  soundcloud-rp:activity getting track info... +0ms
  soundcloud-rp:trace soundcloud.getTrackData https://soundcloud.com/leotrixofficial/taking-back +0ms
  soundcloud-rp:activity Track info downloaded successfully. 1095688528 +214ms
  soundcloud-rp:activity Processing artwork... +1ms
  soundcloud-rp:trace activity.processArtwork 1 1095688528 https://i1.sndcdn.com/artworks-DZpyCGmyDmmOWpF7-h3z44Q-large.jpg +0ms
  soundcloud-rp:activity Generated key for artwork: track_1095688528 +1ms
  soundcloud-rp:activity Checking if artwork is already uploaded... +0ms
  soundcloud-rp:trace discord.getAssetList +0ms
  soundcloud-rp:activity Artwork not already uploaded. +208ms
  soundcloud-rp:activity Asset limit reached, deleting old unused assets... +1ms
  soundcloud-rp:trace discord.deleteAsset 519328662131310617 +0ms

As far as I can understand the Asset limit seems to be halting progress. I'm not sure what a potential fix would be but I would appreciate any help offered. :)

RP No longer works

It seems to loop on getting track info, it connects to discord and client.
Screenshot (30)

Failed to connect to Discord

Everything seems right. Running the service with the DEBUG parameter applied shows that it is able to grab the correct track, but cannot find my Discord process.
image

Too many song

Hello, I would like to report a bug I found with the artwork upload.

If the limit of assets in the discord application is at maximum, it will put nothing in the discord rich presence, I think it would be possible to fix this by putting several applications, even if I think it would be impossible to know when the limit of assets in the application is at maximum. Or another solution would be when a new music is played but there is no more space in the assets, to take the original assets (as if the artwork upload was disabled).

User mode

Hello,

Will you anyday make a not developper version?

Awesome work.

Sincerely,

RP Suddenly not working

Everything works fine, script in browser says it is on, plus PowerShell Window is perfectly fine and normal except discord isnt showing my music anymore. Game activity is on, Discord bot is still around

UnhandledPromiceRejectionWarning error

(node:33764) UnhandledPromiseRejectionWarning: Error: child "activity" fails because [child "assets" fails because [child "small_text" fails because ["small_text" length must be at least 2 characters long]]]
at RPCClient.onRpcMessage (C:\Users\outlassn\node_modules\discord-rpc\src\Client.js:171:19)
at IPCTransport.emit (events.js:188:13)
at decode (C:\Users\outlassn\node_modules\discord-rpc\src\transports\IPC.js:134:18)
at decode (C:\Users\outlassn\node_modules\discord-rpc\src\transports\IPC.js:92:5)
at Socket.socket.on (C:\Users\outlassn\node_modules\discord-rpc\src\transports\IPC.js:120:7)
at Socket.emit (events.js:188:13)
at emitReadable
(_stream_readable.js:539:12)
at process.internalTickCallback (internal/process/next_tick.js:72:19)
(node:33764) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:33764) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

This decided to happen when the song changed to https://soundcloud.com/fml/th-kid-bones-youngdumbfuck-full-album

I think (?) it might have been caused due to the person's name being 1 character? (only reason I think this is because of "["small_text" length must be at least 2 characters long]]]")

Chrome console spitting out errors

I did everything correct with no errors on the server part. Since it wasn't working, I decided to see whats in the console and this is what I found.
blmf5ib

Add a possibility to listen a music

Hi,
Like with Spotify, why you don't had a function that allow the user to listen a music that one his friends is listening.
A button like : listen it on Soundcloud and that open a new web page

It would be great and better than copy and paste the song name to find the music

Stuck at "npm run start"

Every time I write "npm run start", it gets stuck and this appears. Do you know anyway to fix?
node bin

It is normal?

npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fse
vents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.