diff --git a/mopidy/backends/gstreamer.py b/mopidy/backends/gstreamer.py index 8c291f96..30cffa6d 100644 --- a/mopidy/backends/gstreamer.py +++ b/mopidy/backends/gstreamer.py @@ -120,7 +120,7 @@ class GStreamerPlaybackController(BasePlaybackController): class GStreamerStoredPlaylistsController(BaseStoredPlaylistsController): def __init__(self, *args): super(GStreamerStoredPlaylistsController, self).__init__(*args) - self._folder = os.path.expanduser(settings.PLAYLIST_FOLDER) + self._folder = os.path.expanduser(settings.LOCAL_PLAYLIST_FOLDER) self.refresh() def refresh(self): @@ -191,11 +191,11 @@ class GStreamerLibraryController(BaseLibraryController): self.refresh() def refresh(self, uri=None): - tracks = parse_mpd_tag_cache(settings.TAG_CACHE, - settings.MUSIC_FOLDER) + tracks = parse_mpd_tag_cache(settings.LOCAL_TAG_CACHE, + settings.LOCAL_MUSIC_FOLDER) - logger.info('Loading songs in %s from %s', settings.MUSIC_FOLDER, - settings.TAG_CACHE) + logger.info('Loading songs in %s from %s', + settings.LOCAL_MUSIC_FOLDER, settings.LOCAL_TAG_CACHE) for track in tracks: self._uri_mapping[track.uri] = track diff --git a/mopidy/settings.py b/mopidy/settings.py index a2ba88e5..603faee2 100644 --- a/mopidy/settings.py +++ b/mopidy/settings.py @@ -117,13 +117,16 @@ SPOTIFY_LIB_APPKEY = u'~/.mopidy/spotify_appkey.key' SPOTIFY_LIB_CACHE = u'~/.mopidy/libspotify_cache' #: Path to playlist folder with m3u files. -PLAYLIST_FOLDER = u'~/.mopidy/playlists' +#: LOCAL_PLAYLIST_FOLDER = u'~/.mopidy/playlists' +LOCAL_PLAYLIST_FOLDER = u'~/.mopidy/playlists' #: Path to folder with local music. -MUSIC_FOLDER = u'~/music' +#: LOCAL_MUSIC_FOLDER = u'~/music' +LOCAL_MUSIC_FOLDER = u'~/music' #: Path to MPD tag_cache for local music -TAG_CACHE = u'~/.mopidy/tag_cache' +#: LOCAL_TAG_CACHE = u'~/.mopidy/tag_cache' +LOCAL_TAG_CACHE = u'~/.mopidy/tag_cache' # Import user specific settings dotdir = os.path.expanduser(u'~/.mopidy/') diff --git a/tests/backends/base.py b/tests/backends/base.py index 56bd3dd5..1bb9b50f 100644 --- a/tests/backends/base.py +++ b/tests/backends/base.py @@ -960,13 +960,13 @@ class BaseStoredPlaylistsControllerTest(object): backend_class = None def setUp(self): - self.original_playlist_folder = settings.PLAYLIST_FOLDER - self.original_tag_cache = settings.TAG_CACHE - self.original_music_folder = settings.MUSIC_FOLDER + self.original_playlist_folder = settings.LOCAL_PLAYLIST_FOLDER + self.original_tag_cache = settings.LOCAL_TAG_CACHE + self.original_music_folder = settings.LOCAL_MUSIC_FOLDER - settings.PLAYLIST_FOLDER = tempfile.mkdtemp() - settings.TAG_CACHE = data_folder('library_tag_cache') - settings.MUSIC_FOLDER = data_folder('') + settings.LOCAL_PLAYLIST_FOLDER = tempfile.mkdtemp() + settings.LOCAL_TAG_CACHE = data_folder('library_tag_cache') + settings.LOCAL_MUSIC_FOLDER = data_folder('') self.backend = self.backend_class(mixer=DummyMixer()) self.stored = self.backend.stored_playlists @@ -974,12 +974,12 @@ class BaseStoredPlaylistsControllerTest(object): def tearDown(self): self.backend.destroy() - if os.path.exists(settings.PLAYLIST_FOLDER): - shutil.rmtree(settings.PLAYLIST_FOLDER) + if os.path.exists(settings.LOCAL_PLAYLIST_FOLDER): + shutil.rmtree(settings.LOCAL_PLAYLIST_FOLDER) - settings.PLAYLIST_FOLDER = self.original_playlist_folder - settings.TAG_CACHE = self.original_tag_cache - settings.MUSIC_FOLDER = self.original_music_folder + settings.LOCAL_PLAYLIST_FOLDER = self.original_playlist_folder + settings.LOCAL_TAG_CACHE = self.original_tag_cache + settings.LOCAL_MUSIC_FOLDER = self.original_music_folder def test_create(self): playlist = self.stored.create('test') diff --git a/tests/backends/gstreamer_test.py b/tests/backends/gstreamer_test.py index 7ea0c5d1..c308d545 100644 --- a/tests/backends/gstreamer_test.py +++ b/tests/backends/gstreamer_test.py @@ -58,13 +58,13 @@ class GStreamerStoredPlaylistsControllerTest(BaseStoredPlaylistsControllerTest, backend_class = GStreamerBackend def test_created_playlist_is_persisted(self): - path = os.path.join(settings.PLAYLIST_FOLDER, 'test.m3u') + path = os.path.join(settings.LOCAL_PLAYLIST_FOLDER, 'test.m3u') self.assert_(not os.path.exists(path)) self.stored.create('test') self.assert_(os.path.exists(path)) def test_saved_playlist_is_persisted(self): - path = os.path.join(settings.PLAYLIST_FOLDER, 'test2.m3u') + path = os.path.join(settings.LOCAL_PLAYLIST_FOLDER, 'test2.m3u') self.assert_(not os.path.exists(path)) self.stored.save(Playlist(name='test2')) self.assert_(os.path.exists(path)) @@ -72,13 +72,13 @@ class GStreamerStoredPlaylistsControllerTest(BaseStoredPlaylistsControllerTest, def test_deleted_playlist_get_removed(self): playlist = self.stored.create('test') self.stored.delete(playlist) - path = os.path.join(settings.PLAYLIST_FOLDER, 'test.m3u') + path = os.path.join(settings.LOCAL_PLAYLIST_FOLDER, 'test.m3u') self.assert_(not os.path.exists(path)) def test_renamed_playlist_gets_moved(self): playlist = self.stored.create('test') - file1 = os.path.join(settings.PLAYLIST_FOLDER, 'test.m3u') - file2 = os.path.join(settings.PLAYLIST_FOLDER, 'test2.m3u') + file1 = os.path.join(settings.LOCAL_PLAYLIST_FOLDER, 'test.m3u') + file2 = os.path.join(settings.LOCAL_PLAYLIST_FOLDER, 'test2.m3u') self.assert_(not os.path.exists(file2)) self.stored.rename(playlist, 'test2') self.assert_(not os.path.exists(file1)) @@ -88,7 +88,7 @@ class GStreamerStoredPlaylistsControllerTest(BaseStoredPlaylistsControllerTest, track = Track(uri=generate_song(1)) uri = track.uri[len('file://'):] playlist = Playlist(tracks=[track], name='test') - path = os.path.join(settings.PLAYLIST_FOLDER, 'test.m3u') + path = os.path.join(settings.LOCAL_PLAYLIST_FOLDER, 'test.m3u') self.stored.save(playlist) @@ -130,15 +130,18 @@ class GStreamerLibraryControllerTest(BaseLibraryControllerTest, backend_class = GStreamerBackend def setUp(self): - self.original_tag_cache = settings.TAG_CACHE - self.original_music_folder = settings.MUSIC_FOLDER - settings.TAG_CACHE = data_folder('library_tag_cache') - settings.MUSIC_FOLDER = data_folder('') + self.original_tag_cache = settings.LOCAL_TAG_CACHE + self.original_music_folder = settings.LOCAL_MUSIC_FOLDER + + settings.LOCAL_TAG_CACHE = data_folder('library_tag_cache') + settings.LOCAL_MUSIC_FOLDER = data_folder('') + super(GStreamerLibraryControllerTest, self).setUp() def tearDown(self): - settings.TAG_CACHE = self.original_tag_cache - settings.MUSIC_FOLDER = self.original_music_folder + settings.LOCAL_TAG_CACHE = self.original_tag_cache + settings.LOCAL_MUSIC_FOLDER = self.original_music_folder + super(GStreamerLibraryControllerTest, self).tearDown() if __name__ == '__main__':