sll552 / DiscordBee

MusicBee plugin that updates your Discord status with the currently playing track
Apache License 2.0
422 stars 31 forks source link

Migrate to freeimage.host #231

Open FluffyDiscord opened 1 year ago

FluffyDiscord commented 1 year ago

Is your feature request related to a problem? Please describe. Imgur currently has too many issues.

It would be nice to leave it die and move on to something different. Searching internet brought me to https://freeimage.host/ as it's probably the only free, storage unlimited, api rate unlimited, time stored unlimited, account free image uploader I could find.

Describe the solution you'd like Move from Imgur.com to Freeimage.host

Describe alternatives you've considered Creating my own public API that this project could use

Additional context https://freeimage.host/page/api

sll552 commented 1 year ago

I did not look at it in detail but I couldn't find anything that would prevent using it. I mean there is the clause about copyrighted material but that's everywhere 😅 I do wonder however how they make money, storage isn't free und they don't seem to have any advertisements in place or anything else that would earn them some money 🤔

The API documentation is unfortunately very basic, private albums are mentioned but not described in the API documentation. But that's something I could figure out I guess. It seems like this is just a public instance of https://v4-docs.chevereto.com/developer/api/api-v1.html so maybe the api is the same.

FluffyDiscord commented 1 year ago

I have no idea how they make money and I think I do not even care 😅. Are private albums even necessary? Does it matter if the album art is public-by-direct-link or public-anywhere? They do not seem to index the images on search engines, only inside themselves and they are searched by name, so using some hashing for filenames would make them basically "private".

You would have to store the image index locally, which seems like an okay way, either json/xml/plain txt.

Listed API (chevereto) does not seem like that's the thing they use. The api key is in a query parameter on FMH, but in a header in chevereto. Also there does not seem to be any time limit (expiration), but chevereto requires specifying that.

We just need something simple, public and hopefully without stupid limits. If we resize the album art locally to something more reasonable like 256x256px and then upload it to FMH, they shouldn't trigger anything against us (afaik, reading their ToS)

sll552 commented 1 year ago

Private albums would make it much more unlikely that anything gets claimed etc. because after all those images will be uploaded using your user/IP and not mine. So if there are legal issues those would hit the individual user which I would like to avoid.

Listed API (chevereto) does not seem like that's the thing they use. The api key is in a query parameter on FMH, but in a header in chevereto. Also there does not seem to be any time limit (expiration), but chevereto requires specifying that.

On their homepage, they state that they are using an "optimized" version of it.

If we resize the album art locally to something more reasonable like 256x256px and then upload it to FMH, they shouldn't trigger anything against us (afaik, reading their ToS)

What are you referring to, I couldn't find anything regarding image dimensions?

You would have to store the image index locally, which seems like an okay way, either json/xml/plain txt.

This is basically what the "cache" does currently.

FluffyDiscord commented 1 year ago

What are you referring to, I couldn't find anything regarding image dimensions?

Not much about the dimension but fhere is 64MB hard upload limit per image. You also shouldn't upload 6k cover scans that take 20MB or more. Discord should receive something smaller as it also loads faster and saves mobile data. But I see that I overlooked that the FIH also makes automatically thumbnails for us, which we could use instead.

FluffyDiscord commented 1 year ago

Any updates on this please? I am literally permanently "IP is rate limited". Plugin is currently unfortunately not uploading anything because of it (or showing old stuff, since that's been removed/disabled?).

FluffyDiscord commented 1 year ago

@sll552 any updates on this please?

VZCE commented 11 months ago

Same issue here, i'm also IP Rate limited

LiMoon commented 11 months ago

Is there any way to develop another way for users to upload images using the chevereto API?

I would like to use my own private hosted chevereto library to upload album images, thank you.

Chris1320 commented 11 months ago

Is there any way to develop another way for users to upload images using the chevereto API?

That is another service that could be supported.

One thing I can think of is to make something like a plugin API so that it is easier to add other platforms, and anyone can use a service they would like to use.

snoobler commented 9 months ago

Been about 2 years and I am still rate limited....

sll552 commented 9 months ago

Is there any way to develop another way for users to upload images using the chevereto API?

That is another service that could be supported.

One thing I can think of is to make something like a plugin API so that it is easier to add other platforms, and anyone can use a service they would like to use.

I tried to design the upload stuff in a way that makes it easy to extend or swap out e.g. the hosting service.

What I mean is that it should be easy to look at the code and add/replace a hosting service with basic skills in C#. A plugin api for such a small project would be way too much, I would much rather review a pull requests that adds hosting service selection and a new service.

ArcticFox037 commented 4 months ago

Is there any way to develop another way for users to upload images using the chevereto API?

Would like to add 'catbox.moe' to the list of potential hosts

suflors commented 2 months ago

Is there any way to develop another way for users to upload images using the chevereto API?

That is another service that could be supported. One thing I can think of is to make something like a plugin API so that it is easier to add other platforms, and anyone can use a service they would like to use.

I tried to design the upload stuff in a way that makes it easy to extend or swap out e.g. the hosting service.

What I mean is that it should be easy to look at the code and add/replace a hosting service with basic skills in C#. A plugin api for such a small project would be way too much, I would much rather review a pull requests that adds hosting service selection and a new service.

Might be willing to check this out, would be nice to know if you're still around to potentially review pull requests given it's been quite a while since your last activity on this project from what I can see.

That being said, I do think that if another service is available, Imgur should maybe just be completely removed, reading through the issues here it seems like it has had a history of problems, I would personally prioritize getting something in place that actually works and then worry about hosting service selection and variety.

sll552 commented 2 months ago

Yes, i am still around 😉 and happy to review 🙂

ungive commented 1 month ago

@sll552 @suflors @FluffyDiscord

I'd love to bring your attention to two of my projects: loon (open-source) and Music Presence (closed-source)

TL;DR: loon is a client-server protocol which solves this problem once and for all. You can try it right now using Music Presence, my own implementation of a Discord status which shows what you are listening to (works with any media player and uses a scaled-down 100x100 crop of the image, which is usually 20-30 KB and basically loads instantly).

Personally, I think this solves the problem once and for all. If anyone is interested in contributing, I'd be happy to explain where explanation is still needed. The project lacks libraries in languages other than C++ at the moment.


I've taken the time to write a short introduction to the project:

I faced the same issue as you guys here with my application that shows currently playing music: I wanted to upload an image I had available locally, but without storing it indefinitely or publicly. I recognized that a general solution for it would be very desirable, not only for this use case, but potentially many others that require functionality to "upload temporarily on the go".

As a result loon emerged (stands for "local files online").

loon is made up of two components: A client program/library that intends to upload an image and make it available to the internet, and a Websocket server, that sits on the internet. Clients connect to this server and maintain a Websocket connection for the duration they want to make an image available (i.e. for as long as your Discord status is active). Clients have the option to "generate" an unguessable URL that points to the server while they are connected. Sending a GET request to that URL will forward it through the websocket connection to the client upon which the client responds with the image data, which is then served by the server. The loon server basically acts as a proxy, but it's very stripped down in functionality and carefully designed, such that the risks of a traditional proxy are mitigated.

The client and server adhere to a strict and well-defined communication protocol (see the specification below).

Pros:

Cons (atm):

Additional notes:

Here's some example code on how simple it is to use (C++).
Registered content is served by another thread in the background and is fully abstracted away. There are numerous configuration options and the library is well-documented, both in code and in specification (see below).

loon::ClientOptions options;
// ... (populate options)
// The server URL is just an example, it doesn't work:
loon::Client client("wss://proxy.musicpresence.io/ws", options);
client.start();
if (!client->wait_until_connected(20s)) {
    return -1;
}
// From this point on there are no additional delays.
std::string content = "<h1>It works!";
std::string content_type = "text/html";
std::vector<char> content_data(content.begin(), content.end());
auto content_source = std::make_shared<loon::BufferContentSource>(content_data, content_type);
loon::ContentInfo content_info;
content_info.path = "index.html";
content_info.max_cache_duration = 30; // 30 seconds
auto handle = client->register_content(content_source, content_info);
std::cout << "URL: " << handle->url() << std::endl;
// Prints e.g.
// https://proxy.musicpresence.io/v0/0VsGFdeG7vXxFtkoLTI6iQ/ey1bIt141isIczx5WTJ1EROGK0pvhm7aM8Nypr9mh5A/index.html
//                                   ^--- Client ID         ^--- Message Authentication Code (HMAC)     ^--- Path

Documentation:


Would love to hear your thoughts, as I've worked hard the last couple months to make this a reality!

HeartbeatingForCenturies commented 1 month ago

what vers, of musicbee does this work for? it's unable to find its presence of my songs playing

ungive commented 1 month ago

Read here: https://github.com/ungive/discord-music-presence/blob/master/PLAYERS.md#music-bee

Music Bee works well with this plugin: https://github.com/HenryPDT/mb_MediaControl

The installation of such a plugin is required because otherwise MusicBee does not report what it is playing to Windows. Once you have installed and enabled it, Music Presence should detect Music Bee.

FluffyDiscord commented 1 month ago

Theres no source code available, which is worrying. Also, if I understand your docs, you cannot use your own music covers. You get them from MusicBrainz. Not what we are looking for.

ungive commented 1 month ago

I linked to the source code at the top of my post: https://github.com/ungive/loon.

My Discord status is the only thing that is closed-source, you can try it if you want, but you don't have to. There are command line examples in the loon repository to test it yourself with just the open-source code. I'm happy to host a public test instance of the server and improve the CLI program, if there is genuine interest in it.

Also, if I understand your docs, you cannot use your own music covers. You get them from MusicBrainz.

Where did you read that? The only mention of MusicBrainz is here, where I explain that the use of it is now obsolete. No external API is used, except the loon server for cover images (which I am hosting myself, just as you can with the source code). This is the first sentence of the documentation (emphasis mine):

Starting with version 2.2.0, Music Presence uses cover images from music players by default instead of relying on external API services to get an image for the album cover of the currently playing song.

What this means is that the image is used that the media player reports to the operating system. This will indirectly use your local images if you use the open-source mb_MediaControl extension for MusicBee that I mentioned above.

In summary: It's open-source, you can use your own covers and MusicBrainz ist not used in any way.

FluffyDiscord commented 1 month ago

Ah, alright. Thank you for the explanation. As always, reading is too hard.