Fixed bot spawn process

This commit is contained in:
Sleepingpirates
2020-07-23 01:02:09 +00:00
parent e1dada1f4b
commit 7096505d14

View File

@@ -1,7 +1,7 @@
from flask import render_template, flash, request, redirect, url_for from flask import render_template, flash, request, redirect, url_for
from flask_login import login_user, current_user, logout_user, login_required from flask_login import login_user, current_user, logout_user, login_required
import subprocess import subprocess
import os.path
from app import app, db, bcrypt from app import app, db, bcrypt
from app.models import User from app.models import User
from app.forms import LoginForm, GeneralForm, BotForm, PlexForm from app.forms import LoginForm, GeneralForm, BotForm, PlexForm
@@ -113,3 +113,16 @@ def plex():
raise Exception(e) raise Exception(e)
return render_template('plex.html', form = form) 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.")