make dependency on lyricsgenius optional by moving import

This commit is contained in:
Carsten Burgard 2022-02-13 12:02:49 +01:00
parent bcbce98d91
commit a45ccb657e

View File

@ -6,7 +6,6 @@ from urllib.request import urlopen
import requests import requests
import discord import discord
import lyricsgenius
from async_timeout import timeout from async_timeout import timeout
from discord import FFmpegPCMAudio from discord import FFmpegPCMAudio
from discord.ext import commands from discord.ext import commands
@ -182,6 +181,7 @@ class Plex(commands.Cog):
self.bot_prefix = bot.command_prefix self.bot_prefix = bot.command_prefix
if kwargs["lyrics_token"]: if kwargs["lyrics_token"]:
import lyricsgenius
self.genius = lyricsgenius.Genius(kwargs["lyrics_token"]) self.genius = lyricsgenius.Genius(kwargs["lyrics_token"])
else: else:
plex_log.warning("No lyrics token specified, lyrics disabled") plex_log.warning("No lyrics token specified, lyrics disabled")