lastfm: Define extension
This commit is contained in:
parent
0f1c4c1dff
commit
2176ab3d98
55
mopidy/frontends/lastfm/__init__.py
Normal file
55
mopidy/frontends/lastfm/__init__.py
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import mopidy
|
||||||
|
from mopidy import ext
|
||||||
|
from mopidy.exceptions import ExtensionError
|
||||||
|
|
||||||
|
|
||||||
|
__doc__ = """
|
||||||
|
Frontend which scrobbles the music you play to your `Last.fm
|
||||||
|
<http://www.last.fm>`_ profile.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
This frontend requires a free user account at Last.fm.
|
||||||
|
|
||||||
|
**Dependencies:**
|
||||||
|
|
||||||
|
.. literalinclude:: ../../../requirements/lastfm.txt
|
||||||
|
|
||||||
|
**Settings:**
|
||||||
|
|
||||||
|
- :attr:`mopidy.settings.LASTFM_USERNAME`
|
||||||
|
- :attr:`mopidy.settings.LASTFM_PASSWORD`
|
||||||
|
|
||||||
|
**Usage:**
|
||||||
|
|
||||||
|
Make sure :attr:`mopidy.settings.FRONTENDS` includes
|
||||||
|
``mopidy.frontends.lastfm.LastfmFrontend``. By default, the setting includes
|
||||||
|
the Last.fm frontend.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
# TODO Move import into method when FRONTENDS setting is removed
|
||||||
|
from .actor import LastfmFrontend
|
||||||
|
|
||||||
|
|
||||||
|
class Extension(ext.Extension):
|
||||||
|
|
||||||
|
name = 'Mopidy-Lastfm'
|
||||||
|
version = mopidy.__version__
|
||||||
|
|
||||||
|
def get_default_config(self):
|
||||||
|
return '[lastfm]'
|
||||||
|
|
||||||
|
def validate_config(self, config):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def validate_environment(self):
|
||||||
|
try:
|
||||||
|
import pylast # noqa
|
||||||
|
except ImportError as e:
|
||||||
|
raise ExtensionError('pylast library not found', e)
|
||||||
|
|
||||||
|
def get_frontend_classes(self):
|
||||||
|
return [LastfmFrontend]
|
||||||
@ -1,27 +1,3 @@
|
|||||||
"""
|
|
||||||
Frontend which scrobbles the music you play to your `Last.fm
|
|
||||||
<http://www.last.fm>`_ profile.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
This frontend requires a free user account at Last.fm.
|
|
||||||
|
|
||||||
**Dependencies:**
|
|
||||||
|
|
||||||
.. literalinclude:: ../../../requirements/lastfm.txt
|
|
||||||
|
|
||||||
**Settings:**
|
|
||||||
|
|
||||||
- :attr:`mopidy.settings.LASTFM_USERNAME`
|
|
||||||
- :attr:`mopidy.settings.LASTFM_PASSWORD`
|
|
||||||
|
|
||||||
**Usage:**
|
|
||||||
|
|
||||||
Make sure :attr:`mopidy.settings.FRONTENDS` includes
|
|
||||||
``mopidy.frontends.lastfm.LastfmFrontend``. By default, the setting includes
|
|
||||||
the Last.fm frontend.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
1
setup.py
1
setup.py
@ -46,6 +46,7 @@ setup(
|
|||||||
],
|
],
|
||||||
b'mopidy.extension': [
|
b'mopidy.extension': [
|
||||||
'http = mopidy.frontends.http:Extension',
|
'http = mopidy.frontends.http:Extension',
|
||||||
|
'lastfm = mopidy.frontends.lastfm:Extension',
|
||||||
'local = mopidy.backends.local:Extension',
|
'local = mopidy.backends.local:Extension',
|
||||||
'mpd = mopidy.frontends.mpd:Extension',
|
'mpd = mopidy.frontends.mpd:Extension',
|
||||||
'mpris = mopidy.frontends.mpris:Extension',
|
'mpris = mopidy.frontends.mpris:Extension',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user