resolv conflict
This commit is contained in:
commit
4bc641e95a
3 changed files with 26 additions and 5 deletions
|
@ -14,6 +14,8 @@ Mopidy-Subidy
|
||||||
:target: https://codecov.io/gh/Prior99/mopidy-subidy
|
:target: https://codecov.io/gh/Prior99/mopidy-subidy
|
||||||
:alt: Test coverage
|
:alt: Test coverage
|
||||||
|
|
||||||
|
**This library is actively looking for maintainers to help out as I do not have the time or need to maintain this anymore. Please contact me if you feel that you could maintain this.**
|
||||||
|
|
||||||
A Subsonic backend for Mopidy using `py-sonic
|
A Subsonic backend for Mopidy using `py-sonic
|
||||||
<https://github.com/crustymonkey/py-sonic>`_.
|
<https://github.com/crustymonkey/py-sonic>`_.
|
||||||
|
|
||||||
|
|
|
@ -429,9 +429,11 @@ class SubsonicApi:
|
||||||
return songs
|
return songs
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_raw_album_list(self, ltype, size=MAX_LIST_RESULTS):
|
def get_more_albums(self, ltype, size=MAX_LIST_RESULTS, offset=0):
|
||||||
try:
|
try:
|
||||||
response = self.connection.getAlbumList2(ltype=ltype, size=size)
|
response = self.connection.getAlbumList2(
|
||||||
|
ltype=ltype, size=size, offset=offset
|
||||||
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Connecting to subsonic failed when loading album list."
|
"Connecting to subsonic failed when loading album list."
|
||||||
|
@ -448,6 +450,24 @@ class SubsonicApi:
|
||||||
return albums
|
return albums
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
def get_raw_album_list(self, ltype, size=MAX_LIST_RESULTS):
|
||||||
|
"""
|
||||||
|
Subsonic servers don't offer any way to retrieve the total number
|
||||||
|
of albums to get, and the spec states that the max number returned
|
||||||
|
for `getAlbumList2` is 500. To get all the albums, we make a
|
||||||
|
`getAlbumList2` request each time the response contains 500 albums. If
|
||||||
|
it does not, we assume we have all the albums and return them.
|
||||||
|
"""
|
||||||
|
offset = 0
|
||||||
|
total = []
|
||||||
|
albums = self.get_more_albums(ltype, size, offset)
|
||||||
|
total = albums
|
||||||
|
while len(albums) == size:
|
||||||
|
offset = offset + size
|
||||||
|
albums = self.get_more_albums(ltype, size, offset)
|
||||||
|
total = total + albums
|
||||||
|
return total
|
||||||
|
|
||||||
def get_albums_as_refs(self, artist_id=None):
|
def get_albums_as_refs(self, artist_id=None):
|
||||||
albums = (
|
albums = (
|
||||||
self.get_raw_album_list("alphabeticalByName")
|
self.get_raw_album_list("alphabeticalByName")
|
||||||
|
@ -501,8 +521,7 @@ class SubsonicApi:
|
||||||
|
|
||||||
def get_random_songs_as_tracks(self):
|
def get_random_songs_as_tracks(self):
|
||||||
return [
|
return [
|
||||||
self.raw_song_to_track(song)
|
self.raw_song_to_track(song) for song in self.get_raw_random_song()
|
||||||
for song in self.get_raw_random_song()
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_artists_as_artists(self):
|
def get_artists_as_artists(self):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
name = Mopidy-Subidy
|
name = Mopidy-Subidy
|
||||||
version = 1.0.0
|
version = 1.1.0
|
||||||
url = https://github.com/Prior99/mopidy-subidy
|
url = https://github.com/Prior99/mopidy-subidy
|
||||||
author = prior99
|
author = prior99
|
||||||
author_email = fgnodtke@cronosx.de
|
author_email = fgnodtke@cronosx.de
|
||||||
|
|
Loading…
Add table
Reference in a new issue