Giter Club home page Giter Club logo

Comments (5)

jonas-kaufmann avatar jonas-kaufmann commented on June 8, 2024

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.

maybeclean avatar maybeclean commented on June 8, 2024

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.

jonas-kaufmann avatar jonas-kaufmann commented on June 8, 2024

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.

jonas-kaufmann avatar jonas-kaufmann commented on June 8, 2024

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.

jonas-kaufmann avatar jonas-kaufmann commented on June 8, 2024

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)

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.