Skip to content
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

Added in Discord Activity updater #34

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

gand0rf
Copy link
Contributor

@gand0rf gand0rf commented Nov 26, 2024

Added in the function to turn on and off a discord updater. Doesn't display an image right now, but will look at adding that in the future. Uses discord-rich-preasence to talk to discord api. Configurable from config file.

Copy link
Owner

@Benexl Benexl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks great just some minor fixes are required


# update discord activity for user
if config.discord == True:
discord_proc = multiprocessing.Process(target=discord_updater,args=(provider_anime_title,current_episode_number))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change it to use threading instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will test when I get back home, but MP normally does better about letting a child process run on its own then MT does. At least in my own use cases. MP will juts spawn a new proc on a different core than the one fastanime is running on.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its costly to start a whole new process and unnecessary in this case. A thread should be just efficient cause its not resource intensive

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't look like it can be changed to a thread right now. Unable to get it to successfully stop. In testing on my system, Process uses about 150 MB of ram more than doing it with a thread. I don't see it as that big of a difference. I can tinker with doing the thread think if you want, and if I have any luck in getting it to stop the thread in the future, I can open a new pull request. to change that.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah 150mb is just to large. Definitely threads, is the way to go. Don't try killing the thread directly instead. Call the pypresence stop method. And thread will exit on its own

@@ -0,0 +1,16 @@
from discordrp import Presence
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why discordrp over the popular pypresence

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't pop up in my research. Will check it out and see about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks interesting, but I see a way to actually set the activity type like I can with discordrp. Reaching out to pypresence discord to see if someone might be able to help.

uv.lock Outdated
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't manually change the lock file. Do uv add pypresence and the lock file should be updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted. So just to make sure I am clear, remove the manual addition I made. Then run uv add pypresence ("after looking into it"), and it should add everything it needs to the lock file. Right?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah be sure to remove the changes to the uv.lock and pyproject.toml Before doing it .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. removed from shell.nix file. Ran uv add dsicord-rich-presence for now until I can find out more about pypresence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants