-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I can't manage to get all Artworks to upload with 2.0.2 version of foo_discord_rich #91
Comments
i am having the same issue, except i am using the standalone binary for imgur. There is also no context menu options for working with this update unlike how there were context menu options to upload artwork/delete artwork/etc in 1.3.0 beta. Ive managed to get some albums to attempt to upload but either the process times out very fast or i have to go through a cycle of manipulating the art cache. |
I'd like to use this feature also but I never had a python script to make this work. My artworks are all embedded. Is there any guidance on what is needed? Or is there a script already uploaded here that I can't seem to find? |
I use a Python script that uploads to catbox.moe, modified a bit to support saving errors to a log file and automatically resize large images to 100x100. The command I use is:
from io import BytesIO
import logging
import os
import sys
import traceback
from PIL import Image
import requests
logging.basicConfig(filename="foobar_cover_upload.log", encoding="utf-8",
format="%(asctime)s %(levelname)-8s %(message)s")
try:
sys.stdin.reconfigure(encoding='utf-8') # noqa
filename = sys.stdin.read().strip()
api_url = "https://catbox.moe/user/api.php"
data = {
'reqtype': (None, 'fileupload'),
}
if os.path.getsize(filename) > 262144: # .25 MB in bytes
img = Image.open(filename)
img.thumbnail((100, 100), Image.LANCZOS, reducing_gap=3.0)
with BytesIO() as buffer:
if img.mode == "RGBA":
background = Image.new("RGBA", img.size, (255, 255, 255))
alpha_composite = Image.alpha_composite(background, img).convert("RGB")
alpha_composite.save(buffer, "jpeg", quality=80)
else:
img.save(buffer, format="jpeg", quality=80)
buffer.seek(0)
buffer.name = "cover.jpg"
data['fileToUpload'] = buffer
r = requests.post(api_url, files=data)
else: # Image does not need to be resized
with open(filename, 'rb') as f:
data['fileToUpload'] = f
r = requests.post(api_url, files=data)
if not r.ok:
logging.error(r.text)
print(r.text[:1000])
sys.exit(1)
if not r.text:
logging.error(f"Received empty string instead of URL for {filename}")
sys.exit(1)
print(r.text, end='')
except Exception as e: # noqa
logging.error(str(e))
traceback.print_exc(file=sys.stdout)
sys.exit(1) Note that this does require modules requests and Pillow ( |
Does this requiere a created api on my own? or? |
Nope, just what I posted. Actually, you don't even need to find the whole path of your Python install, the command could just be |
As the title says, I always used the 1.3.0-beta of Discord Rich Presence Integration, and using python has worked flawless, however, I decided to update yesterday to the 2.0.2 using python aswell, but it seems most artwork covers won't upload to Discord and show default foobar image.
This is with 1.3.0
Command used
and then C:\Path\To\script.py (script? i guess?)
but when using the 2.0.2
Command used:
(which is the same, copypasted)
Is this an issue at my end? Thank you for your attention
I'm also using foobar 32 bit.
I don't know if I need any other info to be dropped, thank you.
The text was updated successfully, but these errors were encountered: