diff --git a/mopidy/backends/libspotify.py b/mopidy/backends/libspotify.py index edd4567e..67b65318 100644 --- a/mopidy/backends/libspotify.py +++ b/mopidy/backends/libspotify.py @@ -1,5 +1,6 @@ import datetime as dt import logging +import os import multiprocessing import threading @@ -7,7 +8,7 @@ from spotify import Link from spotify.manager import SpotifySessionManager from spotify.alsahelper import AlsaController -from mopidy import settings +from mopidy import get_version, settings from mopidy.backends import (BaseBackend, BaseCurrentPlaylistController, BaseLibraryController, BasePlaybackController, BaseStoredPlaylistsController) @@ -157,6 +158,11 @@ class LibspotifyTranslator(object): class LibspotifySessionManager(SpotifySessionManager, threading.Thread): + cache_location = os.path.expanduser(settings.SPOTIFY_LIB_CACHE) + settings_location = os.path.expanduser(settings.SPOTIFY_LIB_CACHE) + appkey_file = os.path.expanduser(settings.SPOTIFY_LIB_APPKEY) + user_agent = 'Mopidy %s' % get_version() + def __init__(self, username, password, core_queue): SpotifySessionManager.__init__(self, username, password) threading.Thread.__init__(self) diff --git a/mopidy/settings.py b/mopidy/settings.py index 42454a79..6cb2928e 100644 --- a/mopidy/settings.py +++ b/mopidy/settings.py @@ -95,6 +95,12 @@ SPOTIFY_USERNAME = u'' #: Your Spotify Premium password. Used by all Spotify backends. SPOTIFY_PASSWORD = u'' +#: Path to your libspotify application key. Used by LibspotifyBackend. +SPOTIFY_LIB_APPKEY = u'~/.mopidy/spotify_appkey.key' + +#: Path to the libspotify cache. Used by LibspotifyBackend. +SPOTIFY_LIB_CACHE = u'~/.mopidy/libspotify_cache' + # Import user specific settings dotdir = os.path.expanduser(u'~/.mopidy/') settings_file = os.path.join(dotdir, u'settings.py')