Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to work with new playback API in Mopidy 1.0 #11

Merged
merged 3 commits into from Mar 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion README.rst
Expand Up @@ -54,8 +54,17 @@ Project resources
Changelog
=========

v1.0.0 (UNRELEASED)
-------------------

- Require Mopidy >= 1.0

- Update to work with new playback API in Mopidy 1.0

- Update to work with new search API in Mopidy 1.0

v0.3.1 (2014-01-28)
-----------------
-------------------

- Removed last_modified field from Playlist generation, to avoid problem in Mopidy core

Expand Down
2 changes: 1 addition & 1 deletion mopidy_subsonic/__init__.py
Expand Up @@ -4,7 +4,7 @@

from mopidy import ext, config

__version__ = '0.3.1'
__version__ = '1.0.0'


class SubsonicExtension(ext.Extension):
Expand Down
19 changes: 4 additions & 15 deletions mopidy_subsonic/actor.py
Expand Up @@ -9,7 +9,6 @@
from .playlist import SubsonicPlaylistsProvider
from .client import SubsonicRemoteClient

from mopidy.models import Track

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -37,18 +36,8 @@ def __init__(self, config, audio):

class SubsonicPlaybackProvider(backend.PlaybackProvider):

def play(self, track):
logger.debug('Getting info for track %s' % (track.name))
id = track.uri.split("subsonic://")[1]
def translate_uri(self, uri):
logger.debug('Getting info for track %s' % uri)
id = uri.split('subsonic://')[1]
real_uri = self.backend.remote.build_url_from_song_id(id)
ntrack = Track(
uri=real_uri,
name=track.name,
artists=track.artists,
album=track.album,
track_no=track.track_no,
disc_no=track.disc_no,
date=track.date,
length=track.length,
bitrate=track.bitrate)
return super(SubsonicPlaybackProvider, self).play(ntrack)
return real_uri
7 changes: 5 additions & 2 deletions mopidy_subsonic/library.py
Expand Up @@ -14,7 +14,7 @@ def __init__(self, *args, **kwargs):
super(SubsonicLibraryProvider, self).__init__(*args, **kwargs)
self.remote = self.backend.remote

def find_exact(self, query=None, uris=None):
def _find_exact(self, query=None, uris=None):
if not query:
# Fetch all artists(browse library)
return SearchResult(
Expand All @@ -26,7 +26,10 @@ def find_exact(self, query=None, uris=None):
tracks=self.remote.get_tracks_by(
query.get('artist'), query.get('album')))

def search(self, query=None, uris=None):
def search(self, query=None, uris=None, exact=False):
if exact:
return self._find_exact(query=query, uris=uris)

logger.debug('Query "%s":' % query)

artist, album, title, any = None, None, None, None
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -23,7 +23,7 @@ def get_version(filename):
include_package_data=True,
install_requires=[
'setuptools',
'Mopidy >= 0.18',
'Mopidy >= 1.0',
'Pykka >= 1.1',
'py-sonic',
],
Expand Down