-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy path__init__.py
More file actions
64 lines (43 loc) · 2.07 KB
/
__init__.py
File metadata and controls
64 lines (43 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import pathlib
from importlib.metadata import version
from mopidy import config, ext
__version__ = version("mopidy-spotify")
class Extension(ext.Extension):
dist_name = "Mopidy-Spotify"
ext_name = "spotify"
version = __version__
def get_default_config(self):
return config.read(pathlib.Path(__file__).parent / "ext.conf")
def get_config_schema(self):
schema = super().get_config_schema()
schema["username"] = config.Deprecated() # since 5.0
schema["password"] = config.Deprecated() # since 5.0
schema["client_id"] = config.String()
schema["client_secret"] = config.Secret()
schema["bitrate"] = config.Integer(choices=(96, 160, 320))
schema["volume_normalization"] = config.Boolean()
schema["private_session"] = config.Deprecated() # since 5.0
schema["timeout"] = config.Integer(minimum=0)
schema["cache_dir"] = config.Deprecated() # since 2.0
schema["settings_dir"] = config.Deprecated() # since 2.0
schema["allow_cache"] = config.Boolean()
schema["cache_size"] = config.Integer(minimum=0)
schema["allow_network"] = config.Deprecated() # since 5.0
schema["allow_playlists"] = config.Boolean()
schema["search_album_count"] = config.Integer(minimum=0, maximum=200)
schema["search_artist_count"] = config.Integer(minimum=0, maximum=200)
schema["search_track_count"] = config.Integer(minimum=0, maximum=200)
schema["toplist_countries"] = config.Deprecated() # since 5.0
return schema
def setup(self, registry):
from mopidy_spotify.backend import SpotifyBackend # noqa: PLC0415
registry.add("backend", SpotifyBackend)
def get_command(self):
from .commands import SpotifyCommand # noqa: PLC0415
return SpotifyCommand()
@classmethod
def get_credentials_dir(cls, config):
data_dir = cls.get_data_dir(config)
credentials_dir = data_dir / "credentials-cache"
credentials_dir.mkdir(mode=0o700, exist_ok=True)
return credentials_dir