Fixed an issue related to non-existent standard input

This commit is contained in:
Phin 2023-10-30 10:02:52 +05:30
parent 0aa4ad2c86
commit d77558eaed
2 changed files with 4 additions and 3 deletions

View file

@ -17,6 +17,7 @@ import sys
import time
import urllib.parse
isInteractive = sys.stdin and sys.stdin.isatty()
plexAlertListeners: list[PlexAlertListener] = []
try:
@ -53,7 +54,7 @@ try:
logger.info("Authentication successful.")
serverName = os.environ.get("PLEX_SERVER_NAME")
if not serverName:
serverName = input("Enter the name of the Plex Media Server you wish to connect to: ") if sys.stdin.isatty() else "ServerName"
serverName = input("Enter the name of the Plex Media Server you wish to connect to: ") if isInteractive else "ServerName"
config["users"].append({ "token": authCheckResponse["authToken"], "servers": [{ "name": serverName }] })
saveConfig()
break
@ -62,7 +63,7 @@ try:
logger.info("Authentication failed.")
exit()
plexAlertListeners = [PlexAlertListener(user["token"], server) for user in config["users"] for server in user["servers"]]
if sys.stdin.isatty():
if isInteractive:
while True:
userInput = input()
if userInput in ["exit", "quit"]:

View file

@ -2,7 +2,7 @@ import os
import sys
name = "Discord Rich Presence for Plex"
version = "2.3.4"
version = "2.3.5"
plexClientID = "discord-rich-presence-plex"
discordClientID = "413407336082833418"