feat: Adds jellyfin external URL and timeout gh-13

- Adds Jellyfin external URL config option - URL to send to users if
 different from server URL.
 - Adds Jellyfin server setup timeout after 5 seconds, and response
 delaying so discord bot doesn't timeout

task: gh-13
This commit is contained in:
Yoruio
2022-07-16 14:18:04 -06:00
parent 3a4ddbd627
commit 11b42cff53
5 changed files with 39 additions and 13 deletions

View File

@@ -12,7 +12,7 @@ config = configparser.ConfigParser()
CONFIG_KEYS = ['username', 'password', 'discord_bot_token', 'plex_user', 'plex_pass',
'plex_roles', 'plex_server_name', 'plex_libs', 'owner_id', 'channel_id',
'auto_remove_user', 'jellyfin_api_key', 'jellyfin_server_url', 'jellyfin_roles',
'jellyfin_libs', 'plex_enabled', 'jellyfin_enabled']
'jellyfin_libs', 'plex_enabled', 'jellyfin_enabled', 'jellyfin_external_url']
# settings
Discord_bot_token = ""
@@ -96,6 +96,14 @@ except:
print("Could not load Jellyfin config")
jellyfin_configured = False
try:
JELLYFIN_EXTERNAL_URL = config.get(BOT_SECTION, "jellyfin_external_url")
if not JELLYFIN_EXTERNAL_URL:
JELLYFIN_EXTERNAL_URL = JELLYFIN_SERVER_URL
except:
JELLYFIN_EXTERNAL_URL = JELLYFIN_SERVER_URL
print("Could not get Jellyfin external url. Defaulting to server url.")
# Get Jellyfin roles config
try:
jellyfin_roles = config.get(BOT_SECTION, 'jellyfin_roles')