mirror of
https://github.com/SinTan1729/TvTimeToTrakt.git
synced 2025-04-19 09:30:01 -05:00
Prompt config if it doesn't exist
This commit is contained in:
parent
5b31823c27
commit
01c683f78a
1 changed files with 23 additions and 20 deletions
|
@ -58,6 +58,7 @@ def isAuthenticated():
|
|||
|
||||
|
||||
def getConfiguration() -> Config:
|
||||
try:
|
||||
with open("config.json") as f:
|
||||
data = json.load(f)
|
||||
|
||||
|
@ -67,6 +68,14 @@ def getConfiguration() -> Config:
|
|||
data["CLIENT_SECRET"],
|
||||
data["GDPR_WORKSPACE_PATH"],
|
||||
)
|
||||
except FileNotFoundError:
|
||||
logging.info("config.json not found prompting user for input")
|
||||
return Config(
|
||||
input("Enter your Trakt.tv username: "),
|
||||
input("Enter you Client id: "),
|
||||
input("Enter your Client secret: "),
|
||||
input("Enter your GDPR workspace path: ")
|
||||
)
|
||||
|
||||
|
||||
config = getConfiguration()
|
||||
|
@ -817,8 +826,6 @@ def start():
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Check that the user has created the config file
|
||||
if os.path.exists("config.json"):
|
||||
# Check that the user has provided the GDPR path
|
||||
if os.path.isdir(config.gdpr_workspace_path):
|
||||
start()
|
||||
|
@ -828,7 +835,3 @@ if __name__ == "__main__":
|
|||
+ config.gdpr_workspace_path
|
||||
+ "' does not exist on the local system. Please check it, and try again."
|
||||
)
|
||||
else:
|
||||
logging.error(
|
||||
"The 'config.json' file cannot be found - have you created it yet?"
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue