Made spotipy an optional dependency

This commit is contained in:
RemixDev 2021-09-21 18:32:20 +02:00
parent c2b19eef33
commit 58f2b875fa
No known key found for this signature in database
GPG Key ID: B33962B465BDB51C
2 changed files with 14 additions and 7 deletions

View File

@ -11,7 +11,10 @@ from deemix.utils import getBitrateNumberFromText, formatListener
import deemix.utils.localpaths as localpaths
from deemix.downloader import Downloader
from deemix.itemgen import GenerationError
from deemix.plugins.spotify import Spotify
try:
from deemix.plugins.spotify import Spotify
except ImportError:
Spotify = None
class LogListener:
@classmethod
@ -48,6 +51,8 @@ def download(url, bitrate, portable, path):
with open(configFolder / '.arl', 'w') as f:
f.write(arl)
plugins = {}
if Spotify:
plugins = {
"spotify": Spotify(configFolder=configFolder)
}
@ -77,7 +82,6 @@ def download(url, bitrate, portable, path):
downloadObjects.append(downloadObject)
for obj in downloadObjects:
print(obj.__type__)
if obj.__type__ == "Convertable":
obj = plugins[obj.plugin].convert(dz, obj, settings, listener)
Downloader(dz, obj, settings, listener).start()

View File

@ -23,7 +23,10 @@ setup(
python_requires='>=3.7',
packages=find_packages(exclude=("tests",)),
include_package_data=True,
install_requires=["click", "pycryptodomex", "mutagen", "requests", "spotipy>=2.11.0", "deezer-py>=1.1.2"],
install_requires=["click", "pycryptodomex", "mutagen", "requests", "deezer-py>=1.2.2"],
extras_require={
"spotify": ["spotipy>=2.11.0"]
},
entry_points={
"console_scripts": [
"deemix=deemix.__main__:download",