wxllow / applemusicrp

Discord Rich Presence for Apple Music w/ Album Artwork!
MIT License
67 stars 5 forks source link

(Windows) iTunes re-opening itself #12

Open wxllow opened 2 years ago

wxllow commented 2 years ago

If you close iTunes while AppleMusicRP is running, it will reopen itself.

The code that handles this and causes this is here

benjjvi commented 2 years ago

Was scrolling through GitHub and found this issue,

When integrating win32com to iTunes, it will always attempt to find that process, even if it is closed. This causes the effect of reopening the program.

Fixing it should be easy enough. Within the win32com documentation (should be) instructions on how to kill a dispatch hook. Simply killing it will make sure it doesn't spawn again. Implementation is as easy as setting a flag for hooking to iTunes for the first time since the program is ran, and then killing the win32com variable as soon as iTunes is not detected.

wxllow commented 2 years ago

Was scrolling through GitHub and found this issue,

When integrating win32com to iTunes, it will always attempt to find that process, even if it is closed. This causes the effect of reopening the program.

Fixing it should be easy enough. Within the win32com documentation (should be) instructions on how to kill a dispatch hook. Simply killing it will make sure it doesn't spawn again. Implementation is as easy as setting a flag for hooking to iTunes for the first time since the program is ran, and then killing the win32com variable as soon as iTunes is not detected.

Thank you for this! I'll try it soon

benjjvi commented 2 years ago

Thank you for this! I'll try it soon

Any luck so far?

pebxcvi commented 1 year ago

on windows, you can kill the task with a simple vbs script.

Set WshShell = CreateObject("WScript.Shell") WshShell.Run "taskkill /f /im AppleMusicRP.exe"

save as stopAppleMusicRP.vbs

benjjvi commented 1 year ago

on windows, you can kill the task with a simple vbs script.

Set WshShell = CreateObject("WScript.Shell") WshShell.Run "taskkill /f /im AppleMusicRP.exe"

save as stopAppleMusicRP.vbs

that would be a good idea to bodge, but it would probably be easier to just implement it directly into the script. i haven't been here for a while as ive been working on my own version, but we use the same library.