Made spotipy an optional dependency
This commit is contained in:
parent
c2b19eef33
commit
58f2b875fa
|
@ -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,10 +51,12 @@ def download(url, bitrate, portable, path):
|
|||
with open(configFolder / '.arl', 'w') as f:
|
||||
f.write(arl)
|
||||
|
||||
plugins = {
|
||||
"spotify": Spotify(configFolder=configFolder)
|
||||
}
|
||||
plugins["spotify"].setup()
|
||||
plugins = {}
|
||||
if Spotify:
|
||||
plugins = {
|
||||
"spotify": Spotify(configFolder=configFolder)
|
||||
}
|
||||
plugins["spotify"].setup()
|
||||
|
||||
def downloadLinks(url, bitrate=None):
|
||||
if not bitrate: bitrate = settings.get("maxBitrate", TrackFormats.MP3_320)
|
||||
|
@ -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()
|
||||
|
|
5
setup.py
5
setup.py
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue