Comments (5)
I have also looked into adding artworks. However, I couldn't find a way how to dynamically upload them to Discord. Can you describe how to solve this or point me to a website?
I think we can merge this feature into the master branch when ready, but keep it disabled by default. Instead, we allow the user to enter authentication details into a config file, which will then enable it. I'd like to place this file in '%localappdata%/Discord-RPC-TIDAL/config.json'. Also, this file should be easily accessible through a button in the tray menu. I can take care of the config part.
from nowplaying-for-tidal.
Discord API
I'm doing this through the assets endpoint in the Discord API. (https://discordapp.com/api/oauth2/applications/{app-id}/assets)
Depending on the request it can delete, get the asset-list or upload an asset if the authorization header is filled.
You get the asset list by just doing a simple get request to it and it returns a json of all the assets that are currently uploaded. I just end up doing a .contains on the string it returns for the "SanizitizedAlbumName".
To upload an image you can do a POST as application/json and pass through
-
The name of your asset, ["name"]
-
Type (1 or 2 but i haven't found 2 ever used or found out what it was.), ["type"]
-
Your full Base64 encoded image. ["image"]
To delete an asset you do a delete request to https://discordapp.com/api/oauth2/applications/{app-id}/assets/{asset-id}
Other Info
Album names need to be "sanitized" or free of most symbols, in the process i also force lowercase for the album name. I "sanitize" the name by passing it through a regex of @"[!@#$%^&*()+=\'[\""{\]};:<>|./?,\s-]"
and replace any matches with an underscore.
I also slightly changed the search function at Line 85
To: var searchResult = await Client.Search(LoginKey, newSong, 1000, 0, eType.SEARCH);
(Provided me more accurate results when searching for a song most of the times, and even though 1000 is the max i never really realized a slowdown.)
Example
I also have a repo that does basically the same task, just for musicbee.
from nowplaying-for-tidal.
Thank you for your detailed explanation. This is exactly what I was looking for.
Let me know, where I can help.
from nowplaying-for-tidal.
There's one thing that is still missing, which is the deletion of assets when there is no space left. I will look into this in the coming days.
If you have improvement ideas, let me know :)
from nowplaying-for-tidal.
The replacement of assets when no more space is available is now fully implemented in the form of LRU (Least Recently Used).
from nowplaying-for-tidal.
Related Issues (6)
- Support for macos :) HOT 1
- DiscordMfaToken HOT 3
- No idea what happened there HOT 1
- Not uploading artwork HOT 5
- Better artwork implementation HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nowplaying-for-tidal.