Skip to content

Commit

Permalink
Update music_caster.py
Browse files Browse the repository at this point in the history
  • Loading branch information
elibroftw committed Sep 27, 2019
1 parent b814ea5 commit 46ddb8f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions music_caster.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,17 @@ def download_and_extract(link, infile, outfile=None):
os.rename(f'{starting_dir}/Update/{infile}', outfile)


shortcut_path = f'C:/Users/{getuser()}/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/Music Caster.lnk'
# Mine: C:\Users\maste\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup


def startup_setting():
run_on_startup = settings['run on startup']
shortcut_exists = os.path.exists(shortcut_path)
if run_on_startup and not shortcut_exists and not settings.get('DEBUG', False):
shell = win32com.client.Dispatch('WScript.Shell')
shortcut = shell.CreateShortCut(shortcut_path)
if getattr(sys, 'frozen', False): # Running in a bundle
# C:\Users\maste\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
target = f'{starting_dir}\\Music Caster.exe'
else: # set shortcut to python script; __file__
bat_file = f'{starting_dir}\\music_caster.bat'
Expand Down Expand Up @@ -172,7 +175,6 @@ def chromecast_callback(chromecast):
threading.Thread(target=app.run, daemon=True, kwargs={'host': '0.0.0.0', 'port': PORT}).start()
break
except OSError: PORT += 1

if settings['auto update']:
with suppress(requests.ConnectionError):
github_url = 'https://github.com/elibroftw/music-caster/releases'
Expand Down Expand Up @@ -207,9 +209,6 @@ def chromecast_callback(chromecast):
download_and_extract(source_download_link, f'music-caster-{latest_version}/updater.py', 'updater.pyw')
Popen('pythonw updater.pyw')
sys.exit()

shortcut_path = f'C:/Users/{getuser()}/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/Music Caster.lnk'

startup_setting()
update_devices = False
chromecasts = []
Expand Down

0 comments on commit 46ddb8f

Please sign in to comment.