-
Notifications
You must be signed in to change notification settings - Fork 14
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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)) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 .
There was a problem hiding this comment.
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.
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.