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
|
import deemix.utils.localpaths as localpaths
|
||||||
from deemix.downloader import Downloader
|
from deemix.downloader import Downloader
|
||||||
from deemix.itemgen import GenerationError
|
from deemix.itemgen import GenerationError
|
||||||
|
try:
|
||||||
from deemix.plugins.spotify import Spotify
|
from deemix.plugins.spotify import Spotify
|
||||||
|
except ImportError:
|
||||||
|
Spotify = None
|
||||||
|
|
||||||
class LogListener:
|
class LogListener:
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -48,6 +51,8 @@ def download(url, bitrate, portable, path):
|
||||||
with open(configFolder / '.arl', 'w') as f:
|
with open(configFolder / '.arl', 'w') as f:
|
||||||
f.write(arl)
|
f.write(arl)
|
||||||
|
|
||||||
|
plugins = {}
|
||||||
|
if Spotify:
|
||||||
plugins = {
|
plugins = {
|
||||||
"spotify": Spotify(configFolder=configFolder)
|
"spotify": Spotify(configFolder=configFolder)
|
||||||
}
|
}
|
||||||
|
@ -77,7 +82,6 @@ def download(url, bitrate, portable, path):
|
||||||
downloadObjects.append(downloadObject)
|
downloadObjects.append(downloadObject)
|
||||||
|
|
||||||
for obj in downloadObjects:
|
for obj in downloadObjects:
|
||||||
print(obj.__type__)
|
|
||||||
if obj.__type__ == "Convertable":
|
if obj.__type__ == "Convertable":
|
||||||
obj = plugins[obj.plugin].convert(dz, obj, settings, listener)
|
obj = plugins[obj.plugin].convert(dz, obj, settings, listener)
|
||||||
Downloader(dz, obj, settings, listener).start()
|
Downloader(dz, obj, settings, listener).start()
|
||||||
|
|
5
setup.py
5
setup.py
|
@ -23,7 +23,10 @@ setup(
|
||||||
python_requires='>=3.7',
|
python_requires='>=3.7',
|
||||||
packages=find_packages(exclude=("tests",)),
|
packages=find_packages(exclude=("tests",)),
|
||||||
include_package_data=True,
|
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={
|
entry_points={
|
||||||
"console_scripts": [
|
"console_scripts": [
|
||||||
"deemix=deemix.__main__:download",
|
"deemix=deemix.__main__:download",
|
||||||
|
|
Loading…
Reference in New Issue