Skip to content

Commit 7903253

Browse files
committed
Release v2.2.0
2 parents 448e90a + 7968b7c commit 7903253

File tree

6 files changed

+32
-42
lines changed

6 files changed

+32
-42
lines changed

README.rst

+15-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ Dependencies
3838
The package is available as ``libspotify12`` from
3939
`apt.mopidy.com <http://apt.mopidy.com/>`__.
4040

41-
- ``pyspotify`` >= 2.0. The ``libspotify`` python wrapper. The package is
41+
- ``pyspotify`` >= 2.0. The ``libspotify`` Python wrapper. The package is
4242
available as ``python-spotify`` from apt.mopidy.com or ``pyspotify`` on PyPI.
43+
See https://pyspotify.mopidy.com/en/latest/installation/ for how to install
44+
it and its dependencies on most platforms.
4345

4446
- ``Mopidy`` >= 1.1. The music server that Mopidy-Spotify extends.
4547

@@ -133,12 +135,23 @@ Project resources
133135

134136
- `Source code <https://github.com/mopidy/mopidy-spotify>`_
135137
- `Issue tracker <https://github.com/mopidy/mopidy-spotify/issues>`_
136-
- `Download development snapshot <https://github.com/mopidy/mopidy-spotify/tarball/develop#egg=Mopidy-Spotify-dev>`_
137138

138139

139140
Changelog
140141
=========
141142

143+
v2.2.0 (2015-11-15)
144+
-------------------
145+
146+
Feature release.
147+
148+
- As Spotify now exposes your "Starred" playlist as a regular playlist, we no
149+
longer get your "Starred" playlist through the dedicated "Starred" API. This
150+
avoids your "Starred" playlist being returned twice. Lookup of
151+
``spotify:user:<username>:starred`` URIs works as before. (Fixes: #71)
152+
153+
- Interpret album year "0" as unknown. (Fixes: #72)
154+
142155
v2.1.0 (2015-09-22)
143156
-------------------
144157

mopidy_spotify/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from mopidy import config, ext
66

77

8-
__version__ = '2.1.0'
8+
__version__ = '2.2.0'
99

1010

1111
class Extension(ext.Extension):

mopidy_spotify/playlists.py

+1-22
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,7 @@ def __init__(self, backend):
1919

2020
def as_list(self):
2121
with utils.time_logger('playlists.as_list()'):
22-
return (
23-
list(self._get_starred_playlist_ref()) +
24-
list(self._get_flattened_playlist_refs()))
25-
26-
def _get_starred_playlist_ref(self):
27-
if self._backend._session is None:
28-
return
29-
30-
sp_starred = self._backend._session.get_starred()
31-
if sp_starred is None:
32-
return
33-
34-
if (
35-
self._backend._session.connection.state is
36-
spotify.ConnectionState.LOGGED_IN):
37-
sp_starred.load()
38-
39-
starred_ref = translator.to_playlist_ref(
40-
sp_starred, username=self._backend._session.user_name)
41-
42-
if starred_ref is not None:
43-
yield starred_ref
22+
return list(self._get_flattened_playlist_refs())
4423

4524
def _get_flattened_playlist_refs(self):
4625
if self._backend._session is None:

mopidy_spotify/translator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def to_album(sp_album):
6363
else:
6464
artists = []
6565

66-
if sp_album.year is not None:
66+
if sp_album.year is not None and sp_album.year != 0:
6767
date = '%d' % sp_album.year
6868
else:
6969
date = None

tests/test_playlists.py

+7-16
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
def session_mock(
1717
sp_playlist_mock,
1818
sp_playlist_folder_start_mock, sp_playlist_folder_end_mock,
19-
sp_user_mock, sp_starred_mock):
19+
sp_user_mock):
2020

2121
sp_playlist2_mock = mock.Mock(spec=spotify.Playlist)
2222
sp_playlist2_mock.is_loaded = True
@@ -32,7 +32,6 @@ def session_mock(
3232
sp_session_mock = mock.Mock(spec=spotify.Session)
3333
sp_session_mock.user = sp_user_mock
3434
sp_session_mock.user_name = 'alice'
35-
sp_session_mock.get_starred.return_value = sp_starred_mock
3635
sp_session_mock.playlist_container = [
3736
sp_playlist_mock,
3837
sp_playlist_folder_start_mock,
@@ -62,45 +61,37 @@ def test_is_a_playlists_provider(provider):
6261

6362
def test_as_list_when_not_logged_in(
6463
session_mock, provider):
65-
session_mock.get_starred.return_value = None
6664
session_mock.playlist_container = None
6765

6866
result = provider.as_list()
6967

7068
assert len(result) == 0
7169

7270

73-
def test_as_list_when_offline(session_mock, sp_starred_mock, provider):
71+
def test_as_list_when_offline(session_mock, provider):
7472
session_mock.connection.state = spotify.ConnectionState.OFFLINE
7573

7674
result = provider.as_list()
7775

78-
assert len(result) == 3
79-
assert sp_starred_mock.load.call_count == 0
76+
assert len(result) == 2
8077

8178

82-
def test_as_list_when_playlist_container_isnt_loaded(
83-
session_mock, provider):
79+
def test_as_list_when_playlist_container_isnt_loaded(session_mock, provider):
8480
session_mock.playlist_container = None
8581

8682
result = provider.as_list()
8783

88-
assert len(result) == 1
89-
90-
assert result[0] == Ref.playlist(
91-
uri='spotify:user:alice:starred', name='Starred')
84+
assert len(result) == 0
9285

9386

9487
def test_as_list_with_folders_and_ignored_unloaded_playlist(provider):
9588
result = provider.as_list()
9689

97-
assert len(result) == 3
90+
assert len(result) == 2
9891

9992
assert result[0] == Ref.playlist(
100-
uri='spotify:user:alice:starred', name='Starred')
101-
assert result[1] == Ref.playlist(
10293
uri='spotify:user:alice:playlist:foo', name='Foo')
103-
assert result[2] == Ref.playlist(
94+
assert result[1] == Ref.playlist(
10495
uri='spotify:playlist:bob:baz', name='Bar/Baz (by bob)')
10596

10697

tests/test_translator.py

+7
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ def test_returns_unknown_date_if_year_is_none(self, sp_album_mock):
9696

9797
assert album.date is None
9898

99+
def test_returns_unknown_date_if_year_is_zero(self, sp_album_mock):
100+
sp_album_mock.year = 0
101+
102+
album = translator.to_album(sp_album_mock)
103+
104+
assert album.date is None
105+
99106
def test_caches_results(self, sp_album_mock):
100107
album1 = translator.to_album(sp_album_mock)
101108
album2 = translator.to_album(sp_album_mock)

0 commit comments

Comments
 (0)