diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d40c6b7..e385981 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ stages: test: stage: test - image: python:2 + image: python:3 before_script: - apt-get update - apt-get install libgirepository1.0-dev -y diff --git a/README.rst b/README.rst index 14423df..437e55a 100644 --- a/README.rst +++ b/README.rst @@ -22,9 +22,7 @@ Features Installation ------------ -We assume you have a Mopidy server available. **Because of `a bug in recent mopidy versions `_, -if you face any playback issues, you should use at least Mopidy 2.2.3 which is currently unreleased, or install the development version with -``pip install --user git+https://github.com/mopidy/mopidy.git``**. +We assume you have a Mopidy server available (version 3 or greater required). We don't have any package for this extension yet, so you may install from the repository: diff --git a/mopidy_funkwhale/commands.py b/mopidy_funkwhale/commands.py index 8d29206..4345039 100644 --- a/mopidy_funkwhale/commands.py +++ b/mopidy_funkwhale/commands.py @@ -1,4 +1,4 @@ -from mopidy import commands, compat, exceptions +from mopidy import commands, exceptions import requests_oauthlib @@ -77,7 +77,7 @@ class LoginCommand(commands.Command): prompt = "\nEnter the token:" - authorization_code = compat.input(prompt) + authorization_code = input(prompt) token = oauth.fetch_token( url + token_endpoint, code=authorization_code, diff --git a/mopidy_funkwhale/library.py b/mopidy_funkwhale/library.py index 174067c..164825d 100644 --- a/mopidy_funkwhale/library.py +++ b/mopidy_funkwhale/library.py @@ -99,7 +99,7 @@ class FunkwhaleLibraryProvider(backend.LibraryProvider): return result # root directory - return self.vfs.get(uri, {}).values() + return list(self.vfs.get(uri, {}).values()) def browse_favorites(self, remaining): if remaining == []: @@ -292,7 +292,6 @@ def convert_to_album(payload, uri_prefix="funkwhale:albums"): uri=uri_prefix + ":%s" % payload["id"], name=payload["title"], musicbrainz_id=payload["mbid"], - images=[image] if image else [], artists=[artist], date=payload["release_date"], num_tracks=len(payload.get("tracks", [])), @@ -314,7 +313,7 @@ def convert_to_track(payload, uri_prefix="funkwhale:tracks"): artists=[artist], album=album, date=payload["album"]["release_date"], - bitrate=(upload.get("bitrate") or 0) / 1000, + bitrate=int((upload.get("bitrate") or 0) / 1000), length=(upload.get("duration") or 0) * 1000, track_no=payload["position"], ) diff --git a/setup.cfg b/setup.cfg index 15880a8..eae2432 100644 --- a/setup.cfg +++ b/setup.cfg @@ -9,8 +9,6 @@ long_description = file: README.rst license = GLP-3 keywords = code, diff, copy-paste, linter, DRY classifiers = - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Programming Language :: Python :: 3.6 @@ -19,7 +17,7 @@ zip_safe = True include_package_data = True packages = find: install_requires = - mopidy + mopidy>=3,<3.1 requests requests_oauthlib pygobject diff --git a/tests/factories.py b/tests/factories.py index 0ec154e..3f10dd4 100644 --- a/tests/factories.py +++ b/tests/factories.py @@ -25,7 +25,7 @@ class AlbumJSONFactory(factory.Factory): id = factory.Sequence(int) mbid = factory.Faker("uuid4") title = factory.Faker("name") - tracks = factory.Iterator([range(i) for i in range(1, 30)]) + tracks = factory.Iterator([list(range(i)) for i in range(1, 30)]) artist = factory.SubFactory(ArtistJSONFactory) release_date = factory.Faker("date") cover = factory.SubFactory(CoverJSONFactory) diff --git a/tests/test_library.py b/tests/test_library.py index e5871ab..9923d15 100644 --- a/tests/test_library.py +++ b/tests/test_library.py @@ -44,7 +44,6 @@ def test_convert_album_to_model(): assert result.artists == frozenset( [mopidy_funkwhale.library.convert_to_artist(payload["artist"])] ) - assert result.images == frozenset([payload["cover"]["original"]]) def test_convert_track_to_model(): @@ -193,7 +192,7 @@ def test_browse_artists_albums(client, library, requests_mock): album2 = factories.AlbumJSONFactory(artist=album1["artist"]) url = ( client.session.url_base - + "albums/?page_size=50&ordering=title&playable=true&artist%s" + + "albums/?ordering=title&page_size=50&playable=true&artist=%s" % album1["artist"]["id"] ) requests_mock.get(url, json={"results": [album1, album2]})