Created
March 26, 2020 19:10
-
-
Save cvzi/6ca766d80a2ec8c4a5891d864473807a to your computer and use it in GitHub Desktop.
For some reason the Music Manager app (to upload music files to the Google Play Music cloud) keeps crashing on my computer. This script checks every 15 seconds if the Music Manager app is running and if not restarts it by running: start MusicManager.exe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For some reason the Music Manager app (to upload music files to the | |
# Google Play Music cloud) keeps crashing on my computer. | |
# This script checks every 15 seconds if the Music Manager app is | |
# running and if not restarts it by running: start MusicManager.exe | |
# Python 3.8 | |
import subprocess | |
import time | |
import os | |
executable = os.path.expanduser( | |
r'~\AppData\Local\Programs\Google\MusicManager\MusicManager.exe') | |
def isRunning(): | |
tasklist = subprocess.getoutput('tasklist') | |
return 'MusicManager.exe' in tasklist | |
def restart(): | |
os.system(f'start {executable}') | |
if __name__ == '__main__': | |
print('Waiting for Music Manager to crash (Ctrl-C to stop):') | |
i = 0 | |
while True: | |
if isRunning(): | |
i += 1 | |
if i % 5 == 0: | |
print('.', end='', flush=True) | |
if i % 100 == 0: | |
print('\n') | |
else: | |
print('!') | |
restart() | |
print(f'{time.asctime()} - Restarted') | |
time.sleep(15) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment