An in-game map request manager for Spin Rhythm XD that abstracts out functions to an HTTP GET API.
Any streaming bot you use (e.g. Streamer.bot, Firebot, MixItUp, etc.) now has request queue functionality -- so long as it supports making HTTP requests (at the minimum).
SpinRequestsTwitchBridge can also be used if you do not wish to use an external bot and stream on Twitch, but it only supports adding charts to the queue and cannot respond to actions in chat.
- SpinCore
- SpinShareLib
By default, a simple HTTP server is started on http://127.0.0.1:6969. Port and IP can be changed in the mod's JSON configuration file. A game restart is required for changes to take effect.
Caution
It is NOT RECOMMENDED to let this listen on a public IP address. Unless you know what you're doing, stick to localhost/127.x.x.x IP ranges or any LAN IP range (10.x.x.x; 172.16.x.x - 172.31.x.x; or 192.168.x.x).
Caution
If you are behind a firewall, it is NOT RECOMMENDED to forward the port you use for this HTTP server, unless you know what you are doing. Forwarding this means allowing anyone outside your local network will have full read/write access to your queue.
As this is really only a web server, you can test any of these endpoints in any web browser of your choice, while the game is running of course.
| Endpoint | Description/Example | Returns |
|---|---|---|
/add |
Adds a map to the queue. - User identifiers can be tacked on with a user query parameter. Internally this is set as a string, anything can be used so long as it's unique.- Service identifiers can be added by tacking on the service query parameter, useful if your requests come from multiple services.- Maps can be added regardless of queue status by appending the force query parameter with a true value.- HTTP response codes can be forced to 200 no matter the result to maintain compatibility with protocol-breaking software (MixItUp, Streamer.bot) by tacking on the forceTwoHundred query parameter with a true value./add/12345?user=TheBlackParrot&service=twitch |
Map Data |
/history |
Gets the session play history. - Response array length can be limited with a limit query parameter.- Responses can be limited to only charts exceeding the played threshold with a onlyPlayed query parameter set to true./history?limit=1 |
Array(Map Data) |
/query |
Queries SpinShare for basic map information./query/12345 |
Map Data |
/queue |
Gets the current request queue. - Requests from specific users can be obtained by using a user query parameter./queue?user=TheBlackParrot |
Array(Map Data) |
Base game and DLC maps will also work with the mod, but must be specifically asked for by using their identifiers (codes/numbers visible in the top-left corner of the in-game chart card when selecting a chart).
Note
Base game maps use an identifier of BG##.
For example:
- "Into the Light" by Notaker from the Monstercat DLC Pack has an ID of
MC3, which is the same identifier visible in the top-left corner of its in-game chart card. - "Humanity" by Max Brhon from the base game has an ID of
5. Since it's a base game map, it's referred to asBG5.
Note
SpinShare supports map links using file reference codes, integer IDs are not needed. (e.g. https://spinsha.re/song/spinshare_688b977c51882)
By default, a WebSocket server is started on http://127.0.0.1:6970, acting as a firehose (meaning it just spits out information, no input is taken into account). Port and IP can be changed in the mod's configuration file. A game restart is required for changes to take effect.
Caution
It is NOT RECOMMENDED to let this listen on a public IP address. Unless you know what you're doing, stick to localhost/127.x.x.x IP ranges or any LAN IP range (10.x.x.x; 172.16.x.x - 172.31.x.x; or 192.168.x.x).
This is only used for events pertaining to the queue, and actions taken on the queue to avoid feature creep with other mods adding WebSocket support for other data. You do not need to use this if you don't want to or can't use it.
You can use these events in any way you would like to -- the intentions here are listed to explain the intended use.
| Event | Intention | Data object type |
|---|---|---|
AddedToQueue |
A map was added to the queue | Map Data |
Played |
Playing a requested map | Map Data |
Skipped |
Skipping a requested map | Map Data |
RequestsAllowed |
Requests are allowed/disallowed | Boolean |
All events follow the same data structure:
{
"Timestamp": <integer (unix timestamp in ms)>,
"EventType": <string>,
"Data": <dynamic (see table above)>
}Caution
Twitch viewers/users with the Moderator status do not have any AutoMod rulesets applied to them. If your bot is a moderator in your channel, responses that are made using any of these metadata fields will be allowed through verbatim.
{
"Title": <string>,
"Subtitle": <string>,
"Artist": <string>,
"Mapper": <string> (nullable),
"Duration": <integer (nullable)>,
"SpinShareKey": <integer (nullable)>,
"NonCustomId": <string (nullable)>,
"Pack": <string (nullable)>,
"IsCustom": <bool>,
"Requester": <string>,
"RequestedAt": <integer (nullable)>
"Service": <string>,
"EasyRating": <integer (nullable)>,
"NormalRating": <integer (nullable)>,
"HardRating": <integer (nullable)>,
"ExpertRating": <integer (nullable)>,
"XDRating": <integer (nullable)>,
"RemiXDRating": <integer (nullable)>,
"ActiveDifficulty": <string (nullable)>,
"AlreadyDownloaded": <boolean>,
"FileReference": <string (nullable)> (filename of the map data),
"UploadTime": <integer (nullable)>,
"UpdateTime": <integer (nullable)>,
"HasPlayed": <boolean>,
"InQueue": <boolean>
}Note
SpinShare does not respond with any data pertaining to the RemiXD difficulty (if present), this can only be generated using data from in-game.
For the time being, this can only be set from the /history endpoint and base game/DLC maps, otherwise it will always be null.
Note
The Duration field is nullable since:
- This cannot be obtained until the track list fully loads for custom maps
- This cannot be obtained for maps from SpinShare that have not been downloaded yet (SpinShare does not provide duration data)
The Duration field will also reflect the closest difficulty to an XD difficulty's duration.
Project includes source files from websocket-sharp, licensed under MIT
