1

fix discord-less mode

This commit is contained in:
Evan Pratten 2023-12-31 11:42:06 -05:00
parent 9dfadb8eaa
commit 17812efff4

View File

@ -101,11 +101,13 @@ def main() -> int:
# Configure discord presence
discord_presence = pypresence.Presence(DISCORD_CLIENT_ID)
if not args.no_presence:
discord_presence.connect()
launch_start = int(time.time())
# Ensure we have wineasio
if not (WINEASIO_SRC_PATH / "build64").exists():
if not args.no_presence:
discord_presence.update(
start=launch_start,
large_image=DISCORD_ICON,
@ -120,6 +122,7 @@ def main() -> int:
# Ensure that the bottle has the wineasio dll
if not (wineprefix / ".wineasio-installed").is_file():
logger.info("Registering wineasio")
if not args.no_presence:
discord_presence.update(
start=launch_start,
large_image=DISCORD_ICON,
@ -156,6 +159,7 @@ def main() -> int:
)
# Update the presence message
if not args.no_presence:
discord_presence.update(
start=launch_start,
large_image=DISCORD_ICON,
@ -165,10 +169,6 @@ def main() -> int:
],
)
# Immediately cancel the presence if requested
if args.no_presence:
discord_presence.close()
# Launch Ableton via bottles
if not args.dry_run:
logger.info("Launching Ableton")
@ -176,6 +176,7 @@ def main() -> int:
["bottles-cli", "run", "-b", args.bottle, "-p", args.program],
env=ableton_env,
)
if not args.no_presence:
discord_presence.close()
return return_code
@ -183,6 +184,7 @@ def main() -> int:
logger.info("Dry run, not launching Ableton")
logger.info("Press enter to continue")
input()
if not args.no_presence:
discord_presence.close()
return 0