From 7096505d14be65a4e2eff9ee4d56173e6d5d1182 Mon Sep 17 00:00:00 2001 From: Sleepingpirates Date: Thu, 23 Jul 2020 01:02:09 +0000 Subject: [PATCH] Fixed bot spawn process --- app/app/routes.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/app/routes.py b/app/app/routes.py index 402a73b..5c9c6ab 100644 --- a/app/app/routes.py +++ b/app/app/routes.py @@ -1,7 +1,7 @@ from flask import render_template, flash, request, redirect, url_for from flask_login import login_user, current_user, logout_user, login_required import subprocess - +import os.path from app import app, db, bcrypt from app.models import User from app.forms import LoginForm, GeneralForm, BotForm, PlexForm @@ -113,3 +113,16 @@ def plex(): raise Exception(e) return render_template('plex.html', form = form) + +#starting bot process only if config file exist + +if os.path.exists('/app/app/config/config.ini'): + try: + manage_bot('start') + except Exception as e: + manage_bot('kill') + print(e) +else: + print("Please configure bot in the webapi and click save changes to start the bot.") + + \ No newline at end of file