BUG FIXES
This commit is contained in:
@@ -41,98 +41,103 @@ if(path.exists('bot.env')):
|
||||
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
|
||||
try:
|
||||
Discord_bot_token = str(os.environ['token'])
|
||||
switch = 1
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
if(path.exists(CONFIG_PATH)):
|
||||
config = configparser.ConfigParser()
|
||||
config.read(CONFIG_PATH)
|
||||
if not (path.exists(CONFIG_PATH)):
|
||||
with open (CONFIG_PATH, 'w') as fp:
|
||||
pass
|
||||
|
||||
# Get Plex config
|
||||
try:
|
||||
PLEXUSER = config.get(BOT_SECTION, 'plex_user')
|
||||
PLEXPASS = config.get(BOT_SECTION, 'plex_pass')
|
||||
PLEX_SERVER_NAME = config.get(BOT_SECTION, 'plex_server_name')
|
||||
except:
|
||||
print("Could not load plex config")
|
||||
plex_configured = False
|
||||
|
||||
# Get Plex roles config
|
||||
try:
|
||||
plex_roles = config.get(BOT_SECTION, 'plex_roles')
|
||||
except:
|
||||
print("Could not get Plex roles config")
|
||||
plex_roles = None
|
||||
if plex_roles:
|
||||
plex_roles = list(plex_roles.split(','))
|
||||
else:
|
||||
plex_roles = []
|
||||
|
||||
# Get Plex libs config
|
||||
try:
|
||||
Plex_LIBS = config.get(BOT_SECTION, 'plex_libs')
|
||||
except:
|
||||
print("Could not get Plex libs config. Defaulting to all libraries.")
|
||||
Plex_LIBS = None
|
||||
if Plex_LIBS is None:
|
||||
Plex_LIBS = ["all"]
|
||||
else:
|
||||
Plex_LIBS = list(Plex_LIBS.split(','))
|
||||
|
||||
# Get Jellyfin config
|
||||
try:
|
||||
JELLYFIN_SERVER_URL = config.get(BOT_SECTION, 'jellyfin_server_url')
|
||||
JELLYFIN_API_KEY = config.get(BOT_SECTION, "jellyfin_api_key")
|
||||
except:
|
||||
print("Could not load Jellyfin config")
|
||||
jellyfin_configured = False
|
||||
config = configparser.ConfigParser()
|
||||
config.read(CONFIG_PATH)
|
||||
|
||||
# Get Jellyfin roles config
|
||||
try:
|
||||
jellyfin_roles = config.get(BOT_SECTION, 'jellyfin_roles')
|
||||
except:
|
||||
print("Could not get Jellyfin roles config")
|
||||
jellyfin_roles = None
|
||||
if jellyfin_roles:
|
||||
jellyfin_roles = list(jellyfin_roles.split(','))
|
||||
else:
|
||||
jellyfin_roles = []
|
||||
# Get Plex config
|
||||
try:
|
||||
PLEXUSER = config.get(BOT_SECTION, 'plex_user')
|
||||
PLEXPASS = config.get(BOT_SECTION, 'plex_pass')
|
||||
PLEX_SERVER_NAME = config.get(BOT_SECTION, 'plex_server_name')
|
||||
except:
|
||||
print("Could not load plex config")
|
||||
plex_configured = False
|
||||
|
||||
# Get Jellyfin libs config
|
||||
try:
|
||||
jellyfin_libs = config.get(BOT_SECTION, 'jellyfin_libs')
|
||||
except:
|
||||
print("Could not get Jellyfin libs config. Defaulting to all libraries.")
|
||||
jellyfin_libs = None
|
||||
if jellyfin_libs is None:
|
||||
jellyfin_libs = ["all"]
|
||||
else:
|
||||
jellyfin_libs = list(jellyfin_libs.split(','))
|
||||
# Get Plex roles config
|
||||
try:
|
||||
plex_roles = config.get(BOT_SECTION, 'plex_roles')
|
||||
except:
|
||||
print("Could not get Plex roles config")
|
||||
plex_roles = None
|
||||
if plex_roles:
|
||||
plex_roles = list(plex_roles.split(','))
|
||||
else:
|
||||
plex_roles = []
|
||||
|
||||
# Get Plex libs config
|
||||
try:
|
||||
Plex_LIBS = config.get(BOT_SECTION, 'plex_libs')
|
||||
except:
|
||||
print("Could not get Plex libs config. Defaulting to all libraries.")
|
||||
Plex_LIBS = None
|
||||
if Plex_LIBS is None:
|
||||
Plex_LIBS = ["all"]
|
||||
else:
|
||||
Plex_LIBS = list(Plex_LIBS.split(','))
|
||||
|
||||
# Get Enable config
|
||||
try:
|
||||
USE_JELLYFIN = config.get(BOT_SECTION, 'jellyfin_enabled')
|
||||
USE_JELLYFIN = USE_JELLYFIN.lower() == "true"
|
||||
except:
|
||||
print("Could not get Jellyfin enable config. Defaulting to False")
|
||||
USE_JELLYFIN = False
|
||||
|
||||
try:
|
||||
USE_PLEX = config.get(BOT_SECTION, "plex_enabled")
|
||||
USE_PLEX = USE_PLEX.lower() == "true"
|
||||
except:
|
||||
print("Could not get Plex enable config. Defaulting to False")
|
||||
USE_PLEX = False
|
||||
|
||||
try:
|
||||
synced = not (float(config.get(BOT_SECTION, "sync_version")) < MEMBARR_VERSION)
|
||||
except:
|
||||
print("Could not find previously synced version. Setting synced to false.")
|
||||
synced = False
|
||||
# Get Jellyfin config
|
||||
try:
|
||||
JELLYFIN_SERVER_URL = config.get(BOT_SECTION, 'jellyfin_server_url')
|
||||
JELLYFIN_API_KEY = config.get(BOT_SECTION, "jellyfin_api_key")
|
||||
except:
|
||||
print("Could not load Jellyfin config")
|
||||
jellyfin_configured = False
|
||||
|
||||
# Get Jellyfin roles config
|
||||
try:
|
||||
jellyfin_roles = config.get(BOT_SECTION, 'jellyfin_roles')
|
||||
except:
|
||||
print("Could not get Jellyfin roles config")
|
||||
jellyfin_roles = None
|
||||
if jellyfin_roles:
|
||||
jellyfin_roles = list(jellyfin_roles.split(','))
|
||||
else:
|
||||
jellyfin_roles = []
|
||||
|
||||
# Get Jellyfin libs config
|
||||
try:
|
||||
jellyfin_libs = config.get(BOT_SECTION, 'jellyfin_libs')
|
||||
except:
|
||||
print("Could not get Jellyfin libs config. Defaulting to all libraries.")
|
||||
jellyfin_libs = None
|
||||
if jellyfin_libs is None:
|
||||
jellyfin_libs = ["all"]
|
||||
else:
|
||||
jellyfin_libs = list(jellyfin_libs.split(','))
|
||||
|
||||
# Get Enable config
|
||||
try:
|
||||
USE_JELLYFIN = config.get(BOT_SECTION, 'jellyfin_enabled')
|
||||
USE_JELLYFIN = USE_JELLYFIN.lower() == "true"
|
||||
except:
|
||||
print("Could not get Jellyfin enable config. Defaulting to False")
|
||||
USE_JELLYFIN = False
|
||||
|
||||
try:
|
||||
USE_PLEX = config.get(BOT_SECTION, "plex_enabled")
|
||||
USE_PLEX = USE_PLEX.lower() == "true"
|
||||
except:
|
||||
print("Could not get Plex enable config. Defaulting to False")
|
||||
USE_PLEX = False
|
||||
|
||||
try:
|
||||
synced = not (float(config.get(BOT_SECTION, "sync_version")) < MEMBARR_VERSION)
|
||||
except:
|
||||
print("Could not find previously synced version. Setting synced to false.")
|
||||
synced = False
|
||||
|
||||
def get_config():
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user